erwin_smit
erwin_smit

Reputation: 700

Enable wysiwyg editor for custom category attribute

I created a custom attribute for the categories. I thought I enable the WYSIWYG editor with "'wysiwyg_enabled' => true", but the WYSIWYG doesn't show up.

$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
)); 

Any help would be appreciated. I use magento 1.6.2.

Upvotes: 3

Views: 5123

Answers (3)

3afsus
3afsus

Reputation: 81

create an sql update

for is_wysiwyg_enabled

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

for is_html_allowed_on_front

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

Upvotes: 0

MagePal Extensions
MagePal Extensions

Reputation: 17656

Try (without all the additional options)

 <?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();

Assuming that in your setup $this->startSetup() is an instant of 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>

You could also do

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');

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

See http://www.atwix.com/magento/add-category-attribute/

Upvotes: 8

Harshad M
Harshad M

Reputation: 363

If you have created the attribute from the magento admin and not by coding, following may help:

 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.

Upvotes: 1

Related Questions