Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. $installer = $this;
  2.  
  3. $installer->startSetup();
  4.  
  5. $installer->addAttribute('customer','badge', array(
  6. 'label' => 'Badge',
  7. 'type' => 'text', //backend_type
  8. 'input' => 'multiselect', //frontend_input
  9. 'backend' => 'eav/entity_attribute_backend_array',
  10. 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
  11. 'source' => 'marketplace/eav_entity_attribute_source_badge', // Goes to Step 2
  12. 'visible' => true,
  13. 'required' => false,
  14. 'default' => '',
  15. 'frontend' => '',
  16. 'unique' => false,
  17. 'note' => ''
  18. ));
  19. ));
  20. Mage::getSingleton('eav/config')
  21. ->getAttribute('customer', 'badge')
  22. ->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'))
  23. ->save();
  24. $installer->endSetup();
  25.  
  26. class Company_Marketplace_Model_System_Config_Source_Badge extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
  27. {
  28. protected $_options;
  29.  
  30. public function toOptionArray()
  31. {
  32.  
  33. $collection = Mage::getModel('marketplace/badge')->getCollection();
  34. $allattributes = array();
  35. foreach($collection as $data)
  36. {
  37. $allattributes[] = array('value' => $data->getBadgeName(), 'label' => $data->getBadgeName());
  38. }
  39.  
  40. return $allattributes;
  41. }
  42.  
  43. 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