// Blocklayered: Add nofollow to page non-indexable pages
// Blocklayered: Change page title format // Blocklayered: Fix bug with IE8 and aliasing
This commit is contained in:
@@ -356,6 +356,9 @@ function reloadContent(params_plus)
|
|||||||
$('#product_list').html('');
|
$('#product_list').html('');
|
||||||
|
|
||||||
$('#product_list').css('opacity', '1');
|
$('#product_list').css('opacity', '1');
|
||||||
|
if ($.browser.msie) // Fix bug with IE8 and aliasing
|
||||||
|
$('#product_list').css('filter', '');
|
||||||
|
|
||||||
$('div#pagination').html(result.pagination);
|
$('div#pagination').html(result.pagination);
|
||||||
paginationButton();
|
paginationButton();
|
||||||
ajaxLoaderOn = 0;
|
ajaxLoaderOn = 0;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class BlockLayered extends Module
|
|||||||
{
|
{
|
||||||
$this->name = 'blocklayered';
|
$this->name = 'blocklayered';
|
||||||
$this->tab = 'front_office_features';
|
$this->tab = 'front_office_features';
|
||||||
$this->version = '1.8';
|
$this->version = '1.8.1';
|
||||||
$this->author = 'PrestaShop';
|
$this->author = 'PrestaShop';
|
||||||
$this->need_instance = 0;
|
$this->need_instance = 0;
|
||||||
|
|
||||||
@@ -70,7 +70,11 @@ class BlockLayered extends Module
|
|||||||
Configuration::updateValue('PS_LAYERED_FILTER_CATEGORY_DEPTH', 1);
|
Configuration::updateValue('PS_LAYERED_FILTER_CATEGORY_DEPTH', 1);
|
||||||
|
|
||||||
$this->rebuildLayeredStructure();
|
$this->rebuildLayeredStructure();
|
||||||
$this->rebuildLayeredCache();
|
|
||||||
|
$products_count = Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'product`');
|
||||||
|
|
||||||
|
if ($products_count < 10000) // Lock price indexation if too many products
|
||||||
|
$this->rebuildLayeredCache();
|
||||||
self::installPriceIndexTable();
|
self::installPriceIndexTable();
|
||||||
$this->installFriendlyUrlTable();
|
$this->installFriendlyUrlTable();
|
||||||
$this->installIndexableAttributeTable();
|
$this->installIndexableAttributeTable();
|
||||||
@@ -79,7 +83,7 @@ class BlockLayered extends Module
|
|||||||
$this->indexUrl();
|
$this->indexUrl();
|
||||||
$this->indexAttribute();
|
$this->indexAttribute();
|
||||||
|
|
||||||
if (Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'product`') < 10000) // Lock price indexation if too many products
|
if ($products_count < 10000) // Lock price indexation if too many products
|
||||||
self::fullPricesIndexProcess();
|
self::fullPricesIndexProcess();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1144,24 +1148,29 @@ class BlockLayered extends Module
|
|||||||
|
|
||||||
// Generate meta title and meta description
|
// Generate meta title and meta description
|
||||||
$title = '';
|
$title = '';
|
||||||
|
$keywords = '';
|
||||||
if (is_array($filterBlock['title_values']))
|
if (is_array($filterBlock['title_values']))
|
||||||
foreach ($filterBlock['title_values'] as $key => $val)
|
foreach ($filterBlock['title_values'] as $key => $val)
|
||||||
$title .= $key.' '.implode('/', $val).' – ';
|
{
|
||||||
$title = rtrim($title, ' – ');
|
$title .= $key.' '.implode('/', $val).' ';
|
||||||
|
$keywords .= $key.' '.implode('/', $val).', ';
|
||||||
|
}
|
||||||
|
$title = strtolower(rtrim($title));
|
||||||
|
|
||||||
$categoryMetas = Tools::getMetaTags($idLang, '', $title);
|
$categoryMetas = Tools::getMetaTags($idLang, '', $title);
|
||||||
$categoryTitle = (empty($category->meta_title[$idLang]) ? $category->name[$idLang] : $category->meta_title[$idLang]);
|
$categoryTitle = (empty($category->meta_title[$idLang]) ? $category->name[$idLang] : $category->meta_title[$idLang]);
|
||||||
|
|
||||||
if (!empty($title))
|
if (!empty($title))
|
||||||
{
|
{
|
||||||
$smarty->assign('meta_title', $categoryTitle.$categoryMetas['meta_title']);
|
$smarty->assign('meta_title', $categoryTitle.substr($categoryMetas['meta_title'], 2));
|
||||||
$smarty->assign('meta_description', $categoryTitle.' '.$title.' '.$categoryMetas['meta_description']);
|
$smarty->assign('meta_description', $categoryTitle.' '.$title.'. '.$categoryMetas['meta_description']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$smarty->assign('meta_title', $categoryMetas['meta_title']);
|
$smarty->assign('meta_title', $categoryMetas['meta_title']);
|
||||||
|
|
||||||
$metaKeyWordsComplement = substr(str_replace(' – ', ', ', strtolower($title)), 0, 1000);
|
$keywords = substr(strtolower($keywords), 0, 1000);
|
||||||
if (!empty($metaKeyWordsComplement))
|
if (!empty($keywords))
|
||||||
$smarty->assign('meta_keywords', rtrim($categoryTitle.', '.$metaKeyWordsComplement.', '.$categoryMetas['meta_keywords'], ', '));
|
$smarty->assign('meta_keywords', rtrim($categoryTitle.', '.$keywords.', '.$categoryMetas['meta_keywords'], ', '));
|
||||||
|
|
||||||
if (version_compare(_PS_VERSION_,'1.5','>'))
|
if (version_compare(_PS_VERSION_,'1.5','>'))
|
||||||
{
|
{
|
||||||
@@ -1179,6 +1188,48 @@ class BlockLayered extends Module
|
|||||||
Tools::addCSS(($this->_path).'blocklayered.css', 'all');
|
Tools::addCSS(($this->_path).'blocklayered.css', 'all');
|
||||||
Tools::addJS(_PS_JS_DIR_.'jquery/jquery.scrollTo-1.4.2-min.js');
|
Tools::addJS(_PS_JS_DIR_.'jquery/jquery.scrollTo-1.4.2-min.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$filters = $this->getSelectedFilters();
|
||||||
|
|
||||||
|
// Get non indexable attributes
|
||||||
|
$attribute_group_list = Db::getInstance()->executeS('SELECT id_attribute_group FROM '._DB_PREFIX_.'layered_indexable_attribute_group WHERE indexable = 0');
|
||||||
|
// Get non indexable features
|
||||||
|
$feature_list = Db::getInstance()->executeS('SELECT id_feature FROM '._DB_PREFIX_.'layered_indexable_feature WHERE indexable = 0');
|
||||||
|
|
||||||
|
$attributes = array();
|
||||||
|
$features = array();
|
||||||
|
|
||||||
|
foreach ($filters as $type => $val)
|
||||||
|
{
|
||||||
|
switch($type)
|
||||||
|
{
|
||||||
|
case 'price':
|
||||||
|
case 'weight':
|
||||||
|
return '<meta name="robots" content="noindex,nofollow"/>';
|
||||||
|
case 'id_attribute_group':
|
||||||
|
foreach ($val as $attr)
|
||||||
|
{
|
||||||
|
$attr_id = preg_replace('/_\d+$/', '', $attr);
|
||||||
|
if (in_array($attr_id, $attributes) || in_array(array('id_attribute_group' => $attr_id), $attribute_group_list))
|
||||||
|
return '<meta name="robots" content="noindex,nofollow"/>';
|
||||||
|
$attributes[] = $attr_id;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'id_feature':
|
||||||
|
foreach ($val as $feat)
|
||||||
|
{
|
||||||
|
$feat_id = preg_replace('/_\d+$/', '', $feat);
|
||||||
|
if (in_array($feat_id, $features) || in_array(array('id_feature' => $feat_id), $feature_list))
|
||||||
|
return '<meta name="robots" content="noindex,nofollow"/>';
|
||||||
|
$features[] = $feat_id;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (count($val) > 1)
|
||||||
|
return '<meta name="robots" content="noindex,nofollow"/>';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hookFooter($params)
|
public function hookFooter($params)
|
||||||
@@ -2962,11 +3013,11 @@ class BlockLayered extends Module
|
|||||||
$nofollow = false;
|
$nofollow = false;
|
||||||
$optionCheckedCloneArray = $optionCheckedArray;
|
$optionCheckedCloneArray = $optionCheckedArray;
|
||||||
|
|
||||||
//if not filters checked, add parameter
|
// If not filters checked, add parameter
|
||||||
$valueName = !empty($values['url_name']) ? $values['url_name'] : $values['name'];
|
$valueName = !empty($values['url_name']) ? $values['url_name'] : $values['name'];
|
||||||
if (!in_array(Tools::link_rewrite($valueName), $paramGroupSelectedArray[Tools::link_rewrite($filterName)]))
|
if (!in_array(Tools::link_rewrite($valueName), $paramGroupSelectedArray[Tools::link_rewrite($filterName)]))
|
||||||
{
|
{
|
||||||
//update parameter filter checked before
|
// Update parameter filter checked before
|
||||||
if (array_key_exists(Tools::link_rewrite($filterName), $optionCheckedArray))
|
if (array_key_exists(Tools::link_rewrite($filterName), $optionCheckedArray))
|
||||||
{
|
{
|
||||||
$optionCheckedCloneArray[Tools::link_rewrite($filterName)] = $optionCheckedCloneArray[Tools::link_rewrite($filterName)].'-'.str_replace('-', '_', Tools::link_rewrite($valueName));
|
$optionCheckedCloneArray[Tools::link_rewrite($filterName)] = $optionCheckedCloneArray[Tools::link_rewrite($filterName)].'-'.str_replace('-', '_', Tools::link_rewrite($valueName));
|
||||||
@@ -2990,7 +3041,7 @@ class BlockLayered extends Module
|
|||||||
foreach ($nonIndexable as $value)
|
foreach ($nonIndexable as $value)
|
||||||
if (strpos($parameters, '/'.$value) !== false)
|
if (strpos($parameters, '/'.$value) !== false)
|
||||||
$nofollow = true;
|
$nofollow = true;
|
||||||
//write link by mode rewriting
|
// Write link by mode rewriting
|
||||||
if (!Configuration::get('PS_REWRITING_SETTINGS'))
|
if (!Configuration::get('PS_REWRITING_SETTINGS'))
|
||||||
$typeFilter['values'][$key]['link'] = $linkBase.'&selected_filters='.$parameters;
|
$typeFilter['values'][$key]['link'] = $linkBase.'&selected_filters='.$parameters;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<module>
|
<module>
|
||||||
<name>blocklayered</name>
|
<name>blocklayered</name>
|
||||||
<displayName><![CDATA[Layered navigation block]]></displayName>
|
<displayName><![CDATA[Layered navigation block]]></displayName>
|
||||||
<version><![CDATA[1.8]]></version>
|
<version><![CDATA[1.8.1]]></version>
|
||||||
<description><![CDATA[Displays a block with layered navigation filters.]]></description>
|
<description><![CDATA[Displays a block with layered navigation filters.]]></description>
|
||||||
<author><![CDATA[PrestaShop]]></author>
|
<author><![CDATA[PrestaShop]]></author>
|
||||||
<tab><![CDATA[front_office_features]]></tab>
|
<tab><![CDATA[front_office_features]]></tab>
|
||||||
|
|||||||
Reference in New Issue
Block a user