How to generate a sitemap.xml with image in Magento

This is good for SEO if product images include in the sitemap.xml file. We have implemented to add images URL in Magento sitemap.xml file.

file path : app/code/core/Mage/Sitemap/Model/Sitemap.php

Replace this code with existing code.

/**
* Generate products sitemap
*/
$changefreq = (string)Mage::getStoreConfig('sitemap/product/changefreq', $storeId);
$priority = (string)Mage::getStoreConfig('sitemap/product/priority', $storeId);
$collection = Mage::getResourceModel('sitemap/catalog_product')->getCollection($storeId);
$products = new Varien_Object();
$products->setItems($collection);
Mage::dispatchEvent('sitemap_products_generating_before', array(
'collection' => $products
));
foreach ($products->getItems() as $item) {
$image = Mage::getModel('catalog/product')->load($item->getId())->image;
$img = Mage::getModel('catalog/product')->load($item->getId())->getImageUrl();
$xml = sprintf(
'<url><loc>%s</loc><image:image><image:loc>%s</image:loc></image:image><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>',
htmlspecialchars($baseUrl . $item->getUrl()),
htmlspecialchars($baseUrl."media/catalog/product" . $image),
$date,
$changefreq,
$priority
);
$io->streamWrite($xml);
}
unset($collection);

How to run php5 extension file on XAMPP with PHP

On my website I’ve got files with extension PHP and with extension PHP5. When I have run this file on the XAMPP server then this file shows all page code but not running on the browser.

If you want to run this kind of project on XAMPP then do this according to the blog

//Follow the path c:/xampp/apache/conf/extra/httpd-xammp
Open httpd-xammp

Find the area of the text that resembles this:

<FilesMatch ".php$">
SetHandler application/x-httpd-php
<FilesMatch ".phps$">
SetHandler application/x-httpd-php-source

replace the top line of the code with the following:

<FilesMatch ".php$|.php5$|.php4$|.php3$|.phtml$|.phpt$">

so the text resembles the following:

<FilesMatch ".php$|.php5$|.php4$|.php3$|.phtml$|.phpt$">
SetHandler application/x-httpd-php

<FilesMatch ".phps$">
SetHandler application/x-httpd-php-source