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

更新时间:2017-11-28    来源:magento    手机版     字体:

【www.bbyears.com--magento】

在根目录创建个脚本文件,内容:

 代码如下 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();

自定义属性的label和category_attribute_code自己更改。

本文来源:http://www.bbyears.com/wangyezhizuo/37381.html

热门标签

更多>>

本类排行