2016-08-25 9 views
0

に表示されない属性以下は私が属性を作成するために使用しているコードです。カスタム製品は、私は、Magentoの2.1でカスタム製品の属性を追加し、その製品は、属性セクションに表示されているが、我々は製品</p> <p>を作成しましたMagentoのカタログセクションに表示することができなかった管理者カタログセクションMagentoの2.1

$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); 

    /** 
    * Add attributes to the eav/attribute 
    */ 

    $eavSetup->addAttribute(
     \Magento\Catalog\Model\Product::ENTITY, 
     'test_author', 
     [ 
      'type' => 'int', 
      'backend' => '', 
      'frontend' => '', 
      'label' => 'Test Author', 
      'input' => '', 
      'class' => '', 
      'source' => '', 
      'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, 
      'visible' => true, 
      'required' => false, 
      'user_defined' => false, 
      'default' => 0, 
      'searchable' => true, 
      'filterable' => true, 
      'comparable' => false, 
      'visible_on_front' => true, 
      'used_in_product_listing' => true, 
      'unique' => false, 
      'apply_to' => '' 
     ] 
    ); 

enter image description here

+0

を、カタログ形式セクションでカスタム属性を表示するui_componentを追加する必要があります –

答えて

0

あなたは以下のコード試すことができます - Magentoの2.1では

/** @var EavSetup $eavSetup */ 
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); 
/** 
* Add attributes to the eav/attribute 
*/ 
$eavSetup->addAttribute(
\Magento\Catalog\Model\Product::ENTITY, 
'test_author', 
[ 
'group' => 'General', 
'type' => 'int', 
'backend' => '', 
'frontend' => '', 
'label' => 'Test Author', 
'input' => 'textarea', 
'class' => '', 
'source' => '', 
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE, 
'visible' => true, 
'required' => false, 
'user_defined' => true, 
'default' => '', 
'searchable' => false, 
'filterable' => false, 
'comparable' => false, 
'visible_on_front' => false, 
'used_in_product_listing' => true, 
'unique' => false, 
'apply_to' => 'simple,configurable,virtual,bundle,downloadable' 
] 
); 
関連する問題