Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Show 2 images on list.phtml page? 
 
hazardpro
Member
 
Avatar
Total Posts:  53
Joined:  2008-10-09
 

Hi all, Im no programmer and wondered if someone clever could tell me how to achieve this:

On my list.phtml page I have:

<div class="product-image" style="margin-right:10px;">
            <
a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
                <
img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135); ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />
            </
a>
        </
div>

This displays a ‘small_image’ for that product, now all of my products have at least 2 images and I would like it to display the first 2 images.

So I have simply duplicated the code above so I have:

<div class="product-image" style="margin-right:10px;">
            <
a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
                <
img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135); ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />
            </
a>
        </
div>

<
div class="product-image" style="margin-right:10px;">
            <
a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
                <
img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135); ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />
            </
a>
        </
div>

What I cant work out is how to tell it to show the first 2 images for that product (at the moment is it just showing the same picture twice).

Any help would be gratefully received!!!!! grin

Many thanks

H.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hazardpro
Member
 
Avatar
Total Posts:  53
Joined:  2008-10-09
 

Bump, anyone.... please?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nico5
Sr. Member
 
Avatar
Total Posts:  214
Joined:  2008-02-19
France
 

Try to put
base_image
instead of
small_image
in the second <div>

 
Magento Community Magento Community
Magento Community
Magento Community
 
joey santiago
Sr. Member
 
Total Posts:  76
Joined:  2009-02-25
 

hello!

did you manage to display two different images? i’m stucking on this… smile

thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top