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.

  • 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. – Julien Lachal Jan 8 '15 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. – Baby in Magento Jan 8 '15 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. – Julien Lachal Jan 8 '15 at 10:41
  • please check media.phtml file = pastebin.com/gAwfdtw7 and help me. – Baby in Magento Jan 8 '15 at 10:56
  • 1
    really? ok I'll put it as an answer. – Julien Lachal Jan 8 '15 at 12:58
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.

  • 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 – Baby in Magento Jan 9 '15 at 4:44
  • 1
    mmm :/ can you edit your question with the bit of code modified? – Julien Lachal Jan 9 '15 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 – Baby in Magento Jan 9 '15 at 9:15
  • 1
    just dump the values of $w and $h and see what's wrong. – Julien Lachal Jan 9 '15 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..?... – Baby in Magento Jan 9 '15 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.