entity attribute value - Magento EAV: What is the 'source' setting used for? -
entity attribute value - Magento EAV: What is the 'source' setting used for? -
i'm curious used for? defined next source model custom attribute added entity script, yet have no thought how create utilize of source attribute. maybe can utilize form widget? attribute added exportstatus client eav.
<?php class company_customer_model_customer_attribute_source_exportstatus extends mage_eav_model_entity_attribute_source_abstract { public function getalloptions() { if (!$this->_options) { $this->_options = array( array( 'value' => '0', 'label' => 'pending export', ), array( 'value' => '1', 'label' => 'exported mainframe', ), array( 'value' => '2', 'label' => 'acknowledged mainframe', ) ); } homecoming $this->_options; } }
and
<?php class company_customer_model_resource_eav_mysql4_setup extends mage_eav_model_entity_setup { public function getdefaultentities() { homecoming array( 'customer' => array( 'entity_model' =>'customer/customer', 'attribute_model' => 'customer/attribute', 'table' => 'customer/entity', 'additional_attribute_table' => 'customer/eav_attribute', 'entity_attribute_collection' => 'customer/attribute_collection', 'attributes' => array( 'export_status' => array( //'group' => 'group/tab', 'label' => 'customer export status', 'type' => 'int', 'input' => 'select', 'default' => '0', 'class' => '', 'backend' => '', 'frontend' => '', 'source' => 'company_customer/customer_attribute_source_exportstatus', 'global' => 2, //global scope 'visible' => true, 'required' => false, 'user_defined' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'visible_in_advanced_search' => false, 'unique' => false ) ) ) ); } }
it allows create drop downwards menus.
see article:
http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/installing_custom_attributes_with_your_module
specifically appendix a: dropdown options
magento entity-attribute-value
Comments
Post a Comment