[-] MO : BlockLayered - FixBug #PNM-1331 Categories now filtered by groups
This commit is contained in:
@@ -2190,7 +2190,10 @@ class BlockLayered extends Module
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'category':
|
||||
$this->user_groups = ($this->context->customer->isLogged() ? $this->context->customer->getGroups() : array(Configuration::get('PS_UNIDENTIFIED_GROUP')));
|
||||
|
||||
$depth = Configuration::get('PS_LAYERED_FILTER_CATEGORY_DEPTH');
|
||||
if ($depth === false)
|
||||
$depth = 1;
|
||||
@@ -2206,9 +2209,11 @@ class BlockLayered extends Module
|
||||
$sql_query['group'] = ') count_products
|
||||
FROM '._DB_PREFIX_.'category c
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category AND cl.`id_shop` = '.(int)Context::getContext()->shop->id.' and cl.id_lang = '.$id_lang.')
|
||||
RIGHT JOIN '._DB_PREFIX_.'category_group cg ON (cg.id_category = c.id_category AND cg.`id_group` IN ('.implode(', ', $this->user_groups).'))
|
||||
WHERE c.nleft > '.(int)$parent->nleft.'
|
||||
AND c.nright < '.(int)$parent->nright.'
|
||||
'.($depth ? 'AND c.level_depth <= '.($parent->level_depth+(int)$depth) : '').'
|
||||
AND c.active = 1
|
||||
GROUP BY c.id_category ORDER BY c.nleft, c.position';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user