lazy load all images

Hey,

I’ve installed the "Mgt Lazy Image Loader for Magento". ITs an awesome free module just needs some customisation. it asks to edit the file: "app/design/frontend/default/default/catalog/product/list.phtml"

and replace

HTML Code:

<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resi-
ze(135); ?>"
width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product,
'small_image'), null, true) ?>" />

with
HTML Code:

<img class="lazy" src="<?php echo
$this->getSkinUrl('images/mgt_lazy_image_loader/loader.gif'); ?>" data-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) ?>" />

Where is the equivalent code in this template?

3 answers

Profile photo of Sherlock 0.00 $tone March 12, 2014
Public

In this theme, you can open the app\design\frontend\default\jm_hawkstoretemplate\ catalog\product\list.phtml file to replace the followings:

HTML Code:

 <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($productlistimagewidth,$productlistimageheight); ?>" width="<?php echo $productlistimagewidth; ?>" height="<?php echo $productlistimageheight; ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

and

HTML Code:

 <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($productgridimagewidth,$productgridimageheight); ?>" width="<?php echo $productgridimagewidth; ?>" height="<?php echo $productgridimageheight; ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

with code you mentioned. Hope it helps.

#1
Profile photo of Paul k 0.00 $tone March 12, 2014
Public

Thanks Sherlock,

I now have lots of loading bars, nut I think the JS is not being added for some reason, is there something I should have changed?

#2

Please login or Register to Submit Answer

Written By

Comments