// Merge -> revision 9288
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registred Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<div id="product_list" class="clear">
|
||||
<p class="warning">{l s='There are no products.'}</p>
|
||||
</div>
|
||||
@@ -18,7 +18,7 @@ if (!Tools::getValue('ajax'))
|
||||
}
|
||||
|
||||
// Return a content without waiting the end of index execution
|
||||
header('Location: '.Tools::getProtocol().Tools::getHttpHost().'/modules/blocklayered/blocklayered-price-indexer.php?token='.Tools::getValue('token') .'&return_message='.(int)Tools::getValue('cursor'));
|
||||
header('Location: '.Tools::getProtocol().Tools::getHttpHost().__PS_BASE_URI__.'modules/blocklayered/blocklayered-price-indexer.php?token='.Tools::getValue('token') .'&return_message='.(int)Tools::getValue('cursor'));
|
||||
flush();
|
||||
}
|
||||
if(Tools::getValue('full'))
|
||||
|
||||
@@ -73,3 +73,6 @@
|
||||
#layered_block_left ul li .disabled {
|
||||
color: #666;
|
||||
}
|
||||
#product_list .warning {
|
||||
margin-top: 13px;
|
||||
}
|
||||
@@ -242,8 +242,12 @@ function reloadContent(params_plus)
|
||||
data += '&orderby='+splitData[0]+'&orderway='+splitData[1];
|
||||
}
|
||||
|
||||
var slideUp = true;
|
||||
if(params_plus == undefined)
|
||||
{
|
||||
params_plus = '';
|
||||
slideUp = false;
|
||||
}
|
||||
|
||||
// Get nb items per page
|
||||
var n = '';
|
||||
@@ -311,6 +315,9 @@ function reloadContent(params_plus)
|
||||
current_friendly_url = '#/';
|
||||
window.location = current_friendly_url;
|
||||
lockLocationChecking = true;
|
||||
|
||||
if(slideUp)
|
||||
$.scrollTo('#product_list', 400);
|
||||
}
|
||||
});
|
||||
ajaxQueries.push(ajaxQuery);
|
||||
|
||||
@@ -858,7 +858,7 @@ class BlockLayered extends Module
|
||||
if (($nbProducts > 0 && !$full || $cursor < $nbProducts && $full) && !$ajax)
|
||||
{
|
||||
$token = substr(Tools::encrypt('blocklayered/index'), 0, 10);
|
||||
if (!Tools::file_get_contents(Tools::getProtocol().Tools::getHttpHost().'/modules/blocklayered/blocklayered-price-indexer.php?token='.$token.'&cursor='.(int)$cursor.'&full='.(int)$full))
|
||||
if (!Tools::file_get_contents(Tools::getProtocol().Tools::getHttpHost().__PS_BASE_URI__.'modules/blocklayered/blocklayered-price-indexer.php?token='.$token.'&cursor='.(int)$cursor.'&full='.(int)$full))
|
||||
self::indexPrices((int)$cursor, (int)$full);
|
||||
return $cursor;
|
||||
}
|
||||
@@ -1025,6 +1025,11 @@ class BlockLayered extends Module
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
|
||||
// No filters => module disable
|
||||
if ($filterBlock = $this->getFilterBlock($this->getSelectedFilters()))
|
||||
if ($filterBlock['nbr_filterBlocks'] == 0)
|
||||
return false;
|
||||
|
||||
if (Tools::getValue('id_category', Tools::getValue('id_category_layered', 1)) == 1)
|
||||
return;
|
||||
|
||||
@@ -1034,7 +1039,6 @@ class BlockLayered extends Module
|
||||
$categoryTitle = (empty($category->meta_title[$idLang])?$category->name[$idLang]:$category->meta_title[$idLang]);
|
||||
|
||||
// Generate meta title and meta description
|
||||
$filterBlock = self::getFilterBlock($this->getSelectedFilters());
|
||||
$title = '';
|
||||
if (is_array($filterBlock['title_values']))
|
||||
foreach ($filterBlock['title_values'] as $key => $val)
|
||||
@@ -1056,6 +1060,7 @@ class BlockLayered extends Module
|
||||
$this->context->controller->addJs($this->_path.'blocklayered.js');
|
||||
$this->context->controller->addJqueryUI('ui.slider');
|
||||
$this->context->controller->addCSS($this->_path.'blocklayered.css', 'all');
|
||||
Tools::addJS(_PS_JS_DIR_.'jquery/jquery.scrollTo-1.4.2-min.js');
|
||||
}
|
||||
|
||||
public function hookFooter($params)
|
||||
@@ -2090,13 +2095,15 @@ class BlockLayered extends Module
|
||||
INNER JOIN '._DB_PREFIX_.'attribute_group_lang agl
|
||||
ON agl.id_attribute_group = lpa.id_attribute_group
|
||||
AND agl.id_lang = '.(int)$cookie->id_lang.'
|
||||
LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = p.id_product)
|
||||
INNER JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category AND c.nleft >= '.(int)$parent->nleft.' AND c.nright <= '.(int)$parent->nright.')
|
||||
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value liagl
|
||||
ON (liagl.id_attribute_group = lpa.id_attribute_group AND liagl.id_lang = '.(int)$cookie->id_lang.')
|
||||
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_lang_value lial
|
||||
ON (lial.id_attribute = lpa.id_attribute AND lial.id_lang = '.(int)$cookie->id_lang.') ';
|
||||
$sqlQuery['where'] = 'WHERE a.id_attribute_group = '.(int)$filter['id_value'].' ';
|
||||
$sqlQuery['where'] = 'WHERE a.id_attribute_group = '.(int)$filter['id_value'].'
|
||||
AND p.id_product IN (
|
||||
SELECT id_product
|
||||
FROM '._DB_PREFIX_.'category_product cp
|
||||
INNER JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category AND c.nleft >= '.(int)$parent->nleft.' AND c.nright <= '.(int)$parent->nright.')) ';
|
||||
$sqlQuery['group'] = '
|
||||
GROUP BY lpa.id_attribute
|
||||
ORDER BY id_attribute_group, id_attribute';
|
||||
@@ -2143,10 +2150,16 @@ class BlockLayered extends Module
|
||||
if (method_exists('BlockLayered', $methodName) &&
|
||||
(!in_array($filter['type'], array('price', 'weight')) && $filter['type'] != $filterTmp['type'] || $filter['type'] == $filterTmp['type']))
|
||||
{
|
||||
if ($filter['type'] == $filterTmp['type'])
|
||||
$subQueryFilter = self::$methodName(array(), $filter['type'] == $filterTmp['type']);
|
||||
if ($filter['type'] == $filterTmp['type'] && $filter['id_value'] == $filterTmp['id_value'])
|
||||
$subQueryFilter = self::$methodName(array(), true);
|
||||
else
|
||||
$subQueryFilter = self::$methodName(@$selectedFilters[$filterTmp['type']], $filter['type'] == $filterTmp['type']);
|
||||
{
|
||||
if (!is_null($filterTmp['id_value']))
|
||||
$selected_filters_cleaned = $this->cleanFilterByIdValue(@$selectedFilters[$filterTmp['type']], $filterTmp['id_value']);
|
||||
else
|
||||
$selected_filters_cleaned = @$selectedFilters[$filterTmp['type']];
|
||||
$subQueryFilter = self::$methodName($selected_filters_cleaned, $filter['type'] == $filterTmp['type']);
|
||||
}
|
||||
foreach ($subQueryFilter as $key => $value)
|
||||
$sqlQuery[$key] .= $value;
|
||||
}
|
||||
@@ -2471,12 +2484,29 @@ class BlockLayered extends Module
|
||||
return $cache;
|
||||
}
|
||||
|
||||
public function cleanFilterByIdValue($attributes, $id_value)
|
||||
{
|
||||
$selected_filters = array();
|
||||
if (is_array($attributes))
|
||||
foreach ($attributes as $attribute)
|
||||
{
|
||||
$attribute_data = explode('_', $attribute);
|
||||
if ($attribute_data[0] == $id_value)
|
||||
$selected_filters[] = $attribute_data[1];
|
||||
}
|
||||
return $selected_filters;
|
||||
}
|
||||
|
||||
public function generateFiltersBlock($selectedFilters)
|
||||
{
|
||||
global $smarty;
|
||||
if($filterBlock = $this->getFilterBlock($selectedFilters))
|
||||
{
|
||||
$smarty->assign($this->getFilterBlock($selectedFilters));
|
||||
if ($filterBlock['nbr_filterBlocks'] == 0)
|
||||
return false;
|
||||
|
||||
$smarty->assign($filterBlock);
|
||||
|
||||
return $this->display(__FILE__, 'blocklayered.tpl');
|
||||
}
|
||||
else
|
||||
@@ -2795,10 +2825,15 @@ class BlockLayered extends Module
|
||||
else
|
||||
$categoryCount = '';
|
||||
|
||||
if ($nbProducts == 0)
|
||||
$product_list_tpl = 'blocklayered-no-products.tpl';
|
||||
else
|
||||
$product_list_tpl = _PS_THEME_DIR_.'product-list.tpl';
|
||||
|
||||
/* We are sending an array in jSon to the .js controller, it will update both the filters and the products zones */
|
||||
return Tools::jsonEncode(array(
|
||||
'filtersBlock' => $this->generateFiltersBlock($selectedFilters),
|
||||
'productList' => $smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'),
|
||||
'productList' => $smarty->fetch($product_list_tpl),
|
||||
'pagination' => $smarty->fetch(_PS_THEME_DIR_.'pagination.tpl'),
|
||||
'categoryCount' => $categoryCount));
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{blocklayered}prestashop>blocklayered-no-products_5c9838becf9bbce28ba90a7426daf171'] = 'Il n\'y a pas de produits.';
|
||||
$_MODULE['<{blocklayered}prestashop>blocklayered_84241e458cdd5162745500a59a3680f3'] = 'Bloc navigation à facettes';
|
||||
$_MODULE['<{blocklayered}prestashop>blocklayered_2d08fa8e157fe3f1875402cbd98aee1b'] = 'Affiche un bloc avec les filtres de la navigation à facettes';
|
||||
$_MODULE['<{blocklayered}prestashop>blocklayered_af1b98adf7f686b84cd0b443e022b7a0'] = 'Catégories';
|
||||
|
||||
Reference in New Issue
Block a user