Thats one my attributes that should be visible in layered navigation:
$eavSetup->removeAttribute(Product::ENTITY, 'supported_software');
$eavSetup->addAttribute(
Product::ENTITY,
'supported_software',
[
'type' => 'text',
'input' => 'multiselect',
'frontend_class' => 'required-entry',
'label' => 'Supported software',
'group' => 'Technical parameters',
'sort_order' => 190,
'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend',
'frontend' => '',
'source' => '[vendor]\DbSchema\Model\SupportedSoftware\Adminhtml\Source\SupportedSoftware',
'default' => 10,
'is_wysiwyg_enabled' => false,
'is_html_allowed_on_front' => false,
'used_for_sort_by' => false,
'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => true,
'searchable' => false,
'visible_in_advanced_search' => false,
'search_weight' => '',
'filterable' => true,
'filterable_in_search' => true,
'comparable' => true,
'visible_on_front' => true,
'used_in_product_listing' => true,
'unique' => false,
'apply_to' => 'downloadable,bundle',
'is_used_for_promo_rules' => true,
'is_used_in_grid' => false,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => false,
'is_required_in_admin_store' => '',
'system' => 0,
]
);
Moreover this attribute has digit values for admin store and varchar values for frontend (default store view). But I don't think it is the problem here.
Layered navigation appears on frontend properly. I have in db about 40 products added programatically (tests) and all of them should have some values of this attribute (I am adding these values for admin - but for frontend are being added simultanously). Sometimes my attributes shows up in layered navigation but sometimes not. If I add product from adminhtml manually values its values appears in layered navigation, but they erase former values. For example - if I have 10 product with values x
and 10 with values y
and I add product with value z
in layered navigation after reindex/cache flush only appears results for only one product with value z
.
All of my categories are anchored.
EDIT: Some attributes - escpecially the ones which have source model Yes/No
in fact appear in lay nav in correct way and also react on changes of values of attributes properly.
EDIT: The same attribute if I added source model instead of options still doesn't appear in lay nav.