concretecms-community-store / community_store

An open, free and community developed eCommerce system for Concrete CMS
https://concretecms-community-store.github.io/community_store/
MIT License
106 stars 66 forks source link

Product Type Filter not working in filter block #759

Closed danread33 closed 1 year ago

danread33 commented 1 year ago

Product type in the product filter block is not filtering products.

I did track this problem down to /packages/community_store/src/CommunityStore/Product/ProductList.php

It looks like it's failing to identify $this->productType as an object

if (is_object($this->productType)) { $query->andWhere("pType = ?")->setParameter($paramcount++, $this->productType->getTypeID()); }

Removing the is_object check and using $this->productType seems to work for the initial product filtering if ($this->productType) { $query->andWhere("pType = ?")->setParameter($paramcount++, $this->productType); }

The filter then breaks if an additional attribute is selected. Seems to be something to do with param count. Rather than using paramcount adding param name fixes this issue as well

if ($this->productType) { $query->andWhere("pType = :pType")->setParameter('pType', $this->productType); }

Mesuva commented 1 year ago

Many thanks for this, it's this kind of feedback that is very useful. I've pushed up a fix for this, will be in the next release.