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();
更多详细内容请查看:
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();
相关文章推荐
- Magento 目录添加自定义属性例子
- SEO小技巧之如何PHP中添加自定义Last-Modified 属性代码
- 如何给magento的分类添加自定义属性
- 在Storyboard中为控件添加自定义属性
- 给分类(Category)添加自定义属性
- Documentum常见问题7—为客户化Type类型Import时添加自定义属性
- SugarCRM - 如何在Contact编辑页面,添加自定义代码
- 无缝滚动;flash播放器代码(网站使用);QQ帮助代码;Js添加属性IE和firefox的区别
- Kotlin+Databinding如何为布局添加自定义属性
- C++实现自动为对象添加“属性”访问代码
- 给内置对象或自定义对象添加存取器属性(在兼容性上会比较有用)
- SpringBoot添加自定义拦截器的实现代码
- XCode: 如何添加自定义代码片段
- 黑马程序员--08.注解--03【自定义注解】【为注解添加属性】
- redmine添加自定义属性
- 给自定义Web控件添加事件(前后台代码)
- unity3d 代码 添加和删除脚本,或者其他属性
- 【AS3代码】添加/删除XML子元素及属性
- Mapxtreme 添加和删除图元并且添加一些自定义的属性
- 说说Android 两种为自定义组件添加属性的使用方法和区别