Home / Tutorials / Error site map with leo blog module

Error site map with leo blog module

Hi

If you have error site map with leo blog module

please open file

/modules/gsitemap/gsitemap.php

protected function getMetaLink(&$link_sitemap, $lang, &$index, &$i, $id_meta = 0)
{
if (method_exists('ShopUrl', 'resetMainDomainCache')) {
ShopUrl::resetMainDomainCache();
}
$link = new Link();
$metas = Db::getInstance()->ExecuteS('SELECT * FROM `' . DB_PREFIX . 'meta` WHERE `configurable` > 0 AND `id_meta` >= ' . (int) $id_meta . ' AND page <> \'index\' ORDER BY `id_meta` ASC');
foreach ($metas as $meta) {
$url = '';
$link = new Link();
if ($meta['page'] == 'module-leoblog-blog' || $meta['page'] == 'module-leoblog-category') {
if ($meta['page'] == 'module-leoblog-blog') {
$ids = Db::getInstance()->ExecuteS('SELECT b.`id_leoblog_blog` FROM `' . DB_PREFIX . 'leoblog_blog` b
LEFT JOIN `' . DB_PREFIX . 'leoblog_blog_shop` bs ON b.id_leoblog_blog=bs.id_leoblog_blog
WHERE b.`active` = 1 AND bs.`id_shop`=' . $this->context->shop->id);
$image_path = (Tools::usingSecureMode() ? 'https://' : 'http://').Tools::getMediaServer($url)._THEME_DIR_.'assets/img/modules/leoblog/'.$this->context->shop->id.'/b/';
$classObj = 'LeoBlogBlog';
} else {
$ids = Db::getInstance()->ExecuteS('SELECT c.`id_leoblogcat` FROM `' . DB_PREFIX . 'leoblogcat` c
LEFT JOIN `' . DB_PREFIX . 'leoblogcat_shop` cs ON c.id_leoblogcat=cs.id_leoblogcat
WHERE c.`active` = 1 AND cs.`id_shop`=' . $this->context->shop->id);
$image_path = (Tools::usingSecureMode() ? 'https://' : 'http://').Tools::getMediaServer($url)._THEME_DIR_.'assets/img/modules/leoblog/'.$this->context->shop->id.'/c/';
$classObj = 'Leoblogcat';
}
foreach ($ids as $key => $id) {
$obj = $classObj == 'LeoBlogBlog' ? new LeoBlogBlog($id, $this->context->language->id) : new Leoblogcat($id, $this->context->language->id);
$image_link = $image_path.$obj->image;
$file_headers = (Configuration::get('GSITEMAP_CHECK_IMAGE_FILE')) ? @get_headers($image_link) : true;
$params = array(
'id' => $id,
'rewrite' => $obj->link_rewrite,
);
$protocol_link = (Configuration::get('PS_SSL_ENABLED') || Tools::usingSecureMode()) ? 'https://' : 'http://';
$use_ssl = ((Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) || Tools::usingSecureMode()) ? true : false;
$protocol_content = ($use_ssl) ? 'https://' : 'http://';
$leoBlogLink = new LeoBlogLink($protocol_link, $protocol_content);
$url = $leoBlogLink->getLink($meta['page'], ($classObj == 'LeoBlogBlog' ? 'blog' : 'category'), $params, $use_ssl, $this->context->language->id, $this->context->shop->id);
// $url = $link->getModuleLink('blog', $classObj == 'LeoBlogBlog' ? 'blog' : 'category', $params);
$images_blog = array();
if (isset($image_link) && ((is_array($file_headers) && $file_headers[0] != 'HTTP/1.1 404 Not Found') || $file_headers === true)) {
$images_blog[] = array(
'title_img' => htmlspecialchars(strip_tags($classObj == 'LeoBlogBlog' ? $obj->meta_title : $obj->title)),
'caption' => htmlspecialchars(strip_tags($obj->meta_description)),
'link' => $image_link,
);
}
if (!$this->addLinkToSitemap($link_sitemap, array(
'type' => 'blog',
'page' => 'blog',
'lastmod' => $obj->date_upd,
'link' => $url,
'images' => $images_blog,
), $lang['iso_code'], $index, $i, $id)) {
return false;
}
}
return true;
}

if (!in_array($meta[‘id_meta’], explode(‘,’, Configuration::get(‘GSITEMAP_DISABLE_LINKS’)))) {
$url = $link->getPageLink($meta[‘page’], null, $lang[‘id_lang’]);

if (!$this->addLinkToSitemap($link_sitemap, array(
‘type’ => ‘meta’,
‘page’ => $meta[‘page’],
‘link’ => $url,
‘image’ => false,
), $lang[‘iso_code’], $index, $i, $meta[‘id_meta’])) {
return false;
}
}
}

return true;
}

About Leo Theme

Check Also

Leotheme Black Friday 2022

Prestashop Theme and Module Black Friday and Cyber Monday Sales Leotheme 2022 30% Off

Prestashop Leotheme Black Friday 2022 Promotion! Dear valued customers, Black Friday and Cyber Monday Sales …