View Full Version : How To Change Image On Hover

05-28-2011, 04:18 PM

I am struggling a little in finding a way to implement a change image on hover, basically changing to same image with a different colour.

I have modified the base code of the magento 'Add to Cart' button, to display "Pre Order" button if inventory amount is 0 or below.

I would like it to be similar to the top right images that change on hover, and have tried to implement this with no success.

EDIT : http://www.gadgetfreakz.co.uk Is the website.

The code is:
<?php if($_product->isSaleable()): ?>
<a href="#" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><img src="<?PHP
$str = $this->getSkinUrl('images/btn_add_to_cart.gif');
$stre = $this->getSkinUrl('images/pre-order.gif');
if ($_product->isConfigurable())
{print "$str";} ?>

<?PHP if ((int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()> 0)
{print "$str";
{print "$stre";}?>" alt="<?php echo $this->__('Add to Cart') ?>" title="<?php echo $this->__('Add to Cart') ?>";}?>
<?php else: ?>

<div class="out-of-stock"><?php echo $this->__('Out of stock') ?>

Thank you for any help you can give,