Multiselect attributes with custom source models in layered navigation

Hello there!

Spoiler:
You can’t use a custom multiselect attribute with custom source model in layered navigation.
You can use either a dropdown attribute with custom source model or a multiselect without custom source model, but you CAN’T use a multiselect with custom source model.
Solution is here >>

Yesterday I found an interesting bug in Magento.
I have been working with this system for the last 4 or 5 years so far, but yesterday was the time I’ve observed this bug.
Of course, you know about layered navigation, custom attributes, and source model.


If not, please read and get to know.

 

So, you can create a custom attribute and use a custom source model for it. You can set a frontend input for this multiselect attribute and include the attribute to the layered navigation (frontend type should be varchar).

 

In the layered navigation, you can use only select (dropdown) with a custom source attribute or/and multiselect attributes with options editable in admin.
Where is the problem:
Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source::_prepareMultiselectIndex

 

magento_eav
Magento selects options only from the table eav_attriobute_option. We should add our options from the custom source model to array $options.
In that case, your options (from the custom source model) have no chance to get to the index table.

 

Solution:
You have to override the resource model catalog_resource/product_indexer_eav_source and add options from the needed custom source model to the array $options.
You can download our extension to solve this problem.

https://github.com/k2service/magento-patch

3 thoughts on “Multiselect attributes with custom source models in layered navigation”

    1. Hey Rick. Did you manage to find a workaround for M2 for this issue? Could you please share it if so? Thanks! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.