我正在尝试在单击时(在产品页面下)切换带有缩略图的基本图像。由于某种原因,我根本无法正常工作。这是创建缩略图的代码:
<?php if (count($this->getGalleryImages()) > 0): ?>
<div class="desktop more-views">
<ul class="product-image-thumbs">
<?php $i=0; foreach ($this->getGalleryImages() as $_image): ?>
<?php if ($this->isGalleryImageVisible($_image)): ?>
<li>
<a class="thumb-link" href="#" title="<?php echo $this->escapeHtml($_image->getLabel()) ?>" data-image-index="<?php echo $i; ?>">
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(),'thumbnail',$_image->getFile())->resize(75); ?>"
width="75" height="75" alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" />
</a>
</li>
<?php endif; ?>
<?php $i++; endforeach; ?>
</ul>
</div>
<?php endif; ?>
这是我的JS代码(位于文件MY_THEME / skin / frontend / rwd / default / js / app.js中),用于切换实际图像:
wireThumbnails: function() {
//trigger image change event on thumbnail click
$j('.product-image-thumbs .thumb-link').click(function(e) {
e.preventDefault();
var jlink = $j(this);
var target = $j('#image-' + jlink.data('image-index'));
ProductMediaManager.swapImage(target);
});
}
有人知道我在做什么错吗?我已遵循this链接上的解决方案,但是它们不起作用!我想对此发表评论,但我没有足够的声誉! :(任何帮助将不胜感激!
编辑:以下是控制台上显示的错误:
每次我单击缩略图时,都会一次又一次出现最近的错误...