Wednesday, January 13, 2016

Install Script to add Product "Drop down" attribute

<?php
/* @var $model Mage_Eav_Model_Entity_Setup */$model = Mage::getModel('eav/entity_setup','core_setup');

$model->startSetup();

$data = array(
    'type'              =>  'varchar',
    'input'             =>  'select',
    'label'             =>  'Sale Label',
    'global'            =>  Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
    'required'          =>  '0',
    'comparable'        =>  '0',
    'searchable'        =>  '0',
    'is_unique'         =>  '1',
    'is_configurable'   =>  '1',
    'user_defined'      =>  true,
    'group'             =>  'Kixx online',
    'attribute_set'     =>  'Producten');

$model->addAttribute('catalog_product', 'salelabel', $data);


$attributeId        =   $model->getAttribute('catalog_product','salelabel');
$attributeSetId     =   $model->getAttributeSetId('catalog_product','Producten');
/** Get attribute group info */$attributeGroupId   =   $model->getAttributeGroup('catalog_product',$attributeSetId,'Kixx online');
/** Add attribute to a set */$model->addAttributeToSet('catalog_product',$attributeSetId,$attributeGroupId,$attributeId);

$model->endSetup();

No comments:

Post a Comment