magento 1.9 - modify sitemap generatexml -


i looking limit product pages sitemap.xml file.

i have extended mage_sitemap_model_sitemap class , rewrote generatexml() function, using magento ce 1.9.0.1

i have modified

 $collection = mage::getresourcemodel('sitemap/catalog_product')->getcollection($storeid); 

to this

$collection = mage::getmodel('catalog/product')->getcollection($storeid)->addattributetofilter('visibility', 4); 

yet when sitemap generated, provides $baseurl in outputted sitemap.

is there missing? code below.......

/** * generate products sitemap */ $changefreq = (string)mage::getstoreconfig('sitemap/product/changefreq'); $priority = (string)mage::getstoreconfig('sitemap/product/priority');  $collection = mage::getmodel('catalog/product')->getcollection($storeid)->addattributetofilter('visibility', 4);  foreach ($collection $item) { $xml = sprintf( '<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseurl.$item->geturl()), $date, $changefreq, $priority );  $this->sitemapfileaddline($xml); 


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -