Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

First detailed image instead of thumbnail

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 07-30-2005, 11:43 PM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default First detailed image instead of thumbnail

Ever wanted to replace the thumbnail on the product page with the first image from your detailed images and then have your detailed images section start with the second detailed image?

Well here is how to do it

This code is for the 4.0 branch (the version for 3.4 and 3.5 is very similar)

You need to modify two files:
customer/product.tpl
modules/detailed_product_images/product_images.tpl

You will also need to make a new file:
modules/detailed_product_images/product_images_one.tpl

In product.tpl
find this:
Code:
<TD valign="top" align="left" rowspan="2" width="100"> {include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.image_x image_y=$product.image_y product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail"} </TD>

replace with this:
Code:
{***----ORIGINAL THUMBNAIL---- <TD valign="top" align="left" rowspan="2" width="100"> {include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.image_x image_y=$product.image_y product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail"} </TD> ----ORIGINAL THUMBNAIL----***} {***--FIRST DETAILED IMAGE--***} <td valign="top" align="left" rowspan="2" width="100"> {if $active_modules.Detailed_Product_Images ne ""} {include file="modules/Detailed_Product_Images/product_images_one.tpl" } {/if} </td> {***--FIRST DETAILED IMAGE--***}


Then in product_images.tpl
find this:
Code:
<img src="{$images[image].tmbn_url}">

Replace with this:
Code:
{***----ORIGINAL CODE------- <img src="{$images[image].tmbn_url}" alt="{$images[image].alt|escape}"> --------ORIGINAL CODE***} {***--Startwithsecondimage---***} {if $images[image].tmbn_url ne $images[0].tmbn_url } <img src="{$images[image].tmbn_url}" alt="{$images[image].alt|escape}"> {/if} {***--Startwithsecondimage---***}


Make a new file in modules/detailed_product_images called product_images_one.tpl

Put this code in it:
Code:
{* $Id: product_images_one.tpl,v 1.7.2.2 2005/07/29 10:43:25 CCS Exp $ *} {if $images ne ""} <div align=left> {section name=image} {if $images[image].avail eq "Y"} {if $images[image].tmbn_url} <img src="{$images[image].tmbn_url}" alt="{$images[image].alt|escape}"> {else} <img src="{$xcart_web_dir}/product_image.php?imageid={$images[image].imageid}" alt="{$images[image].alt|escape}"> {/if} {/if} {/section} </div> {/if}

That's it
Reply With Quote
  #2  
Old 07-31-2005, 01:30 AM
 
slade slade is offline
 

Advanced Member
  
Join Date: Jun 2005
Location: new zealand
Posts: 64
 

Default

hi light speed um could u give us an example of the mod or give us a link to your site that shows an example of this mod that would be great
__________________
www.supremeroofing.co.nz
Reply With Quote
  #3  
Old 07-31-2005, 05:16 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Don't really need an example, it does just what it says Nice one...moving it to Custom Mods.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #4  
Old 07-31-2005, 08:26 AM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default

Quote:
Originally Posted by slade
hi light speed um could u give us an example of the mod or give us a link to your site that shows an example of this mod that would be great

Yeah it's pretty straight forward

I have boomers cart-lab tabbed mod installed also and you can see my little mod works fine with that
Reply With Quote
  #5  
Old 08-02-2005, 02:38 AM
 
slade slade is offline
 

Advanced Member
  
Join Date: Jun 2005
Location: new zealand
Posts: 64
 

Default lol

oh cool nice mod sorry for my dumbness
__________________
www.supremeroofing.co.nz
Reply With Quote
  #6  
Old 08-02-2005, 09:55 AM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default

Thanks!
Reply With Quote
  #7  
Old 08-03-2005, 03:02 AM
  Dongan's Avatar 
Dongan Dongan is offline
 

X-Wizard
  
Join Date: Jul 2005
Location: www.mercuryminds.com
Posts: 1,531
 

Default

Hey,

Really cool mod and was looking for a long time and you saved my time a lot..

cheers !!!!!
Reply With Quote
  #8  
Old 08-03-2005, 09:19 AM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default

Glad to help!
Reply With Quote
  #9  
Old 08-17-2005, 04:22 PM
 
mortickles mortickles is offline
 

Newbie
  
Join Date: Aug 2005
Posts: 6
 

Default Love it!

Works great! Does anyone know how this could be modified so the "detailed images" box only shows up if there are more than one detailed image? I have lots of products with only one image, and I now have one detailed image on top (nice) but a big old empty dialog box at the bottom. Looks like there is something missing.

Thanks again for the great mod!
__________________
x-cart 4.0.14
Reply With Quote
  #10  
Old 08-17-2005, 06:40 PM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default Re: Love it!

Quote:
Originally Posted by mortickles
Works great! Does anyone know how this could be modified so the "detailed images" box only shows up if there are more than one detailed image? I have lots of products with only one image, and I now have one detailed image on top (nice) but a big old empty dialog box at the bottom. Looks like there is something missing.

Thanks again for the great mod!

There is probably a way to set an if statement at the detail dialog insert but I am too swamped to look into it. Maybe somebody else can take a stab at it?
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:43 PM.

   

 
X-Cart forums © 2001-2020