// Merge -> revision 8608
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8612 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
1 parent
8d9309ba23
commit
1977f1d851
8 files changed
+77
-61
No files matched your search
+13
-5
@@ -173,6 +173,7 @@ class SearchCore
|
|||||||
{
|
{
|
||||||
$word = str_replace('%', '\\%', $word);
|
$word = str_replace('%', '\\%', $word);
|
||||||
$word = str_replace('_', '\\_', $word);
|
$word = str_replace('_', '\\_', $word);
|
||||||
|
|
||||||
$intersectArray[] = 'SELECT si.id_product
|
$intersectArray[] = 'SELECT si.id_product
|
||||||
FROM '._DB_PREFIX_.'search_word sw
|
FROM '._DB_PREFIX_.'search_word sw
|
||||||
LEFT JOIN '._DB_PREFIX_.'search_index si ON sw.id_word = si.id_word
|
LEFT JOIN '._DB_PREFIX_.'search_index si ON sw.id_word = si.id_word
|
||||||
@@ -443,6 +444,9 @@ class SearchCore
|
|||||||
if (!empty($word))
|
if (!empty($word))
|
||||||
{
|
{
|
||||||
$word = Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH);
|
$word = Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH);
|
||||||
|
// Remove accents
|
||||||
|
$word = Tools::replaceAccentedChars($word);
|
||||||
|
|
||||||
if (!isset($pArray[$word]))
|
if (!isset($pArray[$word]))
|
||||||
$pArray[$word] = 0;
|
$pArray[$word] = 0;
|
||||||
$pArray[$word] += $weightArray[$key];
|
$pArray[$word] += $weightArray[$key];
|
||||||
@@ -462,15 +466,19 @@ class SearchCore
|
|||||||
foreach ($pArray AS $word => $weight)
|
foreach ($pArray AS $word => $weight)
|
||||||
if ($weight AND !isset($wordIdsByWord['_'.$word]))
|
if ($weight AND !isset($wordIdsByWord['_'.$word]))
|
||||||
{
|
{
|
||||||
$queryArray[] = '('.(int)$product['id_lang'].', '.(int)$product['id_shop'].', \''.pSQL($word).'\')';
|
$queryArray[$word] = '('.(int)$product['id_lang'].', '.(int)$product['id_shop'].', \''.pSQL($word).'\')';
|
||||||
$queryArray2[] = '\''.pSQL($word).'\'';
|
$queryArray2[] = '\''.pSQL($word).'\'';
|
||||||
$wordIdsByWord[$product['id_shop']][$product['id_lang']]['_'.$word] = 0;
|
$wordIdsByWord[$product['id_shop']][$product['id_lang']]['_'.$word] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$existingWords = $db->ExecuteS('SELECT word FROM '._DB_PREFIX_.'search_word WHERE word IN ('.implode(',', $queryArray2).') GROUP BY word');
|
$existingWords = $db->ExecuteS('
|
||||||
|
SELECT word FROM '._DB_PREFIX_.'search_word
|
||||||
|
WHERE word IN ('.implode(',', $queryArray2).')
|
||||||
|
AND id_lang = '.(int)$product['id_lang'].' GROUP BY word');
|
||||||
|
|
||||||
if($existingWords)
|
if($existingWords)
|
||||||
foreach($existingWords as $data)
|
foreach($existingWords as $data)
|
||||||
unset($queryArray[$data['word']]);
|
unset($queryArray[Tools::replaceAccentedChars($data['word'])]);
|
||||||
|
|
||||||
if (count($queryArray))
|
if (count($queryArray))
|
||||||
{
|
{
|
||||||
@@ -479,7 +487,6 @@ class SearchCore
|
|||||||
INSERT IGNORE INTO '._DB_PREFIX_.'search_word (id_lang, id_shop, word)
|
INSERT IGNORE INTO '._DB_PREFIX_.'search_word (id_lang, id_shop, word)
|
||||||
VALUES '.implode(',',$queryArray));
|
VALUES '.implode(',',$queryArray));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($queryArray2))
|
if (count($queryArray2))
|
||||||
{
|
{
|
||||||
// ...then their IDs are retrieved and added to the cache
|
// ...then their IDs are retrieved and added to the cache
|
||||||
@@ -490,8 +497,9 @@ class SearchCore
|
|||||||
AND sw.id_lang = '.(int)$product['id_lang'].'
|
AND sw.id_lang = '.(int)$product['id_lang'].'
|
||||||
AND sw.id_shop = '.(int)$product['id_shop'].'
|
AND sw.id_shop = '.(int)$product['id_shop'].'
|
||||||
LIMIT '.count($queryArray2));
|
LIMIT '.count($queryArray2));
|
||||||
|
// replace accents from the retrieved words so that words without accents or with differents accents can still be linked
|
||||||
foreach ($addedWords AS $wordId)
|
foreach ($addedWords AS $wordId)
|
||||||
$wordIdsByWord[$product['id_shop']][$product['id_lang']]['_'.$wordId['word']] = (int)$wordId['id_word'];
|
$wordIdsByWord[$product['id_shop']][$product['id_lang']]['_'.Tools::replaceAccentedChars($wordId['word'])] = (int)$wordId['id_word'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+23
-11
@@ -941,6 +941,29 @@ class ToolsCore
|
|||||||
$str = mb_strtolower($str, 'utf-8');
|
$str = mb_strtolower($str, 'utf-8');
|
||||||
|
|
||||||
$str = trim($str);
|
$str = trim($str);
|
||||||
|
$str = self::replaceAccentedChars($str);
|
||||||
|
|
||||||
|
// Remove all non-whitelist chars.
|
||||||
|
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-]/','', $str);
|
||||||
|
$str = preg_replace('/[\s\'\:\/\[\]-]+/',' ', $str);
|
||||||
|
$str = preg_replace('/[ ]/','-', $str);
|
||||||
|
$str = preg_replace('/[\/]/','-', $str);
|
||||||
|
|
||||||
|
// If it was not possible to lowercase the string with mb_strtolower, we do it after the transformations.
|
||||||
|
// This way we lose fewer special chars.
|
||||||
|
$str = strtolower($str);
|
||||||
|
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace all accented chars by their equivalent non accented chars.
|
||||||
|
*
|
||||||
|
* @param string $str
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function replaceAccentedChars($str)
|
||||||
|
{
|
||||||
$str = preg_replace('/[\x{0105}\x{0104}\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}]/u','a', $str);
|
$str = preg_replace('/[\x{0105}\x{0104}\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}]/u','a', $str);
|
||||||
$str = preg_replace('/[\x{00E7}\x{010D}\x{0107}\x{0106}]/u','c', $str);
|
$str = preg_replace('/[\x{00E7}\x{010D}\x{0107}\x{0106}]/u','c', $str);
|
||||||
$str = preg_replace('/[\x{010F}]/u','d', $str);
|
$str = preg_replace('/[\x{010F}]/u','d', $str);
|
||||||
@@ -958,17 +981,6 @@ class ToolsCore
|
|||||||
$str = preg_replace('/[\x{017C}\x{017A}\x{017B}\x{0179}\x{017E}]/u','z', $str);
|
$str = preg_replace('/[\x{017C}\x{017A}\x{017B}\x{0179}\x{017E}]/u','z', $str);
|
||||||
$str = preg_replace('/[\x{00E6}]/u','ae', $str);
|
$str = preg_replace('/[\x{00E6}]/u','ae', $str);
|
||||||
$str = preg_replace('/[\x{0153}]/u','oe', $str);
|
$str = preg_replace('/[\x{0153}]/u','oe', $str);
|
||||||
|
|
||||||
// Remove all non-whitelist chars.
|
|
||||||
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-]/','', $str);
|
|
||||||
$str = preg_replace('/[\s\'\:\/\[\]-]+/',' ', $str);
|
|
||||||
$str = preg_replace('/[ ]/','-', $str);
|
|
||||||
$str = preg_replace('/[\/]/','-', $str);
|
|
||||||
|
|
||||||
// If it was not possible to lowercase the string with mb_strtolower, we do it after the transformations.
|
|
||||||
// This way we lose fewer special chars.
|
|
||||||
$str = strtolower($str);
|
|
||||||
|
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ function verifyAndSetRequire(firsttime)
|
|||||||
for (i = 0; i < testListRequired.length; i++){
|
for (i = 0; i < testListRequired.length; i++){
|
||||||
result = testListRequired[i].getAttribute("result");
|
result = testListRequired[i].getAttribute("result");
|
||||||
$($("div#sheet_require"+isUpdate+" > ul#required"+isUpdate+" .required")[i])
|
$($("div#sheet_require"+isUpdate+" > ul#required"+isUpdate+" .required")[i])
|
||||||
.removeClass( (result == "fail") ? "okBlock" : "errorBlock" )
|
.removeClass( (result == "fail") ? "ok" : "fail" )
|
||||||
.addClass(result);
|
.addClass(result);
|
||||||
if (result == "fail") configIsOk = false;
|
if (result == "fail") configIsOk = false;
|
||||||
}
|
}
|
||||||
@@ -290,7 +290,7 @@ function verifyAndSetRequire(firsttime)
|
|||||||
for (i = 0; i < testListOptional.length; i++){
|
for (i = 0; i < testListOptional.length; i++){
|
||||||
result = testListOptional[i].getAttribute("result");
|
result = testListOptional[i].getAttribute("result");
|
||||||
$($("div#sheet_require"+isUpdate+" > ul#optional"+isUpdate+" li.optional")[i])
|
$($("div#sheet_require"+isUpdate+" > ul#optional"+isUpdate+" li.optional")[i])
|
||||||
.removeClass( (result == "fail") ? "okBlock" : "errorBlock" )
|
.removeClass( (result == "fail") ? "ok" : "fail" )
|
||||||
.addClass(result);
|
.addClass(result);
|
||||||
if (result == "fail") optionalIsOk = false;
|
if (result == "fail") optionalIsOk = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -417,7 +417,7 @@ INSERT INTO `PREFIX_image_lang` (`id_image`, `id_lang`, `legend`) VALUES
|
|||||||
|
|
||||||
INSERT INTO `PREFIX_tag` (`id_tag`, `id_lang`, `name`) VALUES (5, 1, 'apple'),(6, 2, 'ipod'),(7, 2, 'nano'),(8, 2, 'apple'),(18, 2, 'shuffle'),
|
INSERT INTO `PREFIX_tag` (`id_tag`, `id_lang`, `name`) VALUES (5, 1, 'apple'),(6, 2, 'ipod'),(7, 2, 'nano'),(8, 2, 'apple'),(18, 2, 'shuffle'),
|
||||||
(19, 2, 'macbook'),(20, 2, 'macbookair'),(21, 2, 'air'),(22, 1, 'superdrive'),(27, 2, 'marche'),(26, 2, 'casque'),(25, 2, 'écouteurs'),
|
(19, 2, 'macbook'),(20, 2, 'macbookair'),(21, 2, 'air'),(22, 1, 'superdrive'),(27, 2, 'marche'),(26, 2, 'casque'),(25, 2, 'écouteurs'),
|
||||||
(24, 2, 'ipod touch tacticle'),(23, 1, 'Ipod touch'),(28, 1, 'ipod'),(29, 1, 'nano'),(30, 3, 'ipod'),(31, 3, 'nano'),(32, 3, 'apple'),(33, 1, 'shuffle'),
|
(24, 2, 'ipod touch tactile'),(23, 1, 'Ipod touch'),(28, 1, 'ipod'),(29, 1, 'nano'),(30, 3, 'ipod'),(31, 3, 'nano'),(32, 3, 'apple'),(33, 1, 'shuffle'),
|
||||||
(34, 3, 'shuffle'),(35, 2, 'superdrive'),(36, 3, 'superdrive'),(37, 3, 'Ipod touch');
|
(34, 3, 'shuffle'),(35, 2, 'superdrive'),(36, 3, 'superdrive'),(37, 3, 'Ipod touch');
|
||||||
|
|
||||||
INSERT INTO `PREFIX_product_tag` (`id_product`, `id_tag`) VALUES (1, 5),(1, 6),(1, 7),(1, 8),(1, 28),(1, 29),(1, 30),(1, 31),(1, 32),(2, 6),(2, 18),(2, 28),
|
INSERT INTO `PREFIX_product_tag` (`id_product`, `id_tag`) VALUES (1, 5),(1, 6),(1, 7),(1, 8),(1, 28),(1, 29),(1, 30),(1, 31),(1, 32),(2, 6),(2, 18),(2, 28),
|
||||||
@@ -770,7 +770,7 @@ INSERT INTO `PREFIX_search_word` (`id_word`, `id_lang`, `word`) VALUES (1, 1, 'i
|
|||||||
(925, 2, 'internet'),(926, 2, 'poche'),(927, 2, 'navigateur'),(928, 2, 'safari,'),(929, 2, 'consulter'),(930, 2, 'sites'),(931, 2, 'leur'),(932, 2, 'mise'),
|
(925, 2, 'internet'),(926, 2, 'poche'),(927, 2, 'navigateur'),(928, 2, 'safari,'),(929, 2, 'consulter'),(930, 2, 'sites'),(931, 2, 'leur'),(932, 2, 'mise'),
|
||||||
(933, 2, 'page'),(934, 2, 'effectuer'),(935, 2, 'zoom'),(936, 2, 'arrière'),(937, 2, 'simple'),(938, 2, 'pression'),(939, 2, 'l''écran'),(940, 2, 'contenu'),
|
(933, 2, 'page'),(934, 2, 'effectuer'),(935, 2, 'zoom'),(936, 2, 'arrière'),(937, 2, 'simple'),(938, 2, 'pression'),(939, 2, 'l''écran'),(940, 2, 'contenu'),
|
||||||
(941, 2, 'coffret'),(942, 2, 'écouteurs'),(943, 2, 'câble'),(944, 2, 'dock'),(945, 2, 'chiffon'),(946, 2, 'nettoyage'),(947, 2, 'support'),(948, 2, 'guide'),
|
(941, 2, 'coffret'),(942, 2, 'écouteurs'),(943, 2, 'câble'),(944, 2, 'dock'),(945, 2, 'chiffon'),(946, 2, 'nettoyage'),(947, 2, 'support'),(948, 2, 'guide'),
|
||||||
(949, 2, 'démarrage'),(950, 2, 'tacticle'),(951, 2, '32go'),(952, 2, 'jack'),(953, 2, '120g'),(954, 2, '70mm'),(955, 2, '110mm'),(956, 3, 'touch'),
|
(949, 2, 'démarrage'),(950, 2, 'tactile'),(951, 2, '32go'),(952, 2, 'jack'),(953, 2, '120g'),(954, 2, '70mm'),(955, 2, '110mm'),(956, 3, 'touch'),
|
||||||
(957, 3, 'interfaz'),(958, 3, 'revolucionaria'),(959, 3, 'color'),(960, 3, 'pulgadas'),(961, 3, '(80211b'),(962, 3, 'espesor'),(963, 3, 'safari,'),
|
(957, 3, 'interfaz'),(958, 3, 'revolucionaria'),(959, 3, 'color'),(960, 3, 'pulgadas'),(961, 3, '(80211b'),(962, 3, 'espesor'),(963, 3, 'safari,'),
|
||||||
(964, 3, 'youtube,'),(965, 3, 'music'),(966, 3, 'store,'),(967, 3, 'correo,'),(968, 3, 'mapas,'),(969, 3, 'bolsa,'),(970, 3, 'tiempo,'),(971, 3, 'notas'),
|
(964, 3, 'youtube,'),(965, 3, 'music'),(966, 3, 'store,'),(967, 3, 'correo,'),(968, 3, 'mapas,'),(969, 3, 'bolsa,'),(970, 3, 'tiempo,'),(971, 3, 'notas'),
|
||||||
(972, 3, 'cinco'),(973, 3, 'mano'),(974, 3, 'consulta'),(975, 3, 'correo'),(976, 3, 'formato'),(977, 3, 'html'),(978, 3, 'enriquecido,'),(979, 3, 'fotos'),
|
(972, 3, 'cinco'),(973, 3, 'mano'),(974, 3, 'consulta'),(975, 3, 'correo'),(976, 3, 'formato'),(977, 3, 'html'),(978, 3, 'enriquecido,'),(979, 3, 'fotos'),
|
||||||
|
|||||||
@@ -41,14 +41,12 @@ $(document).ready(function()
|
|||||||
$('<input />').attr('type', 'hidden').attr('name', $(this).attr('name')).val($(this).attr('rel')).appendTo('#layered_form');
|
$('<input />').attr('type', 'hidden').attr('name', $(this).attr('name')).val($(this).attr('rel')).appendTo('#layered_form');
|
||||||
else
|
else
|
||||||
$('\'input[name='+$(this).attr('name')+']:hidden\'').remove();
|
$('\'input[name='+$(this).attr('name')+']:hidden\'').remove();
|
||||||
window.location = '#'+$(this).next().children(1).attr('href').replace(/https?:\/\/.*\/\d+-[^\/]+/, '');
|
|
||||||
reloadContent();
|
reloadContent();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click on checkbox
|
// Click on checkbox
|
||||||
$('#layered_form input[type=checkbox]').live('click', function()
|
$('#layered_form input[type=checkbox]').live('click', function()
|
||||||
{
|
{
|
||||||
window.location = '#'+$(this).next().children(1).attr('href').replace(/https?:\/\/.*\/\d+-[^\/]+/, '');
|
|
||||||
reloadContent();
|
reloadContent();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -57,7 +55,6 @@ $(document).ready(function()
|
|||||||
click: function() {
|
click: function() {
|
||||||
if($(this).parent().parent().find('input').attr('disabled') == '')
|
if($(this).parent().parent().find('input').attr('disabled') == '')
|
||||||
{
|
{
|
||||||
window.location = '#'+this.href.replace(/https?:\/\/.*\/\d+-[^\/]+/, '');
|
|
||||||
$(this).parent().parent().find('input').click();
|
$(this).parent().parent().find('input').click();
|
||||||
reloadContent();
|
reloadContent();
|
||||||
}
|
}
|
||||||
@@ -90,34 +87,12 @@ function initSliders()
|
|||||||
function initLayered()
|
function initLayered()
|
||||||
{
|
{
|
||||||
initSliders();
|
initSliders();
|
||||||
if (window.location.href.split('#').length == 2)
|
if (window.location.href.split('#').length == 2 && window.location.href.split('#')[1] != '')
|
||||||
{
|
{
|
||||||
var params = window.location.href.split('#')[1];
|
var params = window.location.href.split('#')[1];
|
||||||
reloadContent('&selected_filters='+params, true);
|
reloadContent('&selected_filters='+params);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
var params = window.location.href;
|
|
||||||
params = friendlyUrl(params, 'long');
|
|
||||||
params = params.split('#');
|
|
||||||
params.shift();
|
|
||||||
$(params).each(function(it, val)
|
|
||||||
{
|
|
||||||
allowReload = true;
|
|
||||||
if (val.split('=')[0] == 'price' || val.split('=')[0] == 'weight')
|
|
||||||
{
|
|
||||||
$("#layered_"+val.split('=')[0]+"_slider").slider('values', 0, val.split('=')[1].split('_')[0]);
|
|
||||||
$("#layered_"+val.split('=')[0]+"_slider").slider('values', 1, val.split('=')[1].split('_')[1]);
|
|
||||||
$("#layered_"+val.split('=')[0]+"_slider").slider('option', 'slide')(0,{values:[val.split('=')[1].split('_')[0], val.split('=')[1].split('_')[1]]});
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$('#'+val.split('=')[0]).click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
reloadContent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updatelink(link)
|
function updatelink(link)
|
||||||
{
|
{
|
||||||
@@ -234,14 +209,8 @@ function openCloseFilter()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadContent(params_plus, force)
|
function reloadContent(params_plus)
|
||||||
{
|
{
|
||||||
if (typeof(allowReload) == 'undefined' && typeof(force) != 'undefined' && force != true)
|
|
||||||
{
|
|
||||||
allowReload = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 0; i < ajaxQueries.length; i++)
|
for(i = 0; i < ajaxQueries.length; i++)
|
||||||
ajaxQueries[i].abort();
|
ajaxQueries[i].abort();
|
||||||
ajaxQueries = new Array();
|
ajaxQueries = new Array();
|
||||||
@@ -317,6 +286,9 @@ function reloadContent(params_plus, force)
|
|||||||
reloadProductComparison();
|
reloadProductComparison();
|
||||||
}
|
}
|
||||||
initSliders();
|
initSliders();
|
||||||
|
|
||||||
|
if(typeof(current_friendly_url != 'undefined'))
|
||||||
|
window.location = current_friendly_url;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ajaxQueries.push(ajaxQuery);
|
ajaxQueries.push(ajaxQuery);
|
||||||
|
|||||||
@@ -1387,7 +1387,7 @@ class BlockLayered extends Module
|
|||||||
/* If the current category isn't defined of if it's homepage, we have nothing to display */
|
/* If the current category isn't defined of if it's homepage, we have nothing to display */
|
||||||
$id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', 1));
|
$id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', 1));
|
||||||
if ($id_parent == 1)
|
if ($id_parent == 1)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
$queryFilters = ' AND p.active = 1';
|
$queryFilters = ' AND p.active = 1';
|
||||||
|
|
||||||
@@ -1888,7 +1888,7 @@ class BlockLayered extends Module
|
|||||||
{
|
{
|
||||||
if (is_array($value) AND array_key_exists('checked', $value ))
|
if (is_array($value) AND array_key_exists('checked', $value ))
|
||||||
{
|
{
|
||||||
$paramGroupSelected .= '-'.Tools::link_rewrite($value['name']);
|
$paramGroupSelected .= '-'.str_replace('-', '_', Tools::link_rewrite($value['name']));
|
||||||
$paramGroupSelectedArray [Tools::link_rewrite($typeFilter['name'])][] = Tools::link_rewrite($value['name']);
|
$paramGroupSelectedArray [Tools::link_rewrite($typeFilter['name'])][] = Tools::link_rewrite($value['name']);
|
||||||
|
|
||||||
if (!isset($titleValues[$typeFilter['name']]))
|
if (!isset($titleValues[$typeFilter['name']]))
|
||||||
@@ -1900,7 +1900,7 @@ class BlockLayered extends Module
|
|||||||
}
|
}
|
||||||
if(!empty($paramGroupSelected))
|
if(!empty($paramGroupSelected))
|
||||||
{
|
{
|
||||||
$paramSelected .= '/'.Tools::link_rewrite($typeFilter['name']).$paramGroupSelected;
|
$paramSelected .= '/'.str_replace('-', '_', Tools::link_rewrite($typeFilter['name'])).$paramGroupSelected;
|
||||||
$optionCheckedArray[Tools::link_rewrite($typeFilter['name'])] = $paramGroupSelected;
|
$optionCheckedArray[Tools::link_rewrite($typeFilter['name'])] = $paramGroupSelected;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1912,21 +1912,32 @@ class BlockLayered extends Module
|
|||||||
{
|
{
|
||||||
foreach ($typeFilter['values'] as $key => $values)
|
foreach ($typeFilter['values'] as $key => $values)
|
||||||
{
|
{
|
||||||
|
$nofollow = false;
|
||||||
$optionCheckedCloneArray = $optionCheckedArray;
|
$optionCheckedCloneArray = $optionCheckedArray;
|
||||||
//if not filters checked, add parameter
|
//if not filters checked, add parameter
|
||||||
if(!in_array(Tools::link_rewrite($values['name']), $paramGroupSelectedArray[Tools::link_rewrite($typeFilter['name'])]))
|
if(!in_array(Tools::link_rewrite($values['name']), $paramGroupSelectedArray[Tools::link_rewrite($typeFilter['name'])]))
|
||||||
{
|
{
|
||||||
//update parameter filter checked before
|
//update parameter filter checked before
|
||||||
if(array_key_exists(Tools::link_rewrite($typeFilter['name']), $optionCheckedArray))
|
if(array_key_exists(Tools::link_rewrite($typeFilter['name']), $optionCheckedArray)) {
|
||||||
$optionCheckedCloneArray[Tools::link_rewrite($typeFilter['name'])] = $optionCheckedCloneArray[Tools::link_rewrite($typeFilter['name'])].'-'.str_replace('-', '_', Tools::link_rewrite($values['name']));
|
$optionCheckedCloneArray[Tools::link_rewrite($typeFilter['name'])] = $optionCheckedCloneArray[Tools::link_rewrite($typeFilter['name'])].'-'.str_replace('-', '_', Tools::link_rewrite($values['name']));
|
||||||
|
$nofollow = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$optionCheckedCloneArray[Tools::link_rewrite($typeFilter['name'])] = '-'.str_replace('-', '_', Tools::link_rewrite($values['name']));
|
$optionCheckedCloneArray[Tools::link_rewrite($typeFilter['name'])] = '-'.str_replace('-', '_', Tools::link_rewrite($values['name']));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Remove selected parameters
|
||||||
|
$optionCheckedCloneArray[Tools::link_rewrite($typeFilter['name'])] = str_replace('-'.str_replace('-', '_', Tools::link_rewrite($values['name'])), '', $optionCheckedCloneArray[Tools::link_rewrite($typeFilter['name'])]);
|
||||||
|
if(empty($optionCheckedCloneArray[Tools::link_rewrite($typeFilter['name'])]))
|
||||||
|
unset($optionCheckedCloneArray[Tools::link_rewrite($typeFilter['name'])]);
|
||||||
|
}
|
||||||
$parameters = '';
|
$parameters = '';
|
||||||
foreach ($optionCheckedCloneArray as $keyGroup => $valueGroup)
|
foreach ($optionCheckedCloneArray as $keyGroup => $valueGroup)
|
||||||
$parameters .= '/'.str_replace('-', '_',$keyGroup).$valueGroup;
|
$parameters .= '/'.str_replace('-', '_',$keyGroup).$valueGroup;
|
||||||
//write link
|
//write link
|
||||||
$typeFilter['values'][$key]['link'] = $linkBase.$parameters;
|
$typeFilter['values'][$key]['link'] = $linkBase.$parameters;
|
||||||
|
$typeFilter['values'][$key]['rel'] = ($nofollow)?'nofollow':'';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1944,7 +1955,7 @@ class BlockLayered extends Module
|
|||||||
|
|
||||||
$cache = array('layered_show_qties' => (int)Configuration::get('PS_LAYERED_SHOW_QTIES'), 'id_category_layered' => (int)$id_parent,
|
$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' => sizeof($filterBlocks), 'filters' => $filterBlocks,
|
'selected_filters' => $selectedFilters, 'n_filters' => (int)$nFilters, 'nbr_filterBlocks' => sizeof($filterBlocks), 'filters' => $filterBlocks,
|
||||||
'title_values' => $titleValues);
|
'title_values' => $titleValues, 'current_friendly_url' => htmlentities($paramSelected), 'nofollow' => $nofollow);
|
||||||
|
|
||||||
return $cache;
|
return $cache;
|
||||||
}
|
}
|
||||||
@@ -1952,9 +1963,14 @@ class BlockLayered extends Module
|
|||||||
public function generateFiltersBlock($selectedFilters)
|
public function generateFiltersBlock($selectedFilters)
|
||||||
{
|
{
|
||||||
global $smarty;
|
global $smarty;
|
||||||
|
if($filterBlock = $this->getFilterBlock($selectedFilters))
|
||||||
|
{
|
||||||
$smarty->assign($this->getFilterBlock($selectedFilters));
|
$smarty->assign($this->getFilterBlock($selectedFilters));
|
||||||
return $this->display(__FILE__, 'blocklayered.tpl');
|
return $this->display(__FILE__, 'blocklayered.tpl');
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function must be improved
|
* This function must be improved
|
||||||
|
|||||||
@@ -26,6 +26,9 @@
|
|||||||
|
|
||||||
<!-- Block layered navigation module -->
|
<!-- Block layered navigation module -->
|
||||||
{if $nbr_filterBlocks != 0}
|
{if $nbr_filterBlocks != 0}
|
||||||
|
<script type="text/javascript">
|
||||||
|
current_friendly_url = '#{$current_friendly_url}';
|
||||||
|
</script>
|
||||||
<div id="layered_block_left" class="block">
|
<div id="layered_block_left" class="block">
|
||||||
<h4>{l s='Catalog' mod='blocklayered'}</h4>
|
<h4>{l s='Catalog' mod='blocklayered'}</h4>
|
||||||
<div class="block_content">
|
<div class="block_content">
|
||||||
@@ -83,7 +86,12 @@
|
|||||||
{else}
|
{else}
|
||||||
<input type="checkbox" class="checkbox" name="layered_{$filter.type_lite}_{$id_value}" id="layered_{$filter.type_lite}{if $id_value || $filter.type == 'quantity'}_{$id_value}{/if}" value="{$id_value}{if $filter.id_key}_{$filter.id_key}{/if}"{if isset($value.checked)} checked="checked"{/if}{if !$value.nbr} disabled="disabled"{/if} />
|
<input type="checkbox" class="checkbox" name="layered_{$filter.type_lite}_{$id_value}" id="layered_{$filter.type_lite}{if $id_value || $filter.type == 'quantity'}_{$id_value}{/if}" value="{$id_value}{if $filter.id_key}_{$filter.id_key}{/if}"{if isset($value.checked)} checked="checked"{/if}{if !$value.nbr} disabled="disabled"{/if} />
|
||||||
{/if}
|
{/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}><a href='{$value.link}'>{$value.name|escape:html:'UTF-8'}{if $layered_show_qties}<span> ({$value.nbr})</span></a>{/if}</label>
|
<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}
|
||||||
|
{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>
|
||||||
|
{/if}
|
||||||
</li>
|
</li>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{else}
|
{else}
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ $_LANG['order-carrier_674bb1e64d73fb88b873caf79ba06128'] = '(lire)';
|
|||||||
$_LANG['order-carrier_e085dcd05d73bdd5afe338e5b6e42a18'] = 'Choisissez votre mode de livraison';
|
$_LANG['order-carrier_e085dcd05d73bdd5afe338e5b6e42a18'] = 'Choisissez votre mode de livraison';
|
||||||
$_LANG['order-carrier_c8c4080207cd4f02548c8cb6285bd16b'] = 'Aucun transporteur nécessaire pour cette commande';
|
$_LANG['order-carrier_c8c4080207cd4f02548c8cb6285bd16b'] = 'Aucun transporteur nécessaire pour cette commande';
|
||||||
$_LANG['order-carrier_0fce1189b263c211a8239fb0e9df004d'] = 'J\'accepte de recevoir ma commande dans un emballage recyclé';
|
$_LANG['order-carrier_0fce1189b263c211a8239fb0e9df004d'] = 'J\'accepte de recevoir ma commande dans un emballage recyclé';
|
||||||
$_LANG['order-carrier_8f90815af11493295587f91f571c2f95'] = 'Il n\'y a pas de transporteurs disponibles qui délivre à cette adresse.';
|
$_LANG['order-carrier_8f90815af11493295587f91f571c2f95'] = 'Il n\'y a pas de transporteur disponible qui délivre à cette adresse.';
|
||||||
$_LANG['order-carrier_914419aa32f04011357d3b604a86d7eb'] = 'Transporteur';
|
$_LANG['order-carrier_914419aa32f04011357d3b604a86d7eb'] = 'Transporteur';
|
||||||
$_LANG['order-carrier_a82be0f551b8708bc08eb33cd9ded0cf'] = 'Informations';
|
$_LANG['order-carrier_a82be0f551b8708bc08eb33cd9ded0cf'] = 'Informations';
|
||||||
$_LANG['order-carrier_3601146c4e948c32b6424d2c0a7f0118'] = 'Prix';
|
$_LANG['order-carrier_3601146c4e948c32b6424d2c0a7f0118'] = 'Prix';
|
||||||
|
|||||||
Reference in new issue
Block a user