X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   product.tpl image display!!!!! (https://forum.x-cart.com/showthread.php?t=1537)

ciava 02-17-2003 01:42 AM

product.tpl image display!!!!!
 
Hi All

Still having trouble with the product tpl. The problem i need resolving is as follows:-

i have a number of featured products which include thumbnail images, when the product is clicked for more details and the product.tpl is displayed i want to have a detailed image displayed, if there is no detailed image i want the thumbnail to display instead and if there is no thumbnail then i have added a new no_image.tpl which includes an graphic stating there isn't a picture of the product. i've tried using the code below to swap the detailed image for my new tpl if there is no detailed image but this won't even work so any help would be great!!


{section name=image loop=$images} {if $images[image].avail eq ""} [img]../product_image.php?imageid={$images[image].imageid}[/img]
{else}{include file="customer/main/noimage.tpl" }{/if} {/section}

regards

jon

funkydunk 02-20-2003 10:56 AM

I did a slight variation on this which shows the first detailed product image instead of the thumbnail.

First I cretaed a new template in modules/detailed_product_images/product_images_main.tpl

Code:

{if $images ne ""}
{section name=image loop=$images}
{if $images[image].avail eq "Y"}
{if $smarty.section.image.index eq 0}
[img]../product_image.php?imageid={$images[image].imageid}[/img]
{else}
{/if}
{/if}
{/section}
{/if}


Then amended the product.tpl template to show the code below where you want the detailed image to show:

Code:

{if $active_modules.Detailed_Product_Images ne ""}
{include file="modules/Detailed_Product_Images/product_images_main.tpl" }
{else}
{include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.image_x image_y=$product.image_y product=$product.product}
{/if}


This will show the detail image if there is one, if not then show the thumbnail and if there isn't one of those then the standard no image icon will appear. You will need to load a new personalised one up.

funkydunk 02-20-2003 10:59 AM

Please note that unless you modify the product images template then the first detail image will show twice. If you dont want this then amend code to the following:
Code:

{if $images ne ""}
{section name=num loop=$images}
{/section}
{if %num.index% <2}
{else}
{capture name=dialog}
<table border=0 width=100% cellpadding=2 cellspacing=0>
<tr>
{section name=image loop=$images}
{if $images[image].avail eq "Y"}
{if $smarty.section.image.index eq 0}
{else}
<td align=center valign=top>
[img]../product_image.php?imageid={$images[image].imageid}[/img]
</td>

{if $smarty.section.image.index is even}
</tr>
<tr>
{/if}
{/if}

{/if}
{/section}
</tr>
</table>
{/capture}
{if $smarty.capture.dialog ne ""}
{include file="dialog.tpl" title=$lng.lbl_detailed_images content=$smarty.capture.dialog extra="width=100%"}
{/if}

{/if}
{/if}


btw this show two images per row. :)

John7 03-04-2003 05:48 AM

Question About This Mod
 
What happens if you have more than one detailed images?

Where do the other images go?

funkydunk 03-04-2003 05:54 AM

They just show up as normal in the detailled images area on the product page.

John7 03-04-2003 06:49 AM

Thanks
 
Awsome!!!!!!!!!!!

funkydunk 03-04-2003 06:55 AM

A client needed it this way so I built it.

That is the beauty of x-cart...it can do almost anything :D

John7 03-04-2003 10:15 AM

One more thing
 
I saw it mentioned that it displays two products per row.

How can we make it display one product per row.

I'm about to implement your mod.

This is cool.

What I have already done is delete the icon dispay code and move the detailed image code in its place, but I think your mod will work much better.

Thanks

funkydunk 03-04-2003 10:51 AM

change it to:

Code:

{if $images ne ""}
{section name=num loop=$images}
{/section}
{if %num.index% <2}
{else}
{capture name=dialog}
<table border=0 width=100% cellpadding=2 cellspacing=0>
<tr>
{section name=image loop=$images}
{if $images[image].avail eq "Y"}
{if $smarty.section.image.index eq 0}
{else}
<td align=center valign=top>
[img]../product_image.php?imageid={$images[image].imageid}[/img]
</td>

{/if}

{/if}
{/section}
</tr>
</table>
{/capture}
{if $smarty.capture.dialog ne ""}
{include file="dialog.tpl" title=$lng.lbl_detailed_images content=$smarty.capture.dialog extra="width=100%"}
{/if}

{/if}
{/if}



All times are GMT -8. The time now is 01:46 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.