magento - While adding product attribute "Use is product listing" option setting as "Yes" -


i have added code in installer in custom magento module.

     $installer->addattribute('catalog_product','size_guide',array(     'group' => 'general',     'type' =>  'tinyint',     'label' => 'enable sizechart',     'input' => 'boolean',     'source' => 'eav/entity_attribute_source_table',     'global' => mage_catalog_model_resource_eav_attribute::scope_global,     'visible' => true,     'required' => false,     'user_defined' => true,     'used_in_product_listing' => true,     'default' => '',     'unique' => false,enter code here     'apply_to' => ''     ));     
after installing module attribute "size_guide" added "used in product listing" dropdown in attribute still set no seen in code have set used in product listing true.

'used_in_product_listing' => true,

i appreciate help.

thanks in advance.

when @ definition of method in mage_eav_model_entity_setup class following code:

$data = array_merge(         array(             'entity_type_id' => $entitytypeid,             'attribute_code' => $code         ),         $this->_preparevalues($attr)      ); 

this code prepares data attribute. in _preparevalues() method can see returning array not contain used_in_product_listing key. if providing in array not passed method. resolve issue must declare own resource setup model in config.xml

<resources>   <company_module_setup>     <setup>       <module>company_module</module>       <class>company_module_model_resource_setup</class>     </setup>   </company_module_setup> </resources>     

then create class , override _preparevalues() method this

class company_module_model_resource_setup extends mage_eav_model_entity_setup {    protected function _preparevalues($attr) {     $data = parent::_preparevalues($attr);     $data = array_merge($data, array(         'frontend_input_renderer'       => $this->_getvalue($attr, 'input_renderer'),         'is_global'                     => $this->_getvalue(             $attr,             'global',             mage_catalog_model_resource_eav_attribute::scope_global         ),         'is_visible'                    => $this->_getvalue($attr, 'visible', 1),         'is_searchable'                 => $this->_getvalue($attr, 'searchable', 0),         'is_filterable'                 => $this->_getvalue($attr, 'filterable', 0),         'is_comparable'                 => $this->_getvalue($attr, 'comparable', 0),         'is_visible_on_front'           => $this->_getvalue($attr, 'visible_on_front', 0),         'is_wysiwyg_enabled'            => $this->_getvalue($attr, 'wysiwyg_enabled', 0),         'is_html_allowed_on_front'      => $this->_getvalue($attr, 'is_html_allowed_on_front', 0),         'is_visible_in_advanced_search' => $this->_getvalue($attr, 'visible_in_advanced_search', 0),         'is_filterable_in_search'       => $this->_getvalue($attr, 'filterable_in_search', 0),         'used_in_product_listing'       => $this->_getvalue($attr, 'used_in_product_listing', 0),         'used_for_sort_by'              => $this->_getvalue($attr, 'used_for_sort_by', 0),         'apply_to'                      => $this->_getvalue($attr, 'apply_to'),         'position'                      => $this->_getvalue($attr, 'position', 0),         'is_configurable'               => $this->_getvalue($attr, 'is_configurable', 1),         'is_used_for_promo_rules'       => $this->_getvalue($attr, 'used_for_promo_rules', 0)     ));     return $data;   }  } 

it allow add rest of options attribute


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -