2

I want to create an attribute for simple,virtual,downlodable and configurable products only. Below is my code.

$model=Mage::getModel('eav/entity_setup','core_setup');
$data=array(
    'group'             => 'Prices',
    'label'             => 'Test3',
    'type'              => 'int',
    'input'             => 'boolean',
    'source'            => 'eav/entity_attribute_source_boolean',
    'global'            =>     Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'visible'           => 1,
    'required'          => 1,
    'user_defined'      => 1,
    'searchable'        => 0,
    'filterable'        => 0,
    'comparable'        => 0,
    'visible_on_front'  => 0,
    'visible_in_advanced_search'    => 0,
    'unique'            => 0,
    'default'           => 0,
    'is_used_for_promo_rules' => 1,
    'apply_to'          => array('simple', 'configurable', 'virtual', 'downloadable'),
    'is_configurable'   => false
);
$model->addAttribute('catalog_product','test3',$data);

But issue is attribute is created for all product type.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.