<?php $arg_attribute = "attribute code";
$dataArry=array('M','L','SL','XXL');
$attr_model = Mage::getModel('catalog/resource_eav_attribute');
$attr = $attr_model->loadByCode('catalog_product', $arg_attribute);
$attr_id = $attr->getAttributeId();
foreach($dataArry as $dataVal){
$option['attribute_id'] = $attr_id;
$option['value'][][0] = $dataValh;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttributeOption($option);
}
?>
$dataArry=array('M','L','SL','XXL');
$attr_model = Mage::getModel('catalog/resource_eav_attribute');
$attr = $attr_model->loadByCode('catalog_product', $arg_attribute);
$attr_id = $attr->getAttributeId();
foreach($dataArry as $dataVal){
$option['attribute_id'] = $attr_id;
$option['value'][][0] = $dataValh;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttributeOption($option);
}
?>
No comments:
Post a Comment