3

我为类别创建了一个自定义属性。我以为我用“'wysiwyg_enabled' => true”启用了所见即所得编辑器,但所见即所得没有出现。

$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。

4

3 回答 3

8

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

 <?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/

于 2013-02-27T14:15:55.627 回答
1

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

转到管理面板>目录>管理属性>
选择您的属性(例如简短描述)>属性信息>
属性>前端属性...
现在从“启用所见即所得”下拉列表中选择“是”。

于 2013-02-27T13:42:02.067 回答
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);
于 2013-07-24T10:30:20.983 回答