[-] FO : some categories should not appear in some stores #PSCFV-4020
This commit is contained in:
@@ -156,8 +156,6 @@ class BlockCategories extends Module
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
{
|
||||
$id_current_shop = $this->context->shop->id;
|
||||
|
||||
$id_customer = (int)$params['cookie']->id_customer;
|
||||
// Get all groups for this customer and concatenate them as a string: "1,2,3..."
|
||||
// It is necessary to keep the group query separate from the main select query because it is used for the cache
|
||||
@@ -165,7 +163,7 @@ class BlockCategories extends Module
|
||||
$id_product = (int)Tools::getValue('id_product', 0);
|
||||
$id_category = (int)Tools::getValue('id_category', 0);
|
||||
$id_lang = (int)$params['cookie']->id_lang;
|
||||
$smartyCacheId = 'blockcategories|'.$id_current_shop.'_'.$groups.'_'.$id_lang.'_'.$id_product.'_'.$id_category;
|
||||
$smartyCacheId = 'blockcategories|'.$this->context->shop->id.'_'.$groups.'_'.$id_lang.'_'.$id_product.'_'.$id_category;
|
||||
$this->context->smarty->cache_lifetime = 31536000; // 1 Year
|
||||
Tools::enableCache();
|
||||
if (!$this->isCached('blockcategories.tpl', $smartyCacheId))
|
||||
@@ -174,11 +172,11 @@ class BlockCategories extends Module
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.Shop::addSqlRestrictionOnLang('cl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (cs.`id_category` = c.`id_category` AND cs.`id_shop` = '.(int)Context::getContext()->shop->id.')
|
||||
INNER JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.Shop::addSqlRestrictionOnLang('cl').')
|
||||
INNER JOIN `'._DB_PREFIX_.'category_shop` cs ON (cs.`id_category` = c.`id_category` AND cs.`id_shop` = '.(int)$this->context->shop->id.')
|
||||
WHERE (c.`active` = 1 OR c.`id_category` = '.(int)Configuration::get('PS_HOME_CATEGORY').')
|
||||
AND c.`id_category` != '.(int)Configuration::get('PS_ROOT_CATEGORY').'
|
||||
'.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)$maxdepth : '').'
|
||||
'.((int)$maxdepth != 0 ? ' AND `level_depth` <= '.(int)$maxdepth : '').'
|
||||
AND c.id_category IN (SELECT id_category FROM `'._DB_PREFIX_.'category_group` WHERE `id_group` IN ('.pSQL($groups).'))
|
||||
ORDER BY `level_depth` ASC, '.(Configuration::get('BLOCK_CATEG_SORT') ? 'cl.`name`' : 'cs.`position`').' '.(Configuration::get('BLOCK_CATEG_SORT_WAY') ? 'DESC' : 'ASC')))
|
||||
return Tools::restoreCacheSettings();
|
||||
@@ -228,15 +226,13 @@ class BlockCategories extends Module
|
||||
|
||||
public function hookFooter($params)
|
||||
{
|
||||
$id_current_shop = $this->context->shop->id;
|
||||
|
||||
$id_customer = (int)($params['cookie']->id_customer);
|
||||
// Get all groups for this customer and concatenate them as a string: "1,2,3..."
|
||||
$groups = $id_customer ? implode(', ', Customer::getGroupsStatic($id_customer)) : _PS_DEFAULT_CUSTOMER_GROUP_;
|
||||
$id_product = (int)(Tools::getValue('id_product', 0));
|
||||
$id_category = (int)(Tools::getValue('id_category', 0));
|
||||
$id_lang = (int)($params['cookie']->id_lang);
|
||||
$smartyCacheId = 'blockcategories|'.$id_current_shop.'_'.$groups.'_'.$id_lang.'_'.$id_product.'_'.$id_category;
|
||||
$smartyCacheId = 'blockcategories|'.$this->context->shop->id.'_'.$groups.'_'.$id_lang.'_'.$id_product.'_'.$id_category;
|
||||
$this->context->smarty->cache_lifetime = 31536000; // 1 Year
|
||||
Tools::enableCache();
|
||||
if (!$this->isCached('blockcategories_footer.tpl', $smartyCacheId))
|
||||
|
||||
Reference in New Issue
Block a user