Es ist bekannt, dass google nur 50000 URL in eine Datei lesen kann. Es wäre sinnvoll, wenn Shopware_Controllers_Frontend_SitemapXml eine Sitemap index-file erstellt. http://www.google.com/support/webmaster … swer=71453
So, ich habe die Klasse Shopware_Controllers_Frontend_SitemapXml erweitert, dass er über index.xml arbeiten kann. Aber funktioniert irgendwie RewriteRule nicht. Kann mir jemand helfen? RewriteRule categories\_(.\*).xml shopware.php?controller=GoogleSitemapXml&categories&p=$1 RewriteRule articles\_(.\*).xml shopware.php?controller=GoogleSitemapXml&articles&p=$1 RewriteRule googlesitemap.xml$ shopware.php?controller=GoogleSitemapXml
funzt einfach nicht - auch im logs keine Fehler. Die Klasse sieht so aus. Achtung - ich bin kein php-guru s. unten
in debugmode bekomme ich [19/Aug/2011:16:56:23 +0200] [www.xxx.com/sid#7fca6df08860][rid#7fca6e8355f0/initial] (2) [perdir /var/customers/webs/xxx/shopware/] rewrite 'googlesitemap.xml' -\> 'shopware.php?controller=GoogleSitemapXml' [19/Aug/2011:16:56:23 +0200] [www.xxx.com/sid#7fca6df08860][rid#7fca6e8355f0/initial] (3) split uri=shopware.php?controller=GoogleSitemapXml -\> uri=shopware.php, args=controller=GoogleSitemapXml
also Rule wird angewendet. Aber bekomme ich nur Startseite angezeigt.
hat keiner Ideen?
Hi, wofür braucht ein Bot eine SEO-Url? Kannst du dort nicht einfach die standard Urls verwenden? Dann muss auch die .htaccess-Datei auch nicht angepasst werden. Beispiel: shop/google_sitemap.xml?categories=1&p=1 shop/google_sitemap.xml?articles=1&p=1 shop/google_sitemap.xml Heiner
Danke. Jo, so kann man machen. Aber die Frage, warum rewrite nicht funkzioniert, blebt trozdem offen. wenn ich htaccess hier prüfe, ist es i.O. Ich bin ratlos.
[code]<?php /**
- Sitemap controller
- @link http://www.shopware.de
- @copyright Copyright © 2011, shopware AG
- @author Heiner Lohaus
- @package Shopware
-
@subpackage Controllers
/
class Shopware_Controllers_Frontend_GoogleSitemapXml extends Shopware_Controllers_Frontend_SitemapXml
{
var $MaxUrlsCount=50000;
/*-
Index action method
*/
public function indexAction()
{
echo „<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n“; $parentId = Shopware()->Shop()->get(‚parentID‘); $CountCategoryUrls=$this->getCountCategoryUrls($parentId); $CountArticleUrls=$this->getCountArticleUrls($parentId); $CountUrls=$CountCategoryUrls+CountArticleUrls; if(isset(_GET[‚p‘])){ indexSeite=_GET[‚p‘]; $min = ($indexSeite-1)*this-\>MaxUrlsCount; echo "<urlset xmlns='\"http://www.sitemaps.org/schemas/sitemap/0.9\"'>\r\n"; if(isset(GET[‚categories‘])){
$this->readCategoryUrls(parentId); }elseif(isset(GET[‚articles‘])){
$this->readArticleUrls($parentId,$min);
}else{
return;
}
echo „\r\n“; }else{ $this->CreateSitemapIndex($CountCategoryUrls,$CountArticleUrls); } } public function CreateSitemapIndex($CountCategoryUrls,$CountArticleUrls){ ob_start(‚ob_gzhandler‘); echo „\r\n“;
$i = 0;
do {
$k=$i/$this->MaxUrlsCount+1;
echo „\r\n“;
//echo „http://“.Shopware()->Shop()->getHost()."/categories$k.xml\r\n";
echo „http://“.Shopware()->Shop()->getHost()."/shopware.php?controller=GoogleSitemapXml&categories&p=$k\r\n";
//echo „2004-10-01T18:23:17+00:00\r\n“;
echo „\r\n“;
$i=$i+$this->MaxUrlsCount;
} while ($i < $CountCategoryUrls);
$i = 0;
do {
$k=$i/$this->MaxUrlsCount+1;
echo „\r\n“;
//echo „http://“.Shopware()->Shop()->getHost()."/articles$k.xml\r\n";
echo „http://“.Shopware()->Shop()->getHost()."/shopware.php?controller=GoogleSitemapXml&articles&p=$k\r\n";
//echo „2004-10-01T18:23:17+00:00\r\n“;
echo „\r\n“;
$i=$i+$this->MaxUrlsCount;
} while ($i < $CountArticleUrls);echo „\r\n“; ob_end_flush(); } /** * Return category urls count * * @param int $parentId */ public function getCountCategoryUrls($parentId){ $sql= " SELECT c.id, MAX(DATE(a.changetime)) as
lastmod
FROM s_categories c, s_articles_categories ac, s_articles a WHERE c.id=ac.categoryID AND a.id=ac.articleID AND a.active=1 AND c.parent!=1 AND c.external=’’ AND c.active=1 And c.parent=? GROUP BY ac.categoryID "; $result = Shopware()->Db()->query($sql, array($parentId)); if (!$result->rowCount()) { return; } $count=$result->rowCount(); while ($url = $result->fetch()){ $count+=$this->getCountCategoryUrls($url[‚id‘]); } return $count; } /** * Return article urls count * * @param int $parentId */ public function getCountArticleUrls($parentId){ $sql = " SELECT a.id FROM s_articles as a, s_articles_categories ac WHERE a.active=1 AND a.id = ac.articleID AND ac.categoryID=? "; $result = Shopware()->Db()->query($sql, array($parentId)); return $result->rowCount(); } /** * Read article urls * * @param int $parentId */ public function readArticleUrls($parentId,$min=’’) { $sql = " SELECT a.id, a.name as title, DATE( IF(a.changetime!=‚0000-00-00 00:00:00‘, a.changetime, IF(a.datum!=‚0000-00-00‘, a.datum, ‚‘)) ) as lastmod FROM s_articles as a, s_articles_categories ac WHERE a.active=1 AND a.id = ac.articleID AND ac.categoryID=? LIMIT $min, {$this->MaxUrlsCount} "; $result = Shopware()->Db()->query($sql, array($parentId)); if (!$result->rowCount()) { return; } while ($url = $result->fetch()) { $url[‚loc‘] = $this->Front()->Router()->assemble(array( ‚sViewport‘ => ‚detail‘, ‚sArticle‘ => $url[‚id‘], ‚title‘ => $url[‚title‘] )); $this->printArticleUrls($url); } } }[/code] Datei speichern als shopware/engine/Shopware/Controllers/Frontend/GoogleSitemapXml.php in Google-Webmastertools als sitemap /shopware.php?controller=GoogleSitemapXml eingeben
-
hallo miteinander wir haben die sitemap jetzt geteilt in kategorie und artikel. die artikel-datei hat nach wie vor über 50.000 einträge. gibt es eine möglichkeit die datei zu splitten? über parameter würde ja reichen… sitemap.xml?page=1 sitemap.xml?page=2 usw