"Recent Reviews" block on Home page?

Permalink
I like this Add-on very much, but it would be nice if I could show "Recently Added Reviews" block on Home page.

Does anyone know how to make this block?

Tags:

View Replies:
MattWaters replied on at Permalink Reply
MattWaters
I'm thinking this would need to pull reviews from elsewhere on the site. Would it grab reviews from multiple blocks on other pages, or just one block on a different page?

I think that would be the challenging part, since (as currently written) the controller just pulls reviews from the current block. Printing out just 5 recent reviews could be done with a custom template-- that would be the easy part. So it may be possible with some custom development, but how much depends on exactly how complex a solution you need.
samurai replied on at Permalink Reply
I am trying to create some product pages with "Review" block, and each product page has a different "Review" block. So I would like to show "recent reviews" from multiple blocks on Home page.
ryan replied on at Permalink Reply
ryan
You'd have to query the database directly from your "recent reviews" block.

$db = Loader::db();
$nav = Loader::helper('navigation');
$query = "SELECT * FROM btReviewsEntries ORDER BY entryID DESC LIMIT 5";
$recent_reviews = $db->getAll($query);
foreach($recent_reviews as $rev) {
  echo $rev['comment_text']; // comment text, probably want to trim it
  echo $nav->getLinkToCollection(Page::getByID($rev['cID'])); // link to the page
}


-- that should get you started, it'll require writing a bit of code to make it work. See the btReviewsEntries table in your database for the fields that you'll have to work with.
ericchaffey replied on at Permalink Reply
What may get you off to a good start is modifying this addon:http://www.concrete5.org/marketplace/addons/recent-comments/...

Will take some tweaking if you use it or may provide you with a good starting point if you are going to build your own.

Good luck!