Magento Notes — Customizing the RSS Feed that Magento Outputs

One of the marketing strategy employed by many e-commerce sits is to provide product feeds (RSS) to have them be displayed in an affiliate or partner blog or content-driven web sites.  I’ve recently came across this need to do just that and what I have found is that the default Magento RSS feed is clunky and display the entire product description as part of the feed items.  The way to customize the output is go to into the following file (NOTE: this workaround requires modify Magento core file, which may become a hassle and you update your Magento installation):

\app\code\core\Mage\Rss\Block\Catalog\

under the above folder, you will see different files (category.php, new.php, tag.php, etc.) each file controls the output of each type of RSS feed Magento has built in by default. So if you want to modify the RSS feed format for your products in a certain category you would modify the category.php file. For me, i was looking at syndicating my new products, so I modified new.php file.

When opening up the new.php file, scroll down to approximately line 99-104, under the public function addNewItemXmlCallback($args) is where the RSS feed content is formatted, so you can simply move around the html table and or select to replace the product description with the short description, etc.  For me, I simply removed the long description and kept the pricing, product image and the product title. Below is my revised output code snippet:

$description = ‘<table><tr>’.
‘<td><a href=”‘.$product->getProductUrl().’”><img src=”‘. $this->helper(‘catalog/image’)->init($product, ‘thumbnail’)->resize(75, 75) .’” border=”0″ align=”left” height=”75″ width=”75″></a><br>Price:’.Mage::helper(‘core’)->currency($product->getPrice()).
($product->getPrice() != $final_price  ? ‘ Special Price:’. Mage::helper(‘core’)->currency($final_price) : ”).
‘</td>’.
‘</tr></table>’;

and the output looks like the following when it gets syndicated to a content driven site, you see the RSS feed of the products at the right side of the screen:

http://links.chosen29.com - this is a PLIGG-driven bookmarking web site similar to Digg.com

http://links.chosen29.com - this is a PLIGG-driven bookmarking web site similar to Digg.com

The RSS feed from Magento is fed through Google’s Feedburner and then syndicated thereafter, primarily for the purpose of better exposure and trackability.

Lastly, here’s a shameless plug, please visit my new web site at Chosen29.com