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

Pictures in recommends.tpl for 3 column format

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 12-03-2004, 03:28 PM
 
balinor balinor is offline
 

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

Default

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}
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #12  
Old 12-05-2004, 01:46 PM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

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.)
__________________
v. 4.0.14 (GM Style)
O.S. Linux
Build Your Own Diamond Ring
Reply With Quote
  #13  
Old 12-05-2004, 02:08 PM
 
balinor balinor is offline
 

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

Default

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.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #14  
Old 12-05-2004, 02:12 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

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
Reply With Quote
  #15  
Old 12-06-2004, 07:09 AM
 
balinor balinor is offline
 

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

Default

Solution here: http://forum.x-cart.com/viewtopic.php?t=14995
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #16  
Old 04-04-2005, 10:55 AM
 
longhorn180 longhorn180 is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Richmond, Virginia
Posts: 187
 

Default

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.
__________________
4.1.9 (Linux) Live Store
www.thecrackedbook.com
Find used books and out of print books.
Reply With Quote
  #17  
Old 04-11-2005, 11:07 AM
 
flamers flamers is offline
 

Advanced Member
  
Join Date: Nov 2004
Posts: 51
 

Default

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.
__________________
X-Cart V 4.0.18
Reply With Quote
  #18  
Old 04-13-2005, 02:21 AM
 
Online Michael Online Michael is offline
 

eXpert
  
Join Date: Mar 2005
Location: Melbourne, Australia
Posts: 273
 

Default

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.
__________________
X-Cart 5.3.5.4
Reply With Quote
  #19  
Old 04-26-2005, 06:22 AM
 
Lingerieblowout Lingerieblowout is offline
 

X-Adept
  
Join Date: Sep 2003
Location: Annapolis, MD
Posts: 415
 

Default

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.
__________________
http://www.lingerieblowout.com
Version 4.1.10

http://www.topnichewebsites.com
Version 4.4.5

Michael
Reply With Quote
  #20  
Old 04-26-2005, 07:30 PM
 
Lingerieblowout Lingerieblowout is offline
 

X-Adept
  
Join Date: Sep 2003
Location: Annapolis, MD
Posts: 415
 

Default

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}
__________________
http://www.lingerieblowout.com
Version 4.1.10

http://www.topnichewebsites.com
Version 4.4.5

Michael
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 07:28 AM.

   

 
X-Cart forums © 2001-2020