[-] MO : #PSFV-605 - Fix problem with gsitemap and multishop
This commit is contained in:
1 parent
be2f75c9d6
commit
8fbb48ba2c
2 files changed
+38
-2
No files matched your search
@@ -118,6 +118,7 @@ XML;
|
|||||||
{
|
{
|
||||||
$info = pathinfo(GSITEMAP_FILE);
|
$info = pathinfo(GSITEMAP_FILE);
|
||||||
$filename = $info['filename'].'-'.$row['id_shop'].'.'.$info['extension'];
|
$filename = $info['filename'].'-'.$row['id_shop'].'.'.$info['extension'];
|
||||||
|
|
||||||
$replaceUrl = array('http://'.$row['domain'].$row['uri'], ((Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$row['domain_ssl'].$row['uri']);
|
$replaceUrl = array('http://'.$row['domain'].$row['uri'], ((Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$row['domain_ssl'].$row['uri']);
|
||||||
|
|
||||||
$last = $this->generateSitemap($row['id_shop'], $info['dirname'].'/'.$filename, $replaceUrl);
|
$last = $this->generateSitemap($row['id_shop'], $info['dirname'].'/'.$filename, $replaceUrl);
|
||||||
@@ -298,7 +299,7 @@ XML;
|
|||||||
|
|
||||||
// Replace URL in XML strings by real shops URL
|
// Replace URL in XML strings by real shops URL
|
||||||
if ($replaceUrl)
|
if ($replaceUrl)
|
||||||
$xmlString = str_replace(array(Tools::getShopDomain(true), Tools::getShopDomainSsl(true)), $replaceUrl, $xmlString);
|
$xmlString = str_replace(array(Tools::getShopDomain(true).'/', Tools::getShopDomainSsl(true).'/'), $replaceUrl, $xmlString);
|
||||||
|
|
||||||
$fp = fopen($filename, 'w');
|
$fp = fopen($filename, 'w');
|
||||||
fwrite($fp, $xmlString);
|
fwrite($fp, $xmlString);
|
||||||
@@ -341,7 +342,41 @@ XML;
|
|||||||
|
|
||||||
private function _displaySitemap()
|
private function _displaySitemap()
|
||||||
{
|
{
|
||||||
if (file_exists(GSITEMAP_FILE) && filesize(GSITEMAP_FILE))
|
if (Shop::isFeatureActive())
|
||||||
|
{
|
||||||
|
$sql = 'SELECT s.id_shop, su.domain, su.domain_ssl, CONCAT(su.physical_uri, su.virtual_uri) as uri
|
||||||
|
FROM '._DB_PREFIX_.'shop s
|
||||||
|
INNER JOIN '._DB_PREFIX_.'shop_url su ON s.id_shop = su.id_shop AND su.main = 1
|
||||||
|
WHERE s.active = 1
|
||||||
|
AND s.deleted = 0
|
||||||
|
AND su.active = 1';
|
||||||
|
if (!$result = Db::getInstance()->executeS($sql))
|
||||||
|
return '';
|
||||||
|
|
||||||
|
$info = pathinfo(GSITEMAP_FILE);
|
||||||
|
foreach ($result as $shop)
|
||||||
|
{
|
||||||
|
$filename = $info['dirname'].'/'.$info['filename'].'-'.$shop['id_shop'].'.'.$info['extension'];
|
||||||
|
if (file_exists($filename) && filesize($filename))
|
||||||
|
{
|
||||||
|
$fp = fopen($filename, 'r');
|
||||||
|
$fstat = fstat($fp);
|
||||||
|
fclose($fp);
|
||||||
|
$xml = simplexml_load_file($filename);
|
||||||
|
|
||||||
|
$nbPages = count($xml->url);
|
||||||
|
|
||||||
|
$this->_html .= '<h2>'.$this->l('Sitemap for: ').$shop['domain'].$shop['uri'].'</h2>';
|
||||||
|
$this->_html .= '<p>'.$this->l('Your Google sitemap file is online at the following address:').'<br />
|
||||||
|
<a href="'.Tools::getShopDomain(true, true).__PS_BASE_URI__.$info['filename'].'-'.$shop['id_shop'].'.'.$info['extension'].'" target="_blank"><b>'.Tools::getShopDomain(true, true).__PS_BASE_URI__.$info['filename'].'-'.$shop['id_shop'].'.'.$info['extension'].'</b></a></p><br />';
|
||||||
|
|
||||||
|
$this->_html .= $this->l('Update:').' <b>'.utf8_encode(strftime('%A %d %B %Y %H:%M:%S',$fstat['mtime'])).'</b><br />';
|
||||||
|
$this->_html .= $this->l('Filesize:').' <b>'.number_format(($fstat['size']*.000001), 3).'MB</b><br />';
|
||||||
|
$this->_html .= $this->l('Indexed pages:').' <b>'.$nbPages.'</b><br /><br />';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif (file_exists(GSITEMAP_FILE) && filesize(GSITEMAP_FILE))
|
||||||
{
|
{
|
||||||
$fp = fopen(GSITEMAP_FILE, 'r');
|
$fp = fopen(GSITEMAP_FILE, 'r');
|
||||||
$fstat = fstat($fp);
|
$fstat = fstat($fp);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ $_MODULE['<{gsitemap}prestashop>gsitemap_5bbdad908e423585a7ecc6b61b66b313'] = 'I
|
|||||||
$_MODULE['<{gsitemap}prestashop>gsitemap_09fa1e865bdcf4d3215d5b0005b93154'] = 'le fichier sitemap.xml.';
|
$_MODULE['<{gsitemap}prestashop>gsitemap_09fa1e865bdcf4d3215d5b0005b93154'] = 'le fichier sitemap.xml.';
|
||||||
$_MODULE['<{gsitemap}prestashop>gsitemap_5a517cec50ac8e742f6583c6c404c4e9'] = 'Fichier Sitemap généré';
|
$_MODULE['<{gsitemap}prestashop>gsitemap_5a517cec50ac8e742f6583c6c404c4e9'] = 'Fichier Sitemap généré';
|
||||||
$_MODULE['<{gsitemap}prestashop>gsitemap_0a6ee1a4f10278211d74152e633d0ed0'] = 'Erreur durant la création du fichier sitemap';
|
$_MODULE['<{gsitemap}prestashop>gsitemap_0a6ee1a4f10278211d74152e633d0ed0'] = 'Erreur durant la création du fichier sitemap';
|
||||||
|
$_MODULE['<{gsitemap}prestashop>gsitemap_4851323bb81fbc4aa65c1b37af8a1d1d'] = 'Sitemap pour : ';
|
||||||
$_MODULE['<{gsitemap}prestashop>gsitemap_eb175747116b689caadea1b84202f513'] = 'Votre fichier Google sitemap est en ligne à l\'adresse suivante :';
|
$_MODULE['<{gsitemap}prestashop>gsitemap_eb175747116b689caadea1b84202f513'] = 'Votre fichier Google sitemap est en ligne à l\'adresse suivante :';
|
||||||
$_MODULE['<{gsitemap}prestashop>gsitemap_39d616ecc73e174052f1877ac2b3c853'] = 'Mise à jour';
|
$_MODULE['<{gsitemap}prestashop>gsitemap_39d616ecc73e174052f1877ac2b3c853'] = 'Mise à jour';
|
||||||
$_MODULE['<{gsitemap}prestashop>gsitemap_b908c2f34052b5276e0bf50f0e042211'] = 'Taille du fichier';
|
$_MODULE['<{gsitemap}prestashop>gsitemap_b908c2f34052b5276e0bf50f0e042211'] = 'Taille du fichier';
|
||||||
|
|||||||
Reference in new issue
Block a user