modif sitemap suite

This commit is contained in:
Marion Muszynski 2015-11-06 12:02:21 +01:00
parent fd84386473
commit ccebebe4e6
2 changed files with 12 additions and 22 deletions

View File

@ -53,11 +53,11 @@ if ($gsitemapOverride->active)
/* for the main run initiat the sitemap's files name stored in the database */
if (!isset($_GET['continue']))
$gsitemapOverride->emptySitemap((int)$id_shop);
$gsitemapOverride->createSpecificSitemap(1, (int)$id_shop);
$gsitemapOverride->createSpecificSitemap(2, (int)$id_shop);
$gsitemapOverride->createSpecificSitemap(3, (int)$id_shop);
$gsitemapOverride->createSpecificSitemap(4, (int)$id_shop, true);
$gsitemapOverride->createSpecificSitemap(5, (int)$id_shop, true);
$gsitemapOverride->createSpecificSitemap(array('cmspscategory'), 1, (int)$id_shop);
$gsitemapOverride->createSpecificSitemap(array('cmspspost'), 2, (int)$id_shop);
$gsitemapOverride->createSpecificSitemap(array('cmspsedito'), 3, (int)$id_shop);
$gsitemapOverride->createSpecificSitemap(array('product'), 4, (int)$id_shop, true);
$gsitemapOverride->createSpecificSitemap(array('cmspspost'), 5, (int)$id_shop, true);
$gsitemapOverride->createSitemap((int)$id_shop);

View File

@ -61,40 +61,30 @@ class GsitemapOverride extends Gsitemap
elseif (Tools::isSubmit('SubmitBlogCatGsitemap'))
{
Configuration::updateValue('GSITEMAP_FREQUENCY', pSQL(Tools::getValue('gsitemap_frequency')));
$this->type_array = array('cmspscategory');
$this->metas_plus = array('cmspscategory');
$this->createSpecificSitemap(1);
$this->createSpecificSitemap(array('cmspscategory'),1);
}
elseif (Tools::isSubmit('SubmitBlogArticleGsitemap'))
{
Configuration::updateValue('GSITEMAP_FREQUENCY', pSQL(Tools::getValue('gsitemap_frequency')));
$this->type_array = array('cmspspost');
$this->metas_plus = array('cmspspost');
$this->createSpecificSitemap(2);
$this->createSpecificSitemap(array('cmspspost'),2);
}
elseif (Tools::isSubmit('SubmitBlogEditoGsitemap'))
{
Configuration::updateValue('GSITEMAP_FREQUENCY', pSQL(Tools::getValue('gsitemap_frequency')));
$this->type_array = array('cmspsedito');
$this->metas_plus = array('cmspsedito');
$this->createSpecificSitemap(3);
$this->createSpecificSitemap(array('cmspsedito'),3);
}
elseif (Tools::isSubmit('SubmitProductImgGsitemap'))
{
Configuration::updateValue('GSITEMAP_FREQUENCY', pSQL(Tools::getValue('gsitemap_frequency')));
$this->type_array = array('product');
$this->metas_plus = array('product');
$this->createSpecificSitemap(4, 0, true);
$this->createSpecificSitemap(array('product'),4, 0, true);
}
elseif (Tools::isSubmit('SubmitArticleImgGsitemap'))
{
Configuration::updateValue('GSITEMAP_FREQUENCY', pSQL(Tools::getValue('gsitemap_frequency')));
$this->type_array = array('cmspspost');
$this->metas_plus = array('cmspspost');
$this->createSpecificSitemap(5, 0, true);
$this->createSpecificSitemap(array('cmspspost'),5, 0, true);
}
/* if no posted form and the variable [continue] is found in the HTTP request variable keep creating sitemap */
elseif (Tools::getValue('continue'))
@ -183,7 +173,7 @@ class GsitemapOverride extends Gsitemap
die();
}
public function createSpecificSitemap($index, $id_shop = 0, $img_url=false)
public function createSpecificSitemap($functions=array(), $index, $id_shop = 0, $img_url=false)
{
if (@fopen($this->normalizeDirectory(_PS_ROOT_DIR_).'/test.txt', 'w') == false)
{
@ -211,7 +201,7 @@ class GsitemapOverride extends Gsitemap
$lang_stop = false;
$link_sitemap = array();
foreach ($this->metas_plus as $type_val)
foreach ($functions as $type_val)
{
if ($type == '' || $type == $type_val)
{