fix search query for attributes in category scroll

This commit is contained in:
Marion Muszynski 2017-08-31 15:19:19 +02:00
parent cee909f10b
commit 75853ae3e1

View File

@ -79,6 +79,14 @@ if($id_category && $p && $id_category > 1) {
foreach($cat_products as $p) {
$id_products[] = $p['id_product'];
}
$sale_group_attributes = array();
foreach(Db::getInstance()->ExecuteS('
SELECT `id_attribute_group`
FROM `'._DB_PREFIX_.'attribute_group_ps`
WHERE `id_sale` = '.(int)$sale->id_sale.'
') as $row){
$sale_group_attributes[] = $row['id_attribute_group'];
}
$attributes = array();
$id_attributes = array();
foreach(Db::getInstance()->ExecuteS('
@ -92,7 +100,7 @@ if($id_category && $p && $id_category > 1) {
AND ag.`id_attribute_group` = a.`id_attribute_group`
AND ag.`id_lang` = '.(int) $cookie->id_lang.'
AND pa.`quantity` > 0
AND ag.`id_attribute_group` IN(75, 9, 272, 172)
AND ag.`id_attribute_group` IN('.implode(',', $sale_group_attributes).')
ORDER BY pa.`id_product` ASC, ag.`public_name` ASC, al.`name` ASC
') as $attr) {
if(!isset($attributes[$attr['id_product']])) {