Magento adds an attribute with the ability to filter (without results) through the installation of an extension

I searched quite a lot for this answer and was unable to trace the exact settings I needed. I am contacting you to find out if anyone can help.

I am writing a Magento extension to add some attributes to my installation. Everything is fine, except for one difficulty. I cannot set the attribute "Use in multi-level navigation" property "Filter (without results)".

I can use the values ​​in the attribute array in my installer file (below) to set this property to "No" (value 0) and "Filtering (with results)" (value 1), but not without results.

Does anyone have a property suggestion that I may overlook or set incorrectly in my array?

I really appreciate it!

<?php ... // Add the mm_framestyle attr. (filterable, non-super attr.) $setup->addAttribute('catalog_product', 'mm_framestyle', array( 'backend' => 'eav/entity_attribute_backend_array', 'visible' => true, 'required' => false, 'user_defined' => true, 'searchable' => true, 'filterable' => true, 'comparable' => true, 'label' => 'Frame Types', 'group' => 'MyMaui Attributes', 'type' => 'varchar', 'input' => 'select', 'global' => false, 'option' => array ( 'value' => array('maui_flex' => array('MAUI FLEX'), 'full_frame_metal' => array('FULL FRAME'), 'rimless_metal' => array('RIMLESS'), 'shields' => array('SHIELDS'), ) ), 'visible_on_front' => true, 'unique' => false )); ... ?> 
+4
source share
1 answer

To set the is_filterable property to "Filterable (no results)", your configuration array must have filterable set to 2 .

If you want to use a script update to modify a previously set parameter, the syntax will look like this:

 $setup->updateAttribute('catalog_product', 'mm_framestyle', 'is_filterable', 2); 
+7
source

Source: https://habr.com/ru/post/1383673/


All Articles