// [+] Blocklayered : Add avaibility to set filter category depth

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13103 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mDeflotte
2012-02-08 09:20:26 +00:00
parent 7ffaa9be49
commit a1a1ea14cc
2 changed files with 17 additions and 1 deletions
+16 -1
View File
@@ -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 .= '
<div class="conf">'.
@@ -1991,6 +1994,12 @@ class BlockLayered extends Module
'.$this->l('No').' <input type="radio" name="ps_layered_full_tree" value="0" '.(!Configuration::get('PS_LAYERED_FULL_TREE') ? 'checked="checked"' : '').' />
</td>
</tr>
<tr style="text-align: center;">
<td style="text-align: right;">'.$this->l('Category filter depth (0 for no limits, 1 by default)').'</td>
<td>
<input type="text" name="ps_layered_filter_category_depth" value="'.((Configuration::get('PS_LAYERED_FILTER_CATEGORY_DEPTH') !== false) ? Configuration::get('PS_LAYERED_FILTER_CATEGORY_DEPTH') : 1).'" />
</td>
</tr>
<tr style="text-align: center;">
<td style="text-align: right;">'.$this->l('Use tax to filter price').'</td>
<td>
@@ -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';
}
+1
View File
@@ -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';