有的时候,我们想把产品评论部分改到产品详细页面,改了后,在分类页面的产品下面显示一段产品的评论个数和评分,这里需要修改一下url

修改的方法为:

1.

app\design\frontend\maishen\mgfocal\template\review\helper\summary.phtml

文件内容改为:

  <div class="ratings">
        
            <div class="rating-box">
                <div class="rating" style="width:<?php echo $this->getRatingSummary() ?>%"></div>
            </div>
      
        <p class="rating-links">
            <a href="#customer-reviews"><?php echo $this->__('%d Review(s)', $this->getReviewsCount()) ?></a>
            <span class="separator">|</span>
            <a href="#customer-reviews"><?php echo $this->__('Add Your Review') ?></a>
        </p>
    </div>

 

app\design\frontend\maishen\mgfocal\template\review\helper\summary_short.phtml

文件内容改为:

   <div class="ratings">
        
            <div class="rating-box">
                <div class="rating" style="width:<?php echo $this->getRatingSummary() ?>%"></div>
            </div>
        
        <span class="amount"><a href="<?php echo $this->getReviewsUrl() ?>#customer-reviews"><?php echo $this->__('%d Review(s)', $this->getReviewsCount()) ?></a></span>
    </div>

 

2.找到文件:app\code\core\Mage\Review\Block\Helper.php , 将函数getReviewsUrl内容改为下面的

 public function getReviewsUrl()
    {
        $suffixss = Mage::helper('catalog/product')->getProductUrlSuffix();
        $proreviewurl = $this->getProduct()->getUrlKey().$suffixss;
        return Mage::getUrl($proreviewurl);
          
         
    }

得到产品页面url的后缀的代码为:  $suffixss = Mage::helper('catalog/product')->getProductUrlSuffix();

3

在产品详细页面的评论部分的div的id设置为customer-reviews。

OK。搞定!