SJL Web Design

Add RSS Feed to Magento

More and more retailers are using blogs and RSS feeds to help expand their business’s online presence. However Magento, the world’s leading open source eCommerce package doesn’t offer out of the box blog management, so many Magento shop owners are turning to other open-source software like WordPress to help meet their blogging demands. This leaves one thing uncovered, how to display these latest blog posts on a Magento shop homepage to help keep things fresh for SEO.

Create RSS Block

Lets create a block that we will call from the homepage in the Magento admin area. To do this we will need to create a file called rss_feed.phtml and save it to the following directory app/design/frontend/default/your-theme/template/callouts/rss_feed.phtml

Inside this document we will add the following code to call the RSS content, remember to replace the example feed url with your own:


<?php $channel = new Zend_Feed_Rss('http://feeds.feedburner.com/sjlwebdesign'); ?>
<div class="block block-rss">
<div class="block-title">
<h2><?php echo $this->__('Latest News') ?></h2>
</div>
<div class="block-content">
<ol id="graybox-latest-news">
<?php foreach ($channel as $item): ?>
<li><a href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a></li>
<?php endforeach; ?>
</ol>
</div>
</div>

Reference RSS Block from Admin

Now we just need to call this new block from the homepage’s CMS section in the Magento admin by logging into the store and going to CMS > Manage Pages > Stores Homepage.

From here we need to click the ‘Custom Layout’ tab from the left column and add the following code to the ‘Layout Update XML’ section:


<reference name="right">
<block type="core/template" name="right.homepage.rss" template="callouts/rss_feed.phtml"/>
</reference>

1 Response to “Add RSS Feed to Magento”

Tim Says:

Message Thank you very much I have tested this on one of my sites and is was really simple to implement, Now for some styling.

Once again thank you

Leave a Reply