Php Magento检查审阅状态,然后打印
我有以下代码来获得所有的评论。这是可行的,但问题是它也在打印待处理的评论。它应该只打印那些被批准的Php Magento检查审阅状态,然后打印,php,magento,Php,Magento,我有以下代码来获得所有的评论。这是可行的,但问题是它也在打印待处理的评论。它应该只打印那些被批准的 $review = Mage::getModel('review/review'); $collection = $review->getProductCollection(); $collection ->addAttributeToSelect('*') ->get
$review = Mage::getModel('review/review');
$collection = $review->getProductCollection();
$collection
->addAttributeToSelect('*')
->getSelect()
->limit($limitertest)
->order('RAND()');
$review->appendSummary($collection);
echo '<ul class="testimony_slider">';
foreach($collection as $product) {
echo '<li>';
echo '<div class="testi_left">';
echo '<img src='.Mage::helper('catalog/image')->init($product, 'small_image')->resize(100).'>';
echo '</div>';
echo '<div class="testi_right">';
echo '<p class="testti_summery">"'.$product->getTitle().'"</p>';
echo '<p class="testti_nickname">'.$product->getNickname().'</p>';
echo '</div>';
echo '<div class="clear_both"></div>';
echo '</li>';
}
echo '</ul>';
$review=Mage::getModel('review/review');
$collection=$review->getProductCollection();
$collection
->addAttributeToSelect(“*”)
->getSelect()
->限额($limitertest)
->顺序('RAND()');
$review->appendSummary($collection);
echo'”;
foreach($收集为$产品){
回音“- ”;
回声';
echo'init($product,'small_image')->调整大小(100)。'>;
回声';
回声';
echo“
”。$product->getTitle()”
;
echo'。$product->get昵称()。
;
回声';
回声';
回音“ ”;
}
回声“
”;
您可能需要重构代码以获得评论集合,然后按已批准的状态进行筛选。大概是这样的:
$reviews = Mage::getModel('review/review')->getResourceCollection();
$reviews->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED);
我所需要的就是:->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED);