Filter simple products by price
-
16-10-2019 - |
Question
In my project, I have a requirement where I need to filter simple products based on price.
In default Magento, the filtering of price is based on configurable products.
Some important points related to my project are:
- The simple products in are associated with the configurable products.
- Each configurable product has three types of simple products associated with it.
For example, if the configurable product is A
, then the associated simple products are A1
, A2
and A3
.
PS: After failing to hold the grip even after digging deeper in Magento core files, I am asking here.
Please give some clear suggestions.
Solution
I was associating the simple products
with configurable products
using a user defined dropdown attribute, p_type
, which holds three unique numbers which are identification to the associated simple products
.
While filtering through price, I observed that the url is having a query string as ?price=3000-4999
. I just added the p_type
attribute to that query string to filter according to the simple products instead of configurable products.
For example,
http://mywebsite.com/categoryName/?price=3000-4999&p_type=126
This worked for me :)
and also in my case, the simple products were set as invisible as single product
. So, I did some other changes too.