// Merge -> revision 9221

This commit is contained in:
rMalie
2011-10-11 12:45:12 +00:00
parent b0cc80ad01
commit eeb5b16112
77 changed files with 1987 additions and 815 deletions
+20 -17
View File
@@ -265,7 +265,7 @@ function reloadContent(params_plus)
$('.category-product-count').html(result.categoryCount);
$('#product_list').html(result.productList).html();
$('#product_list').replaceWith(result.productList);
$('#product_list').css('opacity', '1');
$('div#pagination').html(result.pagination);
paginationButton();
@@ -310,35 +310,38 @@ function reloadContent(params_plus)
if (current_friendly_url == '#')
current_friendly_url = '#/';
window.location = current_friendly_url;
lockLocationChecking = true;
}
});
ajaxQueries.push(ajaxQuery);
}
function initLocationChange(func, time) {
function initLocationChange(func, time)
{
if(!time) time = 500;
var currLoc = '';
var current_friendly_url = getUrlParams();
setInterval(function()
{
if(window.location.href != currLoc)
if(getUrlParams() != current_friendly_url && !lockLocationChecking)
{
currLoc = window.location.href;
// Don't reload page if current_friendly_url and real url match
if (window.location.href.split('#').length == 2 && window.location.href.split('#')[1] != '')
current_url = '#'+window.location.href.split('#')[1];
else
current_url = '';
if (current_friendly_url.replace(/^#(\/)?/, '') == current_url.replace(/^#(\/)?/, ''))
if (current_friendly_url.replace(/^#(\/)?/, '') == getUrlParams().replace(/^#(\/)?/, ''))
return;
if (window.location.href.split('#').length == 2 && window.location.href.split('#')[1] != '')
{
var params = window.location.href.split('#')[1];
reloadContent('&selected_filters='+params);
lockLocationChecking = true;
reloadContent('&selected_filters='+getUrlParams().replace(/^#/, ''));
}
else
reloadContent('&selected_filters=#');
else {
lockLocationChecking = false;
current_friendly_url = getUrlParams();
}
}, time);
}
function getUrlParams()
{
var params = current_friendly_url;
if(window.location.href.split('#').length == 2 && window.location.href.split('#')[1] != '')
params = '#'+window.location.href.split('#')[1];
return params;
}
+12 -4
View File
@@ -1002,7 +1002,8 @@ class BlockLayered extends Module
$values = array();
foreach ($currencyList as $currency)
$values[] = '('.(int)$idProduct.', '.(int)$currency['id_currency'].', '.(int)$minPrice[$currency['id_currency']].', '.(int)$maxPrice[$currency['id_currency']].')';
$values[] = '('.(int)$idProduct.', '.(int)$currency['id_currency'].',
'.(int)$minPrice[$currency['id_currency']].', '.(int)($maxPrice[$currency['id_currency']] * (100+$maxTaxRate) / 100).')';
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'layered_price_index` (id_product, id_currency, price_min, price_max)
@@ -1633,12 +1634,19 @@ class BlockLayered extends Module
updElements(0, 0);
},
\'onComplete\': function() {
if($(\'#categories-treeview li#1\').attr(\'cleaned\'))
return;
if($(\'#categories-treeview li#1\').attr(\'cleaned\', true))
$(\'#categories-treeview li#1\').removeClass(\'static\');
$(\'#categories-treeview li#1 span\').trigger(\'click\');
$(\'#categories-treeview li#1\').children(\'div\').remove();
$(\'#categories-treeview li#1\').
removeClass(\'collapsable lastCollapsable\').
addClass(\'last static\');
$(\'.hitarea\').click(function(it)
{
$(this).parent().find(\'> .category_label\').click();
});
}
});
@@ -1935,9 +1943,9 @@ class BlockLayered extends Module
$priceFilterQueryOut = 'INNER JOIN `'._DB_PREFIX_.'layered_price_index` psi
ON
((psi.price_min < '.(int)$priceFilter['min'].' AND psi.price_max > '.(int)$priceFilter['min'].')
((psi.price_min <= '.(int)$priceFilter['min'].' AND psi.price_max >= '.(int)$priceFilter['min'].')
OR
(psi.price_max > '.(int)$priceFilter['max'].' AND psi.price_min < '.(int)$priceFilter['max'].'))
(psi.price_max >= '.(int)$priceFilter['max'].' AND psi.price_min <= '.(int)$priceFilter['max'].'))
AND psi.`id_product` = p.`id_product`
AND psi.`id_currency` = '.(int)$idCurrency;
}
@@ -1964,7 +1972,7 @@ class BlockLayered extends Module
while ($product = DB::getInstance()->nextRow($allProductsOut))
if (isset($priceFilter) && $priceFilter)
{
$price = Product::getPriceStatic($product['id_product']);
$price = (int)Product::getPriceStatic($product['id_product']); // Cast to int because we don't care about cents
if ($price < $priceFilter['min'] || $price > $priceFilter['max'])
continue;
$productIdList[] = (int)$product['id_product'];
+3 -3
View File
@@ -51,7 +51,7 @@ current_friendly_url = '#{$current_friendly_url}';
</li>
{else}
{foreach from=$filter.values key=id_value item=value}
{if $id_value == $filter_key && !is_numeric($filter_value) && ($filter.type eq 'id_attribute_group' || $filter.type eq 'id_feature') || $id_value == $filter_value && $filter.type neq 'id_attribute_group'}
{if $id_value == $filter_key && !is_numeric($filter_value) && ($filter.type eq 'id_attribute_group' || $filter.type eq 'id_feature') || $id_value == $filter_value && $filter.type neq 'id_attribute_group' && $filter.type neq 'id_feature'}
<li>
<a href="#" rel="layered_{$filter.type_lite}_{$id_value}" title="{l s='Cancel' mod='blocklayered'}">x</a>
{$filter.name|escape:html:'UTF-8'}{l s=':'} {$value.name|escape:html:'UTF-8'}
@@ -88,9 +88,9 @@ current_friendly_url = '#{$current_friendly_url}';
{/if}
<label for="layered_{$filter.type_lite}_{$id_value}"{if !$value.nbr} class="disabled"{else}{if isset($filter.is_color_group) && $filter.is_color_group} name="layered_{$filter.type_lite}_{$id_value}" class="layered_color" rel="{$id_value}_{$filter.id_key}"{/if}{/if}>
{if !$value.nbr}
{$value.name|escape:html:'UTF-8'}{if $layered_show_qties}<span> (0)</span></a>{/if}
{$value.name|escape:html:'UTF-8'}{if $layered_show_qties}<span> (0)</span>{/if}</a>
{else}
<a href="{$value.link}" rel="{$value.rel}">{$value.name|escape:html:'UTF-8'}{if $layered_show_qties}<span> ({$value.nbr})</span></a>{/if}</label>
<a href="{$value.link}" rel="{$value.rel}">{$value.name|escape:html:'UTF-8'}{if $layered_show_qties}<span> ({$value.nbr})</span>{/if}</a></label>
{/if}
</li>
{/foreach}