1

please visit this link :

http://kidsdial.com/chair.html, you can see there is a zoom option on the products images

if we upload smaller images as like here :

http://kidsdial.com/microsoft-wireless-optical-mouse-5061.html

the product image is not zooming properly.

so i want to hide the zooming option for images with less than 400 * 400 pixels.

media.phtml => this may be the code for this : http://pastebin.com/gAwfdtw7

please help me to find solution.

thanks in advance.

asked Jan 8, 2015 at 6:19
5
  • 1
    Well that's a massive zoom isn't it. I don't see how it's related to Magento, you can solve either by JS by measuring the picture and hiding the magnifier icon, or you could simply edit the template and not write the html for the magnifier when the width of the image is < 400px. Commented Jan 8, 2015 at 10:35
  • hi, thanks a lot for reply. can you give me some idea about on which file i have to edit if i want to get solution by js.... thanks a lot in advance. Commented Jan 8, 2015 at 10:39
  • 1
    I'd go for the "modify your .phtml" solution, less painful. It should be in /template/catalog/product/view/media.phtml unless you're using an extension to display the product images in which case it should stand in its respective folder. Commented Jan 8, 2015 at 10:41
  • please check media.phtml file = pastebin.com/gAwfdtw7 and help me. Commented Jan 8, 2015 at 10:56
  • 1
    really? ok I'll put it as an answer. Commented Jan 8, 2015 at 12:58

1 Answer 1

1

Given your code pastebin.com/gAwfdtw7, here's what I'd do on line 59 :

replace

<a id="zoom-btn" rel="lightbox[em_lightbox]" href="<?php echo $this->helper('catalog/image')->init($_product, 'image') ?>" title="<?php echo $this->escapeHtml($this->getImageLabel());?>">Zoom</a>

with

<?php if($w < 400 && $h < 400): ?>
 <a id="zoom-btn" rel="lightbox[em_lightbox]" href="<?php echo $this->helper('catalog/image')->init($_product, 'image') ?>" title="<?php echo $this->escapeHtml($this->getImageLabel());?>">Zoom</a>
<?php endif; ?>

If you read the code you give me, you'll see that $w is the width of the image and $h is its height.

Hope this helps.

answered Jan 8, 2015 at 13:01
6
  • hi, thanks a lot for reply. i followed your changes, but it's displaying like this : kidsdial.com/microsoft-wireless-optical-mouse-5062.html image is not properly zooming.[394 * 334 ] is the image size. so i want to hide the zooming. is there anything else i have to do for this..?... please help me to find solution. thanks in advance Commented Jan 9, 2015 at 4:44
  • 1
    mmm :/ can you edit your question with the bit of code modified? Commented Jan 9, 2015 at 8:18
  • hi, please visit this : pastebin.com/stapPArp please check line number : 60, 61 , 62 i changed only three lines. please tell me what else changes i have to do..?... or can you please reedit the entire code and post here.... thanks in advance Commented Jan 9, 2015 at 9:15
  • 1
    just dump the values of $w and $h and see what's wrong. Commented Jan 9, 2015 at 9:20
  • hi, i changed like this : <?php if($w < 100000 && $h < 100000): ?> <a id="zoom-btn" rel="lightbox[em_lightbox]" href="<?php echo $this->helper('catalog/image')->init($_product, 'image') ?>" title="<?php echo $this->escapeHtml($this->getImageLabel());?>">Zoom</a> <?php endif; ?> but zooming option is still there less pixels. what else i have to do..?... Commented Jan 9, 2015 at 9:26

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.