脚本宝典收集整理的这篇文章主要介绍了php – 为magento中的属性选项添加新值,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
$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');
以上是脚本宝典为你收集整理的php – 为magento中的属性选项添加新值全部内容,希望文章能够帮你解决php – 为magento中的属性选项添加新值所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。