Magento jQuery lightbox从更多视图调用所有拇指
目前我正在使用MagePsycho jquery lightbox的扩展。这个扩展正在前端调用所有缩略图并显示为“更多视图”缩略图,我想限制它们。media.phtml中的代码是:Magento jQuery lightbox从更多视图调用所有拇指,magento,lightbox,Magento,Lightbox,目前我正在使用MagePsycho jquery lightbox的扩展。这个扩展正在前端调用所有缩略图并显示为“更多视图”缩略图,我想限制它们。media.phtml中的代码是: `<div class="more-views"> <h2><?php echo $helper->getConfig('more_views_label') ?></h2> <ul> <?php foreach ($this->getGa
`<div class="more-views">
<h2><?php echo $helper->getConfig('more_views_label') ?></h2>
<ul>
<?php foreach ($this->getGalleryImages() as $_image):
if(empty($popUpImageSize[0]) || empty($popUpImageSize[0])):
$popUpImage = $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile());
else:
$popUpImage = $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile())->resize($popUpImageSize[0], $popUpImageSize[1]);
endif;
?>
<li>
<a href="<?php echo $popUpImage; ?>" rel="<?php echo $rel; ?>" class="<?php echo $class; ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize($thumbnailSize[0], $thumbnailSize[1]); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
</li>
<?php endforeach; ?>
</ul>
`
-
`
并附上描述问题的图像。谢谢看来您已经掌握了所需的所有信息 每个图像上都有一个循环
<?php foreach ($this->getGalleryImages() as $_image):
//output thumbnail code snipped
<?php endforeach; ?>
您只想循环四次,而不是循环每个项目。有很多不同的方法来实现这一点。这里有一个使用sentinel值
<?php $c = 0; ?> //define a counter
<?php foreach ($this->getGalleryImages() as $_image):
//output thumbnail code snipped
<?php if($c > 3) { break; } ?> //break if we've looped four times
<?php $c++?> //increment the counter
<?php endforeach; ?>
//定义一个计数器
//如果我们打了四圈,就要休息
//递增计数器
调试图片非常困难。你介意添加你的JS吗?