$installer = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer->startSetup(); $aManufacturers = array('Sony','Philips','Samsung','LG','Panasonic','Fujitsu','Daewoo','Grundig','Hitachi','JVC','Pioneer','Teac','Bose','Toshiba','Denon','Onkyo','Sharp','Yamaha','Jamo'); $iProductEntityTypeId = Mage::getModel('catalog/product')->getResource()->getTypeId(); $aOption = array(); $aOption['attribute_id'] = $installer->getAttributeId($iProductEntityTypeId,'manufacturer'); for($iCount=0;$iCount<sizeof($aManufacturers);$iCount++){ $aOption['value']['option'.$iCount][0] = $aManufacturers[$iCount]; } $installer->addAttributeOption($aOption); $installer->endSetup();
如果需要,可以在Magento wiki上获得更多文档.
如果您不想在自定义模块中执行此操作,则可以创建一个以以下内容开头的PHP文件:
require_once 'app/Mage.PHP'; umask(0); Mage::app('default');