View Single Post
  #8  
Old 11-26-2014, 09:46 AM
 
JannieB JannieB is offline
 

Senior Member
  
Join Date: Sep 2004
Posts: 117
 

Default Re: Product Filters - only show values for products in current category

What I am basically trying to do is run this SQL query for each attribute option ... passing in the
category id (of the page we are on, example = 13)
Attribute_option_id (of the option in question, example = 99)

Code:
SELECT count(xc_category_products.product_id) as productCount FROM xc_category_products LEFT JOIN xc_attribute_values_select ON xc_category_products.product_id = xc_attribute_values_select.product_id WHERE xc_category_products.category_id = '13' AND xc_attribute_values_select.attribute_option_id= '99'

This query would return the number of products in this category for this attribute option (quite a handy thing to have anyway).

I am guessing the best place of the code is as part of the getOptions() function in \XLite\Module\XC\ProductFilter\View\FormField\Sele ct\Attribute.php, but I'm not sure how this will get access to the category id, and also how to build that query in the new x-cart architecture ...

Would really appreciate some help on this Tony if you can spare a few moments ....


Jan
__________________
Jan Beesley
(Currently Xcart 5
Previously XCart Gold from 3.5....)
Reply With Quote