Hello,
I now have successfully added a customer attribute (yay!).
In the Adminhtml backend under Account Information it is editable as a text input field.
I would like to have a dropdown instead, similar to the “is confirmed” attribute.
I can’t find the difference between my attribute and confirmed. same input type in the eav_attribute table, no diffenet model in the db either.
Can someone give me a pointer how to do that?
I decided to override Mage_Adminhtml_Block_Customer_Edit_Tab_Account to do the job like Varien did with the confirmed customer attribute.
But I still had a good look at how the tax class works, thanks for the pointer.
You know, you could just set the ‘frontend_input’, ‘frontend_label’, and ‘frontend_class’ columns for your attribute and do the same thing without writing a single line of code.
frontend_input = ‘checkbox’
frontend_label = ‘Your checkbox label goes here’
frontend_class = ‘Any CSS class you want applied to the checkbox element
Disclaimer: I haven’t tried this myself, but it looks like the ‘correct’ way to do it. Of course, developer documentation would rock. =)
One trick is to look at the ‘source_model’ column of the attribute in the ‘eav_attribute’ table. This corresponds to a Model class.
This show how the Tax Class attribute dropdown is populated
SELECT * FROM magento.eav_attribute where attribute_code = 'tax_class_id'
It uses this model class: Mage_Tax_Model_Class_Source_Product
Try looking at that and see if it helps
I followed your directions and i successfully solved my problem with creating a drop-down with options filled from my own module (Vendors). I want to thank you for your magic post, so short, but so damn informative, thanks!
If anyone interested, I needed to store more information about Vendors, not just a attribute within the product attribute_set. So i created my own Module ( using ModuleCreator), it has Add / Edit / Delete functionality, the only problem i had was to link my Vendors to the product, so that an Administrator using the Admin console of Magento could just select the right Vendor from a drop-down for any product entered / edited.