zoukankan      html  css  js  c++  java
  • Magento添加分类属性

    以该分类自定义热词举例
    第一步:添加属性标示(attribute_code)

    INSERT INTO `eav_attribute`  ( `entity_type_id` ,`attribute_code` ,`backend_type` ,`frontend_input` ,`frontend_label` ) VALUES ('3', 'hot_search_keyword', 'text', 'textarea', 'Hot Search Keyword');

    得到id:154(这是我自己数据库的值)
    第二步:添加对应关系,使其属于Category

    INSERT INTO `eav_entity_attribute` (`entity_type_id`,`attribute_set_id`,`attribute_group_id`,`attribute_id`,`sort_order`) VALUES('3','3','3','154','4');

    第三步:设置该属性参数

    INSERT INTO `catalog_eav_attribute`  (`attribute_id` ,`is_visible` ,`is_searchable` ,`is_used_for_price_rules` ,`is_configurable` , `position` ,`is_wysiwyg_enabled`) VALUES ('154','1', '1', '1', '1', '1', '1');

    数据调用方法:
    使用方法getData(‘attribute_code’) 获取数据 修改 catalog/category/view.phtml 添加以下代码进行测试

    <?php echo $_category->getData('short_description');  ?>
  • 相关阅读:
    抽象类
    类初始化
    final关键字
    super关键字
    继承
    常用类

    封装
    方法重载
    031:Cetus sharding
  • 原文地址:https://www.cnblogs.com/liuxgnu/p/3535101.html
Copyright © 2011-2022 走看看