Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $installer = $this;
- $installer->startSetup();
- $installer->addAttribute('customer','badge', array(
- 'label' => 'Badge',
- 'type' => 'text', //backend_type
- 'input' => 'multiselect', //frontend_input
- 'backend' => 'eav/entity_attribute_backend_array',
- 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
- 'source' => 'marketplace/eav_entity_attribute_source_badge', // Goes to Step 2
- 'visible' => true,
- 'required' => false,
- 'default' => '',
- 'frontend' => '',
- 'unique' => false,
- 'note' => ''
- ));
- ));
- Mage::getSingleton('eav/config')
- ->getAttribute('customer', 'badge')
- ->setData('used_in_forms', array('customer_account_create','customer_account_edit','customer_address_edit','checkout_onepage_register','checkout_onepage_register_guest','checkout_onepage_billing_address','adminhtml_customer','checkout_onepage_shipping_address','checkout_multishipping_register'))
- ->save();
- $installer->endSetup();
- class Company_Marketplace_Model_System_Config_Source_Badge extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
- {
- protected $_options;
- public function toOptionArray()
- {
- $collection = Mage::getModel('marketplace/badge')->getCollection();
- $allattributes = array();
- foreach($collection as $data)
- {
- $allattributes[] = array('value' => $data->getBadgeName(), 'label' => $data->getBadgeName());
- }
- return $allattributes;
- }
- Fatal error: Call to undefined method Mage_Core_Model_Resource_Setup::addAttribute() in F:wampwwwmagento1appcodelocalCompanyMarketplacesqlmarketplace_setupmysql4-upgrade-1.0.0-1.0.1.php on line 6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement