Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add category attribute with WYSIWYG enabled

I'm following this tutorial: http://www.atwix.com/magento/add-category-attribute/ All is working well, attributes are added to categories, but without the WYSIWYG button below the field. WYSIWYG is enabled in System > Config > Content Management.

$this->startSetup();
$this->addAttribute('catalog_category', 'custom_att', array(
    'group'         => 'General',
    'input'         => 'textarea',
    'type'          => 'text',
    'label'         => 'My 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();

Whatever I try, WYSIWYG is not enabled for my attributes. Can anyone help? Or maybe there is a workaround for this?

EDIT: I searched other posts but all say that this code should add the WYSIWYG:

'wysiwyg_enabled' => true,

but it doesn't.

like image 902
zitix Avatar asked Mar 07 '13 22:03

zitix


2 Answers

Tried to accomplish same task today and searching through magento code managed to complete my task with this code:

$productEntityTypeId = $installer->getEntityTypeId('catalog_product');
$installer->addAttribute($productEntityTypeId, 'some_text', array(
    'group'         => 'General',
    'input'         => 'textarea',
    'type'          => 'text',
    'label'         => 'Some Text',
    'backend'       => '',
    'visible'       => true,
    'required'      => false,
    'visible_on_front' => true,
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
$installer->updateAttribute($productEntityTypeId, 'some_text', 'is_wysiwyg_enabled', 1);
$installer->updateAttribute($productEntityTypeId, 'some_text', 'is_html_allowed_on_front', 1);
like image 60
Taras Avatar answered Sep 21 '22 20:09

Taras


This works:

$installer->updateAttribute('catalog_category', 'certifications', 'is_wysiwyg_enabled', 1);
$installer->updateAttribute('catalog_category', 'certifications', 'is_html_allowed_on_front', 1);
like image 32
3afsus Avatar answered Sep 18 '22 20:09

3afsus