X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Pictures in recommends.tpl for 3 column format (https://forum.x-cart.com/showthread.php?t=7506)

balinor 12-03-2004 03:28 PM

Ok, managed to pull the icon in, split it up into a 3 column layout and it looks great. Only problem is, if there is only one upselling link, the other two columns show the 'image not available' icon. What I suppose I need is a function to tell X-Cart to not display anything in the extra columns if there are only one or two items. A little help? :) Here's what I have for code:

Code:

{* $Id: related_products.tpl,v 1.7.6.1 2004/07/15 10:28:54 svowl Exp $ *}
{if $product_links ne ""}
{capture name=dialog}
<table border=0 cellspacing=5 align="center" width="100%">
<tr>
{section name=cat_num loop=3}
<td width=250 align=center valign=top>
{include file="product_thumbnail.tpl" productid=$product_links[cat_num].productid image_x=$config.Appearance.thumbnail_width product=$product_links[cat_num].product tmbn_url=$product_links[cat_num].tmbn_url}


<a href="product.php?productid={ $product_links[cat_num].productid }"{if $config.Modules.upselling_new_window eq 'Y'} target="_blank"{/if}>
<span class="ProductTitle">{ $product_links[cat_num].product|escape}</span>
</a>
</td>{/section}
</tr>
</table>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_related_products content=$smarty.capture.dialog extra="width=100%"}
{/if}


GM 12-05-2004 01:46 PM

It's because you are telling it to loop 3 times...
Code:

{section name=cat_num loop=3}
(but I suppose that is how you got three columns.)

balinor 12-05-2004 02:08 PM

Yep. What I need is an {if} statement in there that tells it to not display anything if there is only 1 or 2 products. Anyone care to help me out with that? I don't know Smarty well enough yet to come up with anything.

adpboss 12-05-2004 02:12 PM

You need to count the number of results in the loop.

Look for a thread in Custom Mods by 27stars and about subcategory display. You can use a similar method to accomplish what you want to do.

or look at skin1/customer/main/productS.tpl

balinor 12-06-2004 07:09 AM

Solution here: http://forum.x-cart.com/viewtopic.php?t=14995

longhorn180 04-04-2005 10:55 AM

I really like this mod but do have one question, how would I make this mod display a 3x3 table with 9 recommended products instead of just the 3? Thanks in advance.

flamers 04-11-2005 11:07 AM

The original 3 column recommends code works fine in V4 (my version anyway), but it looks a bit clumsy as is because it squashes the item title against left hand side. It's easily fixed, here's the original code:

Code:

{* $Id: recommends.tpl,v 1.3 2004/03/01 16:26:00 salsabeel Exp $ *}
{if $recommends}
{capture name=recommends}

<table border=0 width=100%>
<tr>

{section name=num loop=3}
<td width=90 align=center valign=top>
{$recommends[num].product}</font>
</td>
{/section}

</tr>
</table>

 
{/capture}
{include file="dialog.tpl" title=$lng.lbl_recommends content=$smarty.capture.recommends extra="width=100%"}{/if}


Just modify the first part to this:

Code:

{if $recommends}
{capture name=recommends}

<table border=0 width=100%>
<tr>

{section name=num loop=3}
<td width=200 align=center valign=top>


et voila, just by changing the table width to 200 the title stretches all the way under the thumbnail.

Online Michael 04-13-2005 02:21 AM

Quote:

Originally Posted by longhorn180
I really like this mod but do have one question, how would I make this mod display a 3x3 table with 9 recommended products instead of just the 3? Thanks in advance.


Yes, this would be very nice. I have managed to squeeze in 4 columns across but would like another one or two more rows of it. Had a go at doing it myself, but with no success. The mod works great on 4.0.13 btw.

Lingerieblowout 04-26-2005 06:22 AM

Did anyone figure out the IF statement to make a loop count and if EQ then add a


So if loop = 6 and 3 are written a
would come before the 4th one.

Lingerieblowout 04-26-2005 07:30 PM

This is how I tried to do it but still make 1 row of six instead of 2 rows of 3

{* $Id: recommends.tpl,v 1.3 2004/03/01 16:26:00 salsabeel Exp $ *}
{if $recommends}
{capture name=recommends}

{assign var="col" value="0"}
{assign var="numCols" value="3"}

<table border=0 width=100%>
<tr>

{section name=num loop=6}


{if $col == $numCols}
</tr><tr>{assign var="col" value="0"}
{/if}


<td width=200 align=center valign=top>
{$recommends[num].product}</font>
</td>
{assign var="col" value="`$col+1`"}
{/section}

</tr>
</table>



{/capture}
{include file="dialog.tpl" title=$lng.lbl_recommends content=$smarty.capture.recommends extra="width=100%"}{/if}


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

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