-
13-12-2019 - |
题
我在主页上添加了最畅销的链接 https://blog.amasty.com/how-to-display-best sell-products-in-magento-source-code/但它不响应,我想让它响应,以便畅销块中的产品不会隐藏在水平滚动条(底部)中
解决方案
我通过在我的 css 文件中添加以下代码得到了答案
float:left
其他提示
您可以使用响应式轮播
http://owlgraphic.com/owlcarousel/
http://owlgraphic.com/owlcarousel/#demo
<?php $_productCollection=$this->getLoadedProductCollection();?>
<?php if ($_productCollection>count()): ?>
<div class="owl-carousel-wrapper">
<div class="owl-carousel" id="home-product-slider">
<?php foreach ($_productCollection as $_product): ?>
<div class="item">
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
<?php echo $this->getPriceHtml($_product, true) ?>
</div>
<?php endforeach; ?>
</div>
</div>
<script>
jQuery(document).ready(function() {
var owl = jQuery("#home-product-slider");
owl.owlCarousel({
responsiveClass: true,
});
});
</script>
<?php endif; ?>