07-21-2008, 11:16 AM
|
|
| |
|
|
Advanced Member
|
|
Join Date: Mar 2006
Location: Canada
Posts: 30
|
|
|
Re: 3 column layout with thumbnail for Related Products
Thank you very much the code works even for my older version of x-cart:
http://clikinternational.com/store/product.php?productid=106
Quote:
Originally Posted by JWait
On a related note, how can I show 3,and only 3, regardless of how many related items I have?
Here is my related_products.tpl, and it works like a champ (in 4.1.8, but should work in newer versions also) except for the limit I want. What do I change?
Code:
{* $Id: related_products.tpl,v 1.15 2005/12/07 14:07:32 max Exp $ *}
{if $product_links ne ""}
{capture name=dialog}
{assign var="tmp" value="0"}
{section name=cat_num loop=$product_links}
{if $product_links[cat_num].productid}{assign var="tmp" value="1"}{/if}
{/section}
{section name=cat_num loop=$product_links}
{ if %cat_num.first% }
<table border="0" cellspacing="0" width="100%">
<tr>
{/if}
{if $smarty.section.cat_num.index is div by 3}
</tr><tr valign="top">
{/if}
<td width=33% align=center valign=top class="PListCell";>
<a href="product.php?productid={ $product_links[cat_num].productid }" class="ItemsList" {if $config.Modules.upselling_new_window eq 'Y'} target="_blank"{/if}>{$product_links[cat_num].product}</a>
<br />
<a href="product.php?productid={ $product_links[cat_num].productid }"> {include file="product_thumbnail.tpl" productid=$product_links[cat_num].productid image_x=$config.Appearance.thumbnail_width product=$product_links[cat_num].product type="T"}</a>
<br />
<font class="ProductPrice">{$lng.lbl_our_price}: {include file="currency.tpl" value=$product_links[cat_num].price}</font>
</td>
{ if %cat_num.last% }
</tr></table>
{/if}
{/section}
{/capture}
{include file="dialog.tpl" title="Related products" content=$smarty.capture.dialog extra="width=100%"}
{/if}
BTW, to the person that wanted the price to be linked, just replicate the links to the "title" and the image. I just chose not to do that.
Code:
<a href="product.php?productid={ $product_links[cat_num].productid }">{$lng.lbl_our_price}: {include file="currency.tpl" value=$product_links[cat_num].price}</a>
|
__________________
__________________
XC5: 5.3.4.4
PHP: 7.0.26
MySQL server: 5.5.56-MariaDB
|
|