1

I am using the following function to add an attribute in an upgrade script:

$model->addAttribute('catalog_product', "LOAD TYPE", array(
    'type' => 'int',
    'input' => 'select',
    'label' => 'LOAD TYPE',
    'is_configurable' => '0',
    'user_defined'=>'1',
    'required' => false,
    'backend' => 'eav/entity_attribute_backend_array',
    'option' => array ( 'values' => array( 0 => 'white', ) ),
    'is_configurable' => false,
    'apply_to' => array('simple')
)); 

But apply_to does not work to select the product types.

0

1 Answer 1

1

apply_to has to be passed as comma separated list, not as array.

So the correct code is:

$model->addAttribute('catalog_product', "LOAD TYPE", array(
    'type' => 'int',
    'input' => 'select',
    'label' => 'LOAD TYPE',
    'is_configurable' => '0',
    'user_defined'=>'1',
    'required' => false,
    'backend' => 'eav/entity_attribute_backend_array',
    'option' => array ( 'values' => array( 0 => 'white', ) ),
    'is_configurable' => false,
    'apply_to' => 'simple'
)); 
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.