11

私はこのチュートリアルに従っています:http ://www.atwix.com/magento/add-category-attribute/ すべてがうまく機能しており、属性はカテゴリに追加されていますが、フィールドの下にWYSIWYGボタンがありません。WYSIWYGは、[システム]>[構成]>[コンテンツ管理]で有効になっています。

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

何を試しても、WYSIWYGが属性に対して有効になっていません。誰か助けてもらえますか?または、これに対する回避策がありますか?

編集:私は他の投稿を検索しましたが、すべてこのコードはWYSIWYGを追加する必要があると言っています:

'wysiwyg_enabled' => true,

しかし、そうではありません。

4

4 に答える 4

11

今日同じタスクを達成しようとしましたが、magento コードを検索すると、このコードでタスクを完了することができました。

$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);
于 2013-03-14T14:28:51.563 に答える
7

これは機能します:

$installer->updateAttribute('catalog_category', 'certifications', 'is_wysiwyg_enabled', 1);
$installer->updateAttribute('catalog_category', 'certifications', 'is_html_allowed_on_front', 1);
于 2013-07-24T10:25:13.193 に答える
5

これは私のために働いた:

$installer->addAttribute('catalog_category', 'short_description', array(
    'type' => 'varchar',
    'label' => 'Short Description',
    'input' => 'textarea',
    'default' => '',
    'sort_order' => 1,
    'required' => false,
    'wysiwyg_enabled' => true,
    'visible_on_front' => true,
    'is_html_allowed_on_front' => true,
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'group' => 'General Information',
));

次の 3 つのエントリに注意してください。

    'wysiwyg_enabled' => true,
    'visible_on_front' => true,
    'is_html_allowed_on_front' => true,

Magento CE 1.9.2.0 を使用。

于 2015-07-23T08:24:24.753 に答える
1

Magento ルート ディレクトリに php ファイルを作成し、以下のコードを貼り付けて、ブラウザから実行します。

ini_set('display_errors',0);
require_once 'app/Mage.php';
Mage::app();

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');


function createNewAttributeSet($name) {
    Mage::app('default');
    $modelSet = Mage::getModel('eav/entity_attribute_set')
    ->setEntityTypeId(4) // 4 == "catalog/product"
    ->setAttributeSetName($name);
    $modelSet->save();
    $modelSet->initFromSkeleton(4)->save(); // same thing
}

// Replace your attribute name with "extra_info"

$setup->addAttribute('catalog_category', 'extra_info', array(
        'group'             => 'General Information',
        'type'              => 'text',
        'backend'           => '',
        'frontend'          => '',
        'label'             => 'Extra Information',
        'wysiwyg_enabled' => true,
        'visible_on_front' => true,
        'is_html_allowed_on_front' => true,
        'input'             => 'textarea',
        'class'             => '',
        'source'            => 'eav/entity_attribute_source_boolean',
        'global'     => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
        'visible'           => 1,
        'required'          => 0,
        'user_defined'      => 0,
        'default'           => '',
        'searchable'        => 0,
        'filterable'        => 0,
        'comparable'        => 0,
        'visible_on_front'  => 0,
        'unique'            => 0,
        'position'          => 1,
));
$setup->updateAttribute('catalog_category', 'extra_info', 'is_wysiwyg_enabled', 1);
$setup->updateAttribute('catalog_category', 'extra_info', 'is_html_allowed_on_front', 1);
于 2016-08-30T13:38:33.987 に答える