0

在 Magento 中,有人知道如何限制在主产品图片下显示的缩略图数量吗?

这是可以通过管理员轻松控制的东西,还是我应该进入 media.phtml 并编辑 php?

 <div class="more-views">
      <ul>
      <?php foreach ($this->getGalleryImages() as $_image): ?>
        <li>
            <a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" title="<?php echo $_product->getName();?>" onclick="$('image').src = this.href; return false;">

                <img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(103, 103); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"/>
</a>
        </li>
    <?php endforeach; ?>
    </ul>
</div>
4

2 回答 2

1

最快的方法是

 <div class="more-views">
      <ul>
      <?php $limit = 5; ?>
      <?php $ct = 0; ?>
      <?php foreach ($this->getGalleryImages() as $_image): ?>
        <li>
            <a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" title="<?php echo $_product->getName();?>" onclick="$('image').src = this.href; return false;">
                <img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(103, 103); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"/>
            </a>
        </li>
      <?php
          if(++$ct >= $limit)
             break;
      ?>
    <?php endforeach; ?>
    </ul>
</div>
于 2013-04-12T19:39:39.013 回答
0

是的,您可以通过管理员轻松控制要在主产品图像下显示哪些图像,但您需要为所有产品单独设置。

只需转到添加/编辑产品的图像选项卡。单击您不想在图片库中显示的排除复选框,然后单击保存按钮。

于 2013-04-13T10:35:28.250 回答