$sql = "SELECT id, articul, category_id, brand_id, title, alias, content, price, old_price, status, keywords, description, img, hit, novinki
FROM product
WHERE status = '1' AND category_id IN ($ids)
AND price > {$_GET['priceMin']} AND price < {$_GET['priceMax']}
GROUP BY product_id
HAVING COUNT(product_id) = {$cnt}
LIMIT {$start}, {$perpage}";
SELECT id, articul, category_id, brand_id, title, alias, content, price, old_price, status, keywords, description, img, hit, novinki FROM product WHERE status = '1' AND category_id IN (78,79,80,81,82,83,84,85,64) AND price > :min AND price < :max AND id IN (SELECT product_id FROM attribute_product WHERE attr_id IN () GROUP BY product_id HAVING COUNT(product_id) = :cnt) LIMIT :start, :perpage
if(!empty($filter)) {
$sql = "SELECT id, articul, category_id, brand_id, title, alias, content, price, old_price, status, keywords, description, img, hit, novinki
FROM product
WHERE status = '1' AND category_id IN ($ids)
AND price > :min AND price < :max
GROUP BY product_id
HAVING COUNT(product_id) = :cnt)
LIMIT :start, :perpage";
}
else {
$sql = "SELECT id, articul, category_id, brand_id, title, alias, content, price, old_price, status, keywords, description, img, hit, novinki
FROM product
WHERE status = '1' AND category_id IN ($ids)
AND price > :min AND price < :max
AND id IN (SELECT product_id FROM attribute_product WHERE attr_id IN ($filter)
GROUP BY product_id
HAVING COUNT(product_id) = :cnt)
LIMIT :start, :perpage";
}