How to add RSS Feed to Magento
More and more retailers are using blogs and RSS feeds to help expand their businesses 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/yourtheme/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:
1 2 3 4 5 6 7 8 9 10 11 12 13
<?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 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:
1 2 3
<reference name="right"> <block type="core/template" name="right.homepage.rss" template="callouts/rss_feed.phtml"/> </reference>