2

我刚刚联系了谷歌,询问为什么丰富的片段没有显示在他们的结果中,他们回答了以下问题

URL: http://www.theprinterdepo.com/hp-color-laser-4700dn-printer-q7493a-r
Markup Type: Product, Reviews

    Hidden content: <span itemprop="reviewCount">6</span>

我检查了 IE 开发工具,确实它是隐藏的,但它没有隐藏在我的 html 中,知道我做错了什么吗?

<?php if ($this->getReviewsCount()): ?>
    <div class="ratings">
        <?php if ($this->getRatingSummary()):?>
          <span itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
            <div class="rating-box">

                <div class="rating" style="width:<?php echo $this->getRatingSummary() ?>%"><meta itemprop="ratingValue" content="<?php echo $this->getRatingSummary()/10 ?>"/></div>
                <span itemprop="reviewCount"><?php echo $this->getReviewsCount() ?></span>
            </div>
          </span>
        <?php endif;?>
        <p class="rating-links">
            <a href="<?php echo $this->getReviewsUrl() ?>"><?php echo $this->__('%d Review(s)', $this->getReviewsCount()) ?></a>
            <!--<span class="separator">|</span>-->
            <!--<a href="<?php echo $this->getReviewsUrl() ?>#review-form"><?php echo $this->__('Add Your Review') ?></a>-->
        </p>
    </div>
<?php elseif ($this->getDisplayIfEmpty()): ?>
    <p class="no-rating"><a href="<?php echo $this->getReviewsUrl() ?>#review-form"><?php echo $this->__('Be the first to review this product') ?></a></p>
<?php endif; ?>
4

1 回答 1

3

当你读到这篇文章时,你会对自己很有趣。

你的问题是你的CSS。转到第 529 行的 /skin/frontend/default/MAG060062/css/styles.css 文件。问题出在您的.rating-box类上。

.rating-box {
    background: url("../images/bkg_rating.gif") repeat-x scroll 0 0 transparent;
    font-size: 0;
    height: 10px;
    line-height: 0;
    text-indent: -999em;
    width: 50px;
}

如下替换它

.rating-box {
    background: url("../images/bkg_rating.gif") repeat-x scroll 0 0 transparent;
    height: 10px;
    width: 50px;
}

更改删除

  • 字体大小:0;
  • 行高:0;
  • 文本缩进:-999em;

萤火虫截图

在此处输入图像描述

IE开发者工具

在此处输入图像描述

永远睁大你的眼睛。哈哈 :)

于 2012-11-05T21:32:38.777 回答