[*] FO : combination link from product page are now the same as the combination link from blocklayered

// Cart is now accepting the combination link
This commit is contained in:
vChabot
2011-11-10 10:45:19 +00:00
parent 4846333250
commit 95cde12b84
10 changed files with 261 additions and 45 deletions
+10
View File
@@ -88,6 +88,7 @@ function initLayered()
{
initSliders();
initLocationChange();
updateProductUrl();
if (window.location.href.split('#').length == 2 && window.location.href.split('#')[1] != '')
{
var params = window.location.href.split('#')[1];
@@ -318,6 +319,7 @@ function reloadContent(params_plus)
if(slideUp)
$.scrollTo('#product_list', 400);
updateProductUrl();
}
});
ajaxQueries.push(ajaxQuery);
@@ -352,3 +354,11 @@ function getUrlParams()
params = '#'+window.location.href.split('#')[1];
return params;
}
function updateProductUrl()
{
// Adding the filters to URL product
$('ul#product_list li.ajax_block_product .product_img_link').attr('href', $('ul#product_list li.ajax_block_product .product_img_link').attr('href') + param_product_url);
$('ul#product_list li.ajax_block_product h3 a').attr('href', $('ul#product_list li.ajax_block_product h3 a').attr('href') + param_product_url);
$('ul#product_list li.ajax_block_product .product_desc a').attr('href', $('ul#product_list li.ajax_block_product .product_desc a').attr('href') + param_product_url);
}
+5 -2
View File
@@ -2385,6 +2385,7 @@ class BlockLayered extends Module
//generate SEO link
$paramSelected = '';
$param_product_url = '';
$optionCheckedArray = array();
$paramGroupSelectedArray = array();
$titleValues = array();
@@ -2419,6 +2420,9 @@ class BlockLayered extends Module
$paramSelected .= '/'.str_replace('-', '_', Tools::link_rewrite($filterName)).$paramGroupSelected;
$optionCheckedArray[Tools::link_rewrite($filterName)] = $paramGroupSelected;
}
// select only attribute and group attribute to display an unique product combination link
if (!empty($paramGroupSelected) && $typeFilter['type'] == 'id_attribute_group')
$param_product_url .= '/'.str_replace('-', '_', Tools::link_rewrite($filterName)).$paramGroupSelected;
}
$blackList = array('weight','price');
@@ -2460,7 +2464,6 @@ class BlockLayered extends Module
$parameters = '';
foreach ($optionCheckedCloneArray as $keyGroup => $valueGroup)
$parameters .= '/'.str_replace('-', '_', $keyGroup).$valueGroup;
// Check if there is an non indexable attribute or feature in the url
foreach ($nonIndexable as $value)
if (strpos($parameters, '/'.$value) !== false)
@@ -2489,7 +2492,7 @@ class BlockLayered extends Module
$cache = array('layered_show_qties' => (int)Configuration::get('PS_LAYERED_SHOW_QTIES'), 'id_category_layered' => (int)$id_parent,
'selected_filters' => $selectedFilters, 'n_filters' => (int)$nFilters, 'nbr_filterBlocks' => count($filterBlocks), 'filters' => $filterBlocks,
'title_values' => $titleValues, 'current_friendly_url' => htmlentities($paramSelected), 'nofollow' => !empty($paramSelected) || $nofollow);
'title_values' => $titleValues, 'current_friendly_url' => htmlentities($paramSelected), 'param_product_url' => htmlentities($param_product_url), 'nofollow' => !empty($paramSelected) || $nofollow);
return $cache;
}
+1
View File
@@ -28,6 +28,7 @@
{if $nbr_filterBlocks != 0}
<script type="text/javascript">
current_friendly_url = '#{$current_friendly_url}';
param_product_url = '#{$param_product_url}';
</script>
<div id="layered_block_left" class="block">
<h4>{l s='Catalog' mod='blocklayered'}</h4>