diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php
index 49fa1b45d..c6b3e8f11 100644
--- a/modules/blocklayered/blocklayered.php
+++ b/modules/blocklayered/blocklayered.php
@@ -67,6 +67,7 @@ class BlockLayered extends Module
Configuration::updateValue('PS_LAYERED_SHOW_QTIES', 1);
Configuration::updateValue('PS_LAYERED_FULL_TREE', 1);
Configuration::updateValue('PS_LAYERED_FILTER_PRICE_USETAX', 1);
+ Configuration::updateValue('PS_LAYERED_FILTER_CATEGORY_DEPTH', 1);
$this->rebuildLayeredStructure();
$this->rebuildLayeredCache();
@@ -99,6 +100,7 @@ class BlockLayered extends Module
Configuration::deleteByName('PS_LAYERED_FULL_TREE');
Configuration::deleteByName('PS_LAYERED_INDEXED');
Configuration::deleteByName('PS_LAYERED_FILTER_PRICE_USETAX');
+ Configuration::deleteByName('PS_LAYERED_FILTER_CATEGORY_DEPTH');
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_price_index');
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_friendly_url');
@@ -1365,6 +1367,7 @@ class BlockLayered extends Module
Configuration::updateValue('PS_LAYERED_SHOW_QTIES', Tools::getValue('ps_layered_show_qties'));
Configuration::updateValue('PS_LAYERED_FULL_TREE', Tools::getValue('ps_layered_full_tree'));
Configuration::updateValue('PS_LAYERED_FILTER_PRICE_USETAX', Tools::getValue('ps_layered_filter_price_usetax'));
+ Configuration::updateValue('PS_LAYERED_FILTER_CATEGORY_DEPTH', (int)Tools::getValue('ps_layered_filter_category_depth'));
$html .= '
'.
@@ -1991,6 +1994,12 @@ class BlockLayered extends Module
'.$this->l('No').'
+
+ | '.$this->l('Category filter depth (0 for no limits, 1 by default)').' |
+
+
+ |
+
| '.$this->l('Use tax to filter price').' |
@@ -2479,6 +2488,10 @@ class BlockLayered extends Module
break;
case 'category':
+ $depth = Configuration::get('PS_LAYERED_FILTER_CATEGORY_DEPTH');
+ if ($depth === false)
+ $depth = 1;
+
$sqlQuery['select'] = '
SELECT c.id_category, c.id_parent, cl.name, (SELECT count(DISTINCT p.id_product) # ';
$sqlQuery['from'] = '
@@ -2489,7 +2502,9 @@ class BlockLayered extends Module
$sqlQuery['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_lang = '.(int)$cookie->id_lang.')
- WHERE c.id_parent = '.(int)$id_parent.'
+ WHERE c.nleft > '.(int)$parent->nleft.'
+ AND c.nright < '.(int)$parent->nright.'
+ '.($depth ? 'AND c.level_depth <= '.($parent->level_depth+(int)$depth) : '').'
GROUP BY c.id_category ORDER BY level_depth, c.position';
}
diff --git a/modules/blocklayered/fr.php b/modules/blocklayered/fr.php
index 03cd78764..d0436bece 100644
--- a/modules/blocklayered/fr.php
+++ b/modules/blocklayered/fr.php
@@ -89,6 +89,7 @@ $_MODULE['<{blocklayered}prestashop>blocklayered_93cba07454f06a4a960172bbd6e2a43
$_MODULE['<{blocklayered}prestashop>blocklayered_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Non';
$_MODULE['<{blocklayered}prestashop>blocklayered_8531c73de81b9ed94322dda7cf947daa'] = 'Afficher le nombre de produits qui correspondent';
$_MODULE['<{blocklayered}prestashop>blocklayered_ee61c015043c79c1370fc14980dd27b9'] = 'Montrez les produits des sous-catégories';
+$_MODULE['<{blocklayered}prestashop>blocklayered_a19399fa42f1ab059401a14b9f13eba1'] = 'Profondeur du filtre catégorie (0 pour aucune limite, 1 par défaut)';
$_MODULE['<{blocklayered}prestashop>blocklayered_3e652bd299bb3ee3d458c0dcc7fd706e'] = 'Utiliser les taxes dans le filtre prix';
$_MODULE['<{blocklayered}prestashop>blocklayered_cf565402d32b79d33f626252949a6941'] = 'Configuration enregistré';
$_MODULE['<{blocklayered}prestashop>blocklayered_3601146c4e948c32b6424d2c0a7f0118'] = 'Prix';
|