Skip to content

Instantly share code, notes, and snippets.

@dimsemenov
Last active December 18, 2015 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimsemenov/5845535 to your computer and use it in GitHub Desktop.
Save dimsemenov/5845535 to your computer and use it in GitHub Desktop.
<?php
$collection = Mage::getModel('review/review')->getCollection()
->addStoreFilter(Mage::app()->getStore()->getId())
->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
->setDateOrder();
$collection->getSelect()
->join(array('attr' => 'catalog_product_entity_int'), 'attr.entity_id = main_table.entity_pk_value', array('*'))
->where('attr.attribute_id = 136')
->where('attr.value = 11')
->limit(5);
?>
<ol>
<?php
foreach($collection as $review) {
$review_data = $review->getData();
$product = Mage::getModel('catalog/product')->load( $review_data['entity_pk_value'] );
?>
<li>
<h4>Review of: <?php echo $product->getName() ?></h4>
<p><?php echo $review_data['detail']; ?></p>
</li>
<?php
}
?>
</ol>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment