Jump to content

Modulo blog e sitemaps


bacissimi

Recommended Posts

  • 2 months later...

Hola nosotros hemos realizado una pequeña modificación del modulo de google sitemap para prestashop para que pueda incluir los blog generados por este modulo de prestashop y podáis mejorar la indexación de la tienda online y su posicionamiento.

 

Dentro del fichero gsitemap.php hemos cambiado la función , no es perfecta y seguro que muy mejorable pero funciona perfectamente.

 
protected function _getCmsLink(&$link_sitemap, $lang, &$index, &$i, $id_cms = 0)
{

$link = new Link();

if (method_exists('ShopUrl', 'resetMainDomainCache'))
ShopUrl::resetMainDomainCache();
$cmss_id = Db::getInstance()->ExecuteS(
'SELECT c.`id_cms` FROM `'._DB_PREFIX_.'cms` c INNER JOIN `'._DB_PREFIX_.'cms_lang` cl ON c.`id_cms` = cl.`id_cms` '.
($this->tableColumnExists(_DB_PREFIX_.'supplier_shop') ? 'INNER JOIN `'._DB_PREFIX_.'cms_shop` cs ON c.`id_cms` = cs.`id_cms` ' : '').
'INNER JOIN `'._DB_PREFIX_.'cms_category` cc ON c.id_cms_category = cc.id_cms_category AND cc.active = 1
WHERE c.`active` =1 AND c.`indexation` =1 AND c.`id_cms` >= '.(int)$id_cms.
($this->tableColumnExists(_DB_PREFIX_.'supplier_shop') ? ' AND cs.id_shop = '.(int)$this->context->shop->id : '').
' AND cl.`id_lang` = '.(int)$lang['id_lang'].
' ORDER BY c.`id_cms` ASC'
);




if (is_array($cmss_id))
foreach ($cmss_id as $cms_id)
{
$cms = new CMS((int)$cms_id['id_cms'], $lang['id_lang']);
$cms->link_rewrite = urlencode((is_array($cms->link_rewrite) ? $cms->link_rewrite[(int)$lang['id_lang']] : $cms->link_rewrite));
$url = $link->getCMSLink($cms, null, null, $lang['id_lang']);

if (!$this->_addLinkToSitemap(
$link_sitemap, array(
'type' => 'cms',
'page' => 'cms',
'link' => $url,
'image' => false
), $lang['iso_code'], $index, $i, $cms_id['id_cms']
))
return false;
}

$leo_id = Db::getInstance()->ExecuteS(
'SELECT c.`id_leoblog_blog`, link_rewrite FROM `'._DB_PREFIX_.'leoblog_blog` c INNER JOIN `'._DB_PREFIX_.'leoblog_blog_lang` cl ON c.`id_leoblog_blog` = cl.`id_leoblog_blog` '.
'WHERE c.`active` =1 AND c.`indexation` =1 AND c.`id_leoblog_blog` >= '.(int)$id_cms.
' AND cl.`id_lang` = '.(int)$lang['id_lang'].
' ORDER BY c.`id_leoblog_blog` ASC'
);
if (is_array($leo_id))
foreach ($leo_id as $leoart_id)
{
$url = _PS_BASE_URL_.__PS_BASE_URI__.'blog/'.$leoart_id['link_rewrite'].'-b'.$leoart_id['id_leoblog_blog'].'.html';

if (!$this->_addLinkToSitemap(
$link_sitemap, array(
'type' => 'cms',
'page' => 'cms',
'link' => $url,
'image' => false
), $lang['iso_code'], $index, $i, $leoart_id['id_leoblog_blog']
))
return false;
}

return true;
}

 

Edited by nadie (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...