您的位置:首页 > 编程语言

Magento中目录添加自定义属性代码

2013-06-02 19:12 363 查看
如何给magento的产品分类创建一个自定义属性?脚本跑一遍,就在magento后台分类编辑页面的General Information组里新加了自定义属性。

更多详细内容请查看:

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;

$attribute = array(

'type' => 'int',

'label'=> 'Discount(%)',

'input' => 'text',

'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,

'visible' => true,

'required' => false,

'user_defined' => true,

'default' => "",

'group' => "General Information"

);

$installer->addAttribute('catalog_category', 'category_attribute_code ', $attribute);

//$installer->removeAttribute('catalog_category', 'category_attribute_hottest');

$installer->endSetup();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: