Jump to content
bacissimi

Modulo blog e sitemaps

Recommended Posts

Buongiorno, sul mio shop utilizzo un template leo theme che ha integrato il modulo blog. Il problema sorge quando vado a creare la sitemaps attraverso il modulo prestashop. Tutti gli articoli del blog non vengono inseriti nella sitemaps. Come posso fare? Grazie mille

Share this post


Link to post
Share on other sites

Non credo dipenda dal tema. Il modulo blog nn è previsto in prestashop nel modulo sitemaps e quindi non incluso. Vorrei sapere un modo per creare la sitemaps del blog

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
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

×

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More