1

I want to add custom attribute in Customer account tab in Admin Panel. I am using magento 1.6.2. I have read many blogs but could not able to acheive it as the file Mage/Customer/Model/Entity/Setup.php is different in CE 1.6.2 and CE < 1.6.0. So could not able to find the correct answer. If anyone has done it Kindly help me to achieve it. Thanks

Gaurav Porwal
  • 11
  • 1
  • 2

2 Answers2

7

Use this to create a module that does that:

http://silksoftware.com/magento-module-creator/

Then go to the 'Need add Customer Attribute section'. It's pretty self-explanatory.

Play with it! it's a VERY useful tool. You can see that there is more to it than making a module that provides new customer attributes. Also read up on clearing caches / compilation before installing new modules.

Seth Malaki
  • 4,436
  • 23
  • 48
  • Hi Malaki, Thanks for your prompt reply, I have tried created module for backend page. I choosed to add customer attribute ( credit limit and time frame ), I can see that in the eav_attribute table the two attributes have been created but the back and the front end is not opening . it is showing me the error Exception printing is disabled by default for security reasons. Error log record number: 1639477309 – Gaurav Porwal May 25 '12 at 11:12
  • can you figure it out what can go wrong. I have entered the following parameters in the module creator: Need Backend Page : YES Need Add Customer Attribute : YES entered the 2 attributes and leave the other parameters as default. Thanks – Gaurav Porwal May 25 '12 at 11:18
  • Thanks Malaki, It is working , I can able to create admin module. Hope now i can able to build my Business Logic on it. – Gaurav Porwal May 25 '12 at 13:04
  • @SethJeremiMalaki You are my hero for posting that link. – pspahn May 25 '12 at 16:28
  • @SethJeremiMalaki Damn. Wish I saw that link about 5 weeks ago, when I started digging into module creation. ... just. damn. Seems like a great tool. – Bosworth99 Sep 13 '12 at 00:27
0

There is no major change in add customer fields between CE1.5 & CE1.6 in magento.

The main change in user phtml file location. Check the below link, It will helps you.

How to create new fields for customer

Community
  • 1
  • 1
Sankar Subburaj
  • 4,992
  • 12
  • 48
  • 79
  • I can notice the difference in the Model/Entity/Setup.php (CE 1.6.0) one can see the array list of attributes but in CE1.6.2 you will not find the array list. In Magento 1.6.2 you will find the array list in Resource/Setup.php. I even tried to change the path in config.xml file from Company_Modulename_Model_Entity_Setup to Company_Modulename_Model_Resource_Setup but it did not work out. – Gaurav Porwal May 25 '12 at 11:37
  • Hi Shankar, I Have done the following, If you can tell me where i am wrong. In config.xml 0.1.0 Kritnu_Credit_Model – Gaurav Porwal May 25 '12 at 12:09
  • Kritnu_Credit Mage_Customer_Model_Entity_Setup core_setup core_write core_read – Gaurav Porwal May 25 '12 at 12:09
  • in credit/sql/credit_setup/mysql4-installation-0.1.0.php startSetup(); $setup = Mage::getModel('customer/entity_setup', 'core_setup'); $setup->addAttribute('customer', 'credit', array( 'type' => 'int', 'input' => 'text', 'label' => 'Credit', 'global' => 1, 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'default' => '0', 'visible_on_front' => 1, 'source'=> '', )); – Gaurav Porwal May 25 '12 at 12:10
  • if (version_compare(Mage::getVersion(), '1.6.0', '<=')) { $customer = Mage::getModel('customer/customer'); $attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId(); $setup->addAttributeToSet('customer', $attrSetId, 'General', 'credit'); } if (version_compare(Mage::getVersion(), '1.4.2', '>=')) { Mage::getSingleton('eav/config') ->getAttribute('customer', 'credit') ->setData('used_in_forms', array('adminhtml_customer','customer_account_create','customer_account_edit','checkout_register')) ->save(); } $installer->endSetup(); – Gaurav Porwal May 25 '12 at 12:10
  • This is what i have done in 2 files. So till now i can able to see the credit label in the "account information " of Manage customer. But i could not.. From the past 1 week i am looking for the answer.. – Gaurav Porwal May 25 '12 at 12:11