Php magento的最新顶级产品-can';我得不到价格
我用了一点PHP来浏览那些排名靠前的产品,但是我似乎无法拿出评论或价格Php magento的最新顶级产品-can';我得不到价格,php,magento,review,Php,Magento,Review,我用了一点PHP来浏览那些排名靠前的产品,但是我似乎无法拿出评论或价格 <?php $_productCollection = Mage::getResourceModel('reports/product_collection')->addAttributeToSelect('*')->setVisibility(array(2,3,4)); $_productCollection->joinField
<?php
$_productCollection = Mage::getResourceModel('reports/product_collection')->addAttributeToSelect('*')->setVisibility(array(2,3,4));
$_productCollection->joinField('rating_summary', 'review/review_aggregate', 'rating_summary', 'entity_pk_value=entity_id', array('entity_type' => 1, 'store_id' => Mage::app()->getStore()->getId()), 'left');
$_productCollection->setOrder('rating_summary', 'desc');
$_productCollection->setPage(1, 5);
?>
<ul id="upsell-product-table">
<?php foreach($_productCollection as $_product) : ?>
<li class="item">
<a href="<?php echo $_product->getProductUrl(); ?>">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail'); ?>">
<h3 class="product-name"><?php echo $_product->getName(); ?></h3>
<?php if($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product) ?>
<?php endif; ?>
<?php echo $this->getPriceHtml($_product, true ); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
-
这是我的代码,但正如您所看到的:
<?php echo $this->getPriceHtml($_product, true ); ?>
没有拿出价格,我有点卡住了。任何帮助都很好。请检查此代码,而不是您的getPriceHtml($\u product,true);?>
希望它能对您有所帮助。在块或布局中,您是否为该价格的html添加了块?忘了提及,它在“最近查看的模板”中正常工作,但我将其输入到类别登录页的自定义模板中。我想我可以在模板上发布整个内容…<它就在这里,你怎么称呼这个模板?请分享详细信息。抱歉在cat页面上这样称呼它:page/cat-lander.phtml似乎破坏了布局,添加到phtml文件后不会加载任何内容。
<?php echo Mage::getBlockSingleton('catalog/product')->getPriceHtml($_product, true); ?>