为自定义类别属性启用wysiwyg编辑器

时间:2013-02-27 12:22:34

标签: magento magento-1.6

我为类别创建了自定义属性。我以为我使用“'wysiwyg_enabled'=> true”来启用WYSIWYG编辑器,但所见即所得不显示。

$installer->addAttribute(Mage_Catalog_Model_Category::ENTITY, 'shortdescription', array(
    'type'              => 'text',
    'backend'           => '',
    'frontend'          => '',
    'label'             => 'Short description',
    'input'             => 'textarea',
    'class'             => '',
    'source'            => '',
    'global'            => '0',
    'visible'           => true,
    'required'          => false,
    'user_defined'      => true,
    'default'           => '',
    'searchable'        => false,
    'filterable'        => false,
    'comparable'        => false,
    'visible_on_front'  => true,
    'used_in_product_listing' => false,
    'unique'            => false,
    'wysiwyg_enabled'   => true,
    'apply_to'          => '',
    'is_configurable'   => true
)); 

任何帮助将不胜感激。我使用magento 1.6.2。

3 个答案:

答案 0 :(得分:7)

尝试(没有所有其他选项)

 <?php
 $this->startSetup();
 $this->addAttribute('catalog_category', 'custom_attribute', array(
     'group'         => 'General',
     'input'         => 'textarea',
     'type'          => 'text',
     'label'         => 'Custom attribute',
     'backend'       => '',
     'visible'       => true,
     'required'      => false,
     'wysiwyg_enabled' => true,
     'visible_on_front' => true,
     'is_html_allowed_on_front' => true,
     'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
 ));

 $this->endSetup();

假设您的设置$this->startSetup()Mage_Catalog_Model_Resource_Eav_Mysql4_Setup

的瞬间
<global>
    <resources>
        <add_category_attribute>
            <setup>
                <module>...</module>
                <class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
            </setup>

您也可以

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');

$setup->addAttribute('catalog_category' ...

请参阅http://www.atwix.com/magento/add-category-attribute/

答案 1 :(得分:1)

如果您是从magento管理员创建的,而不是通过编码,则以下内容可能有所帮助:    

 Go to admin panel > catalog > manage attributes > 
select your attribute(eg. short description) > Attribute Information >
properties > Frontend properties...
Now select 'Yes' from the 'Enable WYSIWYG' dropdown.

答案 2 :(得分:0)

创建一个sql更新

代表is_wysiwyg_enabled

$installer->updateAttribute('catalog_category', 'certifications', 'is_wysiwyg_enabled', 1);

代表is_html_allowed_on_front

$installer->updateAttribute('catalog_category', 'certifications', 'is_html_allowed_on_front', 1);