Simplified sitemap

This commit is contained in:
Michael RICOIS 2018-03-20 12:10:23 +01:00
parent 25c1ae725b
commit d30b3717fd

View File

@ -145,45 +145,6 @@ XML;
$link->getCategoryLink((int)$category->id_category, $category->link_rewrite[1]) :
$link->getCategoryLink((int)$category->id_category);
$this->_addSitemapNode($xml, htmlspecialchars($tmpLink), $priority, 'daily', substr($category->date_upd, 0, 10));
// Get products in category
/*$productsId = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT `id_product` FROM `'._DB_PREFIX_.'product_ps_cache`
WHERE `id_sale` = '.(int) $sale->id);
if (count($productsId) > 0) {
foreach ($productsId as $p) {
$products[] = $p['id_product'];
}
}*/
}
}
$tmp = null;
$res = null;
if (count($products) > 0) {
foreach($products as $v) {
$productObj = new Product($v);
$product = (array)$productObj;
if ($tmp == $product['id']) {
$res[$tmp]['images'][] = array('id_image' => $product['id_image'], 'legend_image' => $product['legend_image']);
} else {
$tmp = $product['id'];
$res[$tmp] = $product;
unset($res[$tmp]['id_image'], $res[$tmp]['legend_image']);
$res[$tmp]['images'][] = array('id_image' => $product['id_image'], 'legend_image' => $product['legend_image']);
}
}
foreach($res as $product) {
if (($priority = 0.7 - ($product['level_depth'] / 10)) < 0.1) {
$priority = 0.1;
}
$tmpLink = $link->getProductLink((int)$product['id'], $product['link_rewrite'][1], $product['category'], $product['ean13']);
$sitemap = $this->_addSitemapNode($xml, htmlspecialchars($tmpLink), $priority, 'weekly', substr($product['date_upd'], 0, 10));
$sitemap = $this->_addSitemapNodeImage($sitemap, $product);
}
}
@ -193,7 +154,7 @@ XML;
//'best-sales' => false,
'contact-form' => true,
//'discount' => false,
'index' => true,
//'index' => true,
//'manufacturer' => false,
//'new-products' => false,
//'prices-drop' => false,
@ -222,7 +183,7 @@ XML;
$this->_addSitemapNode($xml, $link->getPageLink($page.'.php', $ssl), '0.5', 'monthly');
}
}
$xmlString = $xml->asXML();
$fp = fopen(GSITEMAP_FILE, 'w');