Update [28-May-2019] : I have developed an extension for Magento 2 platform, check it out Dw Rss Feed Reader for Magento 2
I have a blog using WordPress and a DecryptWeb Shop using Magento.
So I wanted to show latest feeds from my blog onto my shop, so that visitors can directly go to the post.
This article will explain how to do it.
Step 1
Create a file named latest_feeds.phtml in app/design/frontend/default/(your_theme)/template/callouts/
Create a PHP block that will fetch the feed and display it. I am using DecryptWeb feed for demonstration.
<?php try { $channel = new Zend_Feed_Rss('http://blog.decryptweb.com/rss2/'); $f = 1; } catch (Exception $e) { $e->getMessage(); $f =2; } ?> <?php if($f == 1): ?> <div class="block block-latest-feeds"> <div class="block-title"> <strong><span><?php echo $this->__('Blog RSS') ?></span></strong> </div> <div class="block-content"> <ol id="graybox-latest-feeds"> <?php $i=0; ?> <?php foreach ($channel as $item): ?> <?php $i++; ?> <li><strong><?php echo date('d.m.y',strtotime($item->pubDate)); ?></strong><a href="<?php echo $item->link; ?>" target="_blank"> <?php echo $item->title; ?></a></li> <?php if($i == 10) break; ?> <?php endforeach; ?> </ol> </div> </div> <?php endif; ?>
Note: I have used try catch block.
Step 2
Now we should decide where to place it depending on your design, I have placed it in left column.
Place it in app/design/frontend/default/(your_theme)/layout/catalog.xm for showing by default for whole catalog
<default> <reference name="left"> <block type="core/template" name="left_feeds" template="callouts/latest_feeds.phtml"/> </reference> </default>
Hope it is useful
Thanks this worked a treat!