cancel
Showing results for 
Search instead for 
Did you mean: 

Problems While Creating Product Attribute With InstallData

Problems While Creating Product Attribute With InstallData

I've created InstallData for creating product attribute with default options to be set yes like,

used_in_product_listing and is_used_for_promo_rules

Probelm is only used_in_product_listing is setting up to Yes while execute InstallData not for Promo Code Rule.

 

$eavSetup->addAttribute(
        \Magento\Catalog\Model\Product::ENTITY, 'brands', [
            'type' => 'text',
            'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend',
            'frontend' => '',
            'label' => 'Brands',
            'input' => 'select',
            'group' => 'General',
            'class' => 'brands',
            'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
            'visible' =>    true,
            'required' => false,
            'user_defined' => true,
            'default' => '1',
            'searchable' => false,
            'filterable' => false,
            'comparable' => false,
            'visible_on_front' => false,
            'is_used_for_promo_rules' => true,
            'used_in_product_listing' => true,
            'unique' => false
                ]
    );

Any Ideas ?