【发布时间】:2017-03-20 08:40:50
【问题描述】:
我正在使用 magento 1.9.3,我想在主页上的猫头鹰轮播中显示特色产品。
我的模块块中有一个方法,它返回我想在轮播中显示的集合。我从我的模板中这样称呼它:
$_productCollection=$this->getFeaturedProducts();
我在堆栈溢出中发现了一个关于此的先前问题:Owl Carousel - Magento Products
按照上一个问题,我在模板中找到了这个问题:
<div class="owl-carousel">
<?
$products = $this->getFeaturedProducts();
foreach ($products as $_product) { // iterate through the entire collection
echo '<div class="item"><img src='.$this->helper('catalog/image')->init($_product, 'small_image')->keepFrame(false)->resize($_imgSize).'></div>'; // print the image url inside of the required Owl markup
}
?>
</div>
但是owl-carousel的div没有显示出来。如果我检查页面,div 在那里,里面也有图像,但什么都没有显示。如果我删除 owl-carousel 类,我会看到列表中显示的所有图像。
我从 magento connect 安装了扩展“响应式猫头鹰滑块”,并且我在页面顶部有另一个猫头鹰轮播,使用管理 cms 制作,显示图像幻灯片(不是产品),它工作正常。唯一失败的是我试图通过代码完成的那个。
我看到owl-carousel 类有一个display: none,所以显然没有显示任何内容,但是如果我删除display: none,它会同时显示所有图像,而不是轮播。
如何在 owl carousel 中展示我选择的产品?
【问题讨论】:
标签: magento magento-1.9 owl-carousel-2