Hello.
I am working on a custom generateXml() function and have run into a road block.
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 the sitemap is generated, it only provides the $baseURL in the outputted sitemap.
Is there something I am missing? Complete code is 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 as $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);
Steve