インストーラスクリプトからマルチセレクトカテゴリ属性を作成しようとしています。属性が作成されます。しかし、Magento 2 - Manage Categoryページでオプション値に問題が表示されています。空白のテキストエリアのみを表示します。私は、このインストーラスクリプトの下に使用して作成したMagento2 - 管理者のマルチアイテムカテゴリ属性オプションの表示に問題がある
:データベースで
/** @var EavSetup $eavSetup */
$eavSetup = $this->_eavSetupFactory->create(['setup' => $setup]);
/**
* Add attributes to the eav/attribute for Category
*/
$eavSetup->addAttribute(
\Magento\Catalog\Model\Category::ENTITY,
'class',
[
'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend',
'type' => 'varchar',
'label' => 'Class',
'group' => 'General Information',
'input' => 'multiselect',
'source' => '',
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => true,
'sort_order' => 100,
'option' => [
'value' => [
'SET' => ['SET'],
'HE' => ['HE'],
'HBR' => ['HBR'],
]
],
]
);
を、私は属性もありEAVテーブルとオプションと値で作成されていることがわかります。
これを修正するために、xml(.. \ view \ adminhtml \ ui_component \ category_form.xml)以下のカスタムモジュールにxmlを追加しました。
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="content">
<field name="class">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="formElement" xsi:type="string">multiselect</item>
<item name="sortOrder" xsi:type="number">70</item>
<item name="label" xsi:type="string" translate="true">Select Class</item>
</item>
</argument>
</field>
</fieldset>
</form>
しかし、まだ管理カテゴリページでオプション値に問題を取得。 Textareaにはオプションはありません。私はキャッシュしようとしました:フラッシュ、静的コンテンツ:配備、セットアップ:アップグレード、インデクサー:再インデックスはまだ問題があります。私はMagento2.1.1 CEを使用しています。私は何かする必要がありますか? あなたはこのコードで
option
キーであなたのアレイ構成を修正する必要があるおかげで
お返事ありがとうございました。しかし、問題は管理カテゴリパネル内の属性オプションを取得することです。これはやはり解決されません。 –