Page 1 of 1
Retrieve Single Latest Product for Blog Front Page
Posted: Wed Jun 20, 2012 2:47 am
by JhauraW
What's the best way to retrieve the latest product (desc, price, image) from OpenCart for display on our Wordpress blog front page?
I assume it's via RSS on the Product Feeds. If so, how can you pull just one single item from the feed without loading the whole thing? Is there a variable you can add at the end of the feed url?
Thank you.
Re: Retrieve Single Latest Product for Blog Front Page
Posted: Thu Jun 21, 2012 6:05 am
by Avvici
This is one post among many concerning Open Cart + Word Press
http://forum.opencart.com/viewtopic.php?t=3991
Re: Retrieve Single Latest Product for Blog Front Page
Posted: Thu Jun 21, 2012 6:34 am
by JhauraW
Hi avvici,
Thank you. I've read all those, but none address my question. Thanks anyway. I figured it out on my own.
I created a "Latest Items" feed that lets you limit the # of items returned. The use PHP SimpleXML to grab one item in Wordpress.
I've attached the feed file. To install in OC, simply FTP it into the /catalog/controller/feed/ directory.
Usage is:
SITEURL/index.php?route=feed/latest
Or optionally append &limit=int:
SITEURL/index.php?route=feed/latest&limit=1
Wish there was better WP integration and support from the community here...
Re: Retrieve Single Latest Product for Blog Front Page
Posted: Thu Jun 21, 2012 6:53 am
by Avvici
Nice one. Love SimpleXml

Re: Retrieve Single Latest Product for Blog Front Page
Posted: Wed Jul 25, 2012 3:22 am
by a2z
Hi, Thanks for the excellent mod. Is it possible to have the image included in the RSS?
Re: Retrieve Single Latest Product for Blog Front Page
Posted: Wed Jul 25, 2012 4:03 am
by JhauraW
Hi a2z. Yes it can. It already pulls all the related product info including images. However to show these items in a standard RSS reader, someone needs to reformat the xml tags from google base/shopping (the ones with g:) into standard rss 2.0 elements. I don't have time right now...sorry.
Re: Retrieve Single Latest Product for Blog Front Page
Posted: Wed Jul 25, 2012 6:53 am
by a2z
Thanks for the quick update. I will live with the feed as it is right now. I tried to change the tags myself, but with my knowledge of RSS feeds, it seemed impossible

.
If you ever get to update it with image tags, Please do post an update on this thread.