3

我设法显示了每种产品的价格,但我无法显示每种产品的星级,这是一个单独的模板文件,我引用了原始 list.phtml 但有些地方不对劲,我只能假设我遗漏了一些东西:

<div class="category-products">
<div class="products-grid">

    <?php
    $_helper = Mage::helper('catalog/output');
    $categoryid = 26;
    $category = Mage::getModel('catalog/category');
    $category->load($categoryid);
    $collection = $category->getProductCollection();
    $collection->addAttributeToSelect('*');

    foreach ($collection as $_product) {
    ?>      
    <div class="item">          
        <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
        <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_product->getName(); ?></a></h2>
        <?php if($_product->getRatingSummary()): ?>
            <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
        <?php endif; ?>
        <?php
            $product_block = new Mage_Catalog_Block_Product;
            echo $product_block->getPriceHtml($_product);
        ?>
        <div class="actions">               
            <?php if($_product->isSaleable()): ?>
                <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
            <?php else: ?>
                <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
            <?php endif; ?>
        </div>
    </div>
<?php } ?>
</div>

getReviewsSummaryHtml() 没有显示星星...

4

0 回答 0