Hi there,

I've been looking for a way of filtering products by attributes, i found this rather promising looking addon: http://www.zen-cart.com/index.php?ma...roducts_id=760

However, there is a SQL statement that doesn't quite work and was wondering if someone could take a look.

The SQL being generated is as follow:

Code:
 [ SELECT count( DISTINCT p.products_id ) AS total
FROM zen_products p, zen_products_description pd, zen_products_to_categories p2c, zen_products_attributes pa, zen_products_options po, zen_products_options_values pov
WHERE (
p.products_status =1
AND (
(
pa.products_id
IN (

SELECT pa.products_id
FROM zen_products_attributes pa
WHERE (
pa.options_id =2
AND pa.options_values_id =5
)
)
)
)
AND p.products_id = pa.products_id
AND p2c.categories_id =111
AND p.products_quantity > 0
AND p.products_id = pd.products_id AND pd.language_id =1 AND p.products_id = p2c.products_id
)] LIMIT 0 , 30
Now when you run that you get a:

Code:
1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT pa.products_id FROM zen_products_attributes pa WHERE ( p
in:
I've been trying for hours to try and fix it but no avail.

I've nailed it down to the AND IN statement, if you remove that, it works fine but you can't filter by the attribute options

Any solutions?

Thank you.