0

I am newbie in Magento 2, I configured the Magento 2 layered Navigation and did everything to set layered navigation for categories and size and color.

Layered Navigation is working perfect for color but not for categories and size. When i select any size in Magento 2 layered navigation it shows no product but at side it shows number of products in that category.

I think this is Magento 2 bug, because i tried every settings and looked at every overriding file to check if there's any file causing error.

Here is what it seems like enter image description here

enter image description here

For size it is showing only first and last size but not all sizes in siz attributes.

0

I also think that it's a bug. However, you can fix it temporarily. Replace these codes in vendor/magento/module-catalog/Model/ResourceModel/Product/Collection.php:

)->join(                                                                                                                                                                     
    ['cpa' => $attribute->getBackend()->getTable()],                                                                                                                         
    'cpe.' . $aiField . ' = cpa.' . $aiField,                                                                                                                                
    ['store_id', 'value'] 

with these lines:

)->join(                                                                                                                                                                     
    ['cpa' => $attribute->getBackend()->getTable()],                                                                                                                         
    'cpe.' . $aiField . ' = cpa.' . 'row_id' //$aiField,                                                                                                                                
    ['store_id', 'value']
  • This is not working and the code you provided is different in my magento file. i am currently using 2.2.5 Version of magento 2. The code looks like )->join( ['cpa' => $attribute->getBackend()->getTable()], 'cpe.' . $fieldMainTable . ' = cpa.' . $fieldJoinTable, ['store_id', 'value'], I tried you code but didn't worked. – Rakesh Kumar Jan 28 at 18:47
0

Solution to this problem was, I have to set Another attribute, which is already presented in the Magento 2 CAT's setting to filter with result to No. So, that it can display the categories related to category attribute not to Cat attribute which was predefined in the Magento 2. It was somehow linked to each other. When i select category it search for that categories in Cat attribute and that's why got blank result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.