Easy way to fix issue of multiple filters not working in Category page of OpenCart

Today, I came across an issue of multiple filters not working in category page of PHP shopping cart OpenCart. I had two filter groups Gender and Color. If I chose Female in Gender and Red in Color Filter, it used to display the products of other Colors too. If you happen to come across similar error here is an easy way to fix the issue of multiple filters not working in Category page of OpenCart.

To solve the issue you need to add a few query in the category.php file located at “catalog\controller\product” as shown in the screenshot below:

Before Solution

before-solution
before solution

After Solution

after solution
after solution

Just add below code as highlighted above
if (!empty($data[‘filter_filter’])) {
$additionalFilter = count($implode);
$sql .= ” HAVING COUNT(*) = ” . $additionalFilter . “”;
}

Let me know if it fixes for you or not.

Leave a Reply

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