Get filters directly from Products, not categories for OC 1.5.5.1
1.1
2.1
Olimax from code by robertiulianstoica
db->query("SELECT filter_id FROM " . DB_PREFIX . "category_filter WHERE category_id = '" . (int)$category_id . "'");]]>
getCategories((int)$category_id) ;
$implodecats = array();
$implodecats[] = (int)$category_id;
foreach ($cats as $catt)
{
$implodecats[] = (int)$catt['category_id'];
}
//to get filers only from products within given cat
//$query = $this->db->query("SELECT pf.filter_id FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p.product_id = pf.product_id) WHERE p2c.category_id = '" . (int)$category_id . "' AND p.status='1'");
//to get filters from products within given cat and subcats
$query = $this->db->query("SELECT pf.filter_id FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p.product_id = pf.product_id) WHERE p2c.category_id IN (" . implode(',', $implodecats) . ") AND p.status='1'");
]]>
]]>