Questionsmagento : update custom attribute of category
mmWebetutorial Staff asked 8 months ago

You need to create file with your desired name (ex: categoryroot.php) in magento root & hit one time and remove them after hit.

 

require_once(‘app/Mage.php’);

Mage::app()->setCurrentStore(Mage::getModel(‘core/store’)->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup;

$installer->startSetup();

$aManufacturers = array(‘Brand Value’,’Brand Product’);
$iProductEntityTypeId = Mage::getModel(‘catalog/category’)->getResource()->getTypeId();
$aOption = array();
$aOption[‘attribute_id’] = $installer->getAttributeId($iProductEntityTypeId, ‘call_to_action’);
//echo $aOption[‘attribute_id’]; exit;

for($iCount=0;$iCount<sizeof($aManufacturers);$iCount++){
$aOption[‘value’][‘option’.$iCount][0] = $aManufacturers[$iCount];
}
$installer->addAttributeOption($aOption);

$installer->endSetup();

Your Answer
Login
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.