View Single Post
  #7  
Old 06-06-2006, 10:47 AM
  Alltribes's Avatar 
Alltribes Alltribes is offline
 

Senior Member
  
Join Date: Dec 2004
Posts: 192
 

Default

Here is my modules/Detailed_Product_Images/product_images.tpl

It needs some formatting, and I've only tested it on 4.1x, but I think it should work with 4.0x. This will just change your detailed images to thumbnails with an image popup when you click on it. The default image is displayed normal size. I'll be refining this as I go on.

Code:
{if $images ne ""} {capture name=dialog} <table> <tr> <td> <table> {section name=image loop=$images} {if $images[image].image_path} <tr><td>{thumb file=`$images[image].image_path` longside="100" link="true"}</td></tr> {/if} {/section} </table> </td> <td> [img]{$product.image_path_P}[/img] </td> </tr> </table> {/capture} {include file="dialog.tpl" title=$lng.lbl_detailed_images content=$smarty.capture.dialog extra='width="100%"'} {/if}

*edit*

Here is another modules/Detailed_Product_Images/product_images.tpl
This one uses javascript mouseover image swapping. It ignores the main product image and just uses the detailed images. As in the above example I've only tested in in 4.1x, but it should work on 4.0x. My next task is to preload the detailed images.

Code:
{if $images ne ""} {capture name=dialog} <table width=100%> <tr> <td> <table> {section name=image loop=$images} {if $images[image].image_path} <tr><td>{thumb file=`$images[image].image_path` longside="100" link="false"}</td></tr> {/if} {/section} </table> </td> <td> <img src={$images[0].image_path} name="main_image"/> </td> </tr> </table> {/capture} {include file="dialog.tpl" title=$lng.lbl_detailed_images content=$smarty.capture.dialog extra='width="100%"'} {/if}

*edit2*

Here is the above code, now with image preloading and now using imageid instead of orderby.

*fixed

Code:
{if $images ne ""} {capture name=dialog} <script language="JavaScript" type="text/javascript"> {section name=image loop=$images} {if {$images[image].image_path} Image{$images[image].imageid} = new Image(); Image{$images[image].imageid}.src = "{$images[image].image_path}"; {/if} {/section} </script> <table width="100%"> <tr> <td> <table> {section name=image loop=$images} {if {$images[image].image_path neq ""} <tr> <td> <a href="#" onmouseover="document.main_image.src=Image{$images[image].imageid}.src;">{thumb file=`$images[image].image_path` longside="100" link="false" html="alt='`$product.product`' border='0'"}</a> </td> </tr> {/if} {/section} </table> </td> <td> <img src="{$images[0].image_path}" name="main_image" alt="{$product.product}" /> </td> </tr> </table> {/capture} {include file="dialog.tpl" content=$smarty.capture.dialog extra='width="100%"'} {/if}

*edit*

Here is the preloading script for 4.0x, now using imageid instead of orderby:

Code:
{if $images ne ""} {capture name=dialog} <script language="JavaScript" type="text/javascript"> {section name=image loop=$images} {if {$images[image].image_path} Image{$images[image].imageid} = new Image(); Image{$images[image].imageid}.src = "{$images[image].image_path|replace:"server path to replace":""}"; {/if} {/section} </script> <table width="100%"> <tr> <td> <table> {section name=image loop=$images} {if {$images[image].image_path} <tr> <td> {thumb file=`$images[image].image_path` longside="100" link="false" html="alt='`$product.product` '"} </td> </tr> {/if} {/section} </table> </td> <td> [img]{$images[0].image_path|replace:[/img] </td> </tr> </table> {/capture} {include file="dialog.tpl" content=$smarty.capture.dialog extra='width="100%"'} {/if}
__________________
Alltribes.com
Native American Jewelry
Pottery, Baskets, Kachinas & More

X-cart Gold Version 4.0.17 Live
PHP 5.2.6
MySQL 4.1.25
(mt)
Reply With Quote