Magento 1.7.0.2在目录页面中悬停时更改产品图像

Ale*_*lex 0 magento magento-1.7

我想在鼠标悬停在目录页面中更改产品图像,您可以在此magento主题中看到:

http://www.ethemeuk.com/dresscode/index.php/women-10/club-dresses.html

谢谢,我等你的回复.

Ank*_*wal 7

如果要在鼠标上显示缩略图图像并在鼠标移出后显示小图像,请执行以下操作:

app->design->frontend->default->your theme->template->catalog->product->list.pthml 
Run Code Online (Sandbox Code Playgroud)

在此搜索此代码:

 <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>
Run Code Online (Sandbox Code Playgroud)

代替那个把这个代码: -

 <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')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" onmouseover="this.src='<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(135) ?>';" onmouseout="this.src='<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(135) ?>';" />
Run Code Online (Sandbox Code Playgroud)

现在,管理员为缩略图和小图像分配不同的图像.将鼠标悬停在产品图像上时,将显示缩略图图像.