【问题标题】:Magento 1.9.3 Display alternative image on hover on category pageMagento 1.9.3 在类别页面上悬停时显示替代图像
【发布时间】:2017-04-09 09:54:34
【问题描述】:

我想通过在产品信息 -> 图像中分配来在类别页面上悬停时显示替代图像。我创建了一个属性 hover_image,其参数为 Scope-Global、Catalog Input Type-Media Image、Apply to All Product Types。将属性添加到集合中。接下来我该怎么办?谢谢

【问题讨论】:

    标签: image magento hover categories


    【解决方案1】:

    在类别页面上显示替代悬停图像。您需要在您当前的主题template/catalog/product/list.phtml 中更改产品列表模板。

    因为您已经创建了媒体类型属性“hover_image”。所以你需要像下面这样获取hover_image类型的图片:

    <a href="<?php echo $_product->getProductUrl() ?>" class="hover-image" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'hover_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'hover_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'hover_image'), null, true) ?>" /></a>
    

    现在您需要使用 javascript 对产品图像应用悬停效果,以隐藏原始图像并显示悬停图像。

    【讨论】:

      猜你喜欢
      • 2013-11-20
      • 1970-01-01
      • 2015-05-07
      • 2012-03-08
      • 1970-01-01
      • 2020-07-22
      • 1970-01-01
      • 1970-01-01
      • 2017-02-09
      相关资源
      最近更新 更多