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

Multiple columns in

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 04-22-2009, 03:54 AM
 
retrtrtrytrutru retrtrtrytrutru is offline
 

Senior Member
  
Join Date: Aug 2007
Posts: 101
 

Default Multiple columns in

Hi everyone,

I cannot figure out how to do this, searched the forums and I found some threads but they're too complicated for me.. Please take a look at the following page:

http://www.vervangjelamp.nl/Losse-Beamerlampen-Projector-Lampen/

Notice there are 3 products displayed.. I want rows of 2 products. The template used is customer/main/products_list.tpl:

Code:
<center> <table cellspacing="0" cellpadding="3" border="0"> <tr> {foreach from=$products item=product} {assign var="url" value="product.php?productid=`$product.productid`&amp;cat=`$cat`&amp;page=`$navigation_page`"} <td align="center"><a href="{$url}">{include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.tmbn_x image_y=$product.tmbn_y product=$product.product tmbn_url=$product.tmbn_url}</a><br /><a href="{$url}" class="product-title">{$product.product|escape}</a> ({include file="currency.tpl" value=$product.taxed_price})</td> {/foreach} </tr> </table> </center>
I've tried experimenting with a {section loop} but this doesn't work.. at all Anyone who can point me in the right direction? Thanks!
__________________
www.qualitylamps.eu
X-Cart Gold 4.1.8, PHP 5.2.6, MySQL 5.0.51a, Apache 2.2.9

www.vervangjelamp.nl
X-Cart Gold 4.2.0, PHP 5.2.6, MySQL 5.0.37-standard, Apache/2

Sorry for the weird user name, I registered it by mistake
Reply With Quote
  #2  
Old 04-22-2009, 04:00 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: Multiple columns in

products_list is used for one product per row
you should edit products_t.tpl instead
Why just not set value products per row to 2 in admin->General settings->Appearance ?
This may be useful also: http://forum.x-cart.com/showthread.php?t=47057
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote
  #3  
Old 04-22-2009, 04:36 AM
 
retrtrtrytrutru retrtrtrytrutru is offline
 

Senior Member
  
Join Date: Aug 2007
Posts: 101
 

Default Re: Multiple columns in

Hi Victor,

I know products_list is for displaying one product per row... this is used for all my categories except one. The actual products_list file looks like this:

Code:
{* $Id: products_list.tpl,v 1.10 2008/12/10 08:29:52 max Exp $ vim: set ts=2 sw=2 sts=2 et: *} {if $cat ne "60"} {****CAT 60 ZIJN DE LOSSE LAMPEN****} <br> <table cellspacing="0" cellpadding="0" border="0" id="prodlist"> <tr id="prodlistheaderround"><td colspan="4"></td></tr> <tr id="prodlistheader"><td>Beamer<br />Model:</td><td>Beamer<br />Lampcode:</td><td>{$lng.lbl_price}<br />(incl.):</td><td align="left">Direct<br />bestellen:</td></tr> {foreach from=$products item=product} <tr class="{cycle values='odd,even'}"><td><a href="product.php?productid={$product.productid}" title="{$smarty.capture.link_title|escape}">{$product.descr}</a></td><td><nobr>{include file="currency.tpl" value=$product.taxed_price}</nobr></td><td align="right">{include file="customer/main/buy_now.tpl"}</td></tr> {/foreach} </table> <br><br> {else} <center> <table cellspacing="0" cellpadding="3" border="0"> <tr> {foreach from=$products item=product} {assign var="url" value="product.php?productid=`$product.productid`&amp;cat=`$cat`&amp;page=`$navigation_page`"} <td align="center"><a href="{$url}">{include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.tmbn_x image_y=$product.tmbn_y product=$product.product tmbn_url=$product.tmbn_url}</a><br /><a href="{$url}" class="product-title">{$product.product|escape}</a> ({include file="currency.tpl" value=$product.taxed_price})</td> {/foreach} </tr> </table> </center> {/if}
So if the cat equals 60 I want a different layout which has got me stuck because it's hard to figure out how to create 2 rows now since I am not using the appearance options at all. I will check your posts, maybe I can work it out myself. Thanks!
__________________
www.qualitylamps.eu
X-Cart Gold 4.1.8, PHP 5.2.6, MySQL 5.0.51a, Apache 2.2.9

www.vervangjelamp.nl
X-Cart Gold 4.2.0, PHP 5.2.6, MySQL 5.0.37-standard, Apache/2

Sorry for the weird user name, I registered it by mistake
Reply With Quote
  #4  
Old 04-22-2009, 06:18 AM
 
retrtrtrytrutru retrtrtrytrutru is offline
 

Senior Member
  
Join Date: Aug 2007
Posts: 101
 

Default Re: Multiple columns in

Ok, done it Copied the code I needed from products_t.tpl, if anyone is interested:

HTML Code:
{* $Id: products_list.tpl,v 1.10 2008/12/10 08:29:52 max Exp $ vim: set ts=2 sw=2 sts=2 et: *} {if $cat ne "60"} {****CAT 60 ZIJN DE LOSSE LAMPEN****} <br> <table cellspacing="0" cellpadding="0" border="0" id="prodlist"> <tr id="prodlistheaderround"><td colspan="4"></td></tr> <tr id="prodlistheader"><td>Beamer<br />Model:</td><td>Beamer<br />Lampcode:</td><td>{$lng.lbl_price}<br />(incl.):</td><td align="left">Direct<br />bestellen:</td></tr> {foreach from=$products item=product} <tr class="{cycle values='odd,even'}"><td><a href="product.php?productid={$product.productid}" title="{$smarty.capture.link_title|escape}">{$product.descr}</a></td><td><nobr>{include file="currency.tpl" value=$product.taxed_price}</nobr></td><td align="right">{include file="customer/main/buy_now.tpl"}</td></tr> {/foreach} </table> <br><br> {else} {list2matrix assign="products_matrix" assign_width="cell_width" list=$products row_length=3} {assign var="is_matrix_view" value=true} {if $products_matrix} <center><table cellspacing="0" cellpadding="3" border="0"> {foreach from=$products_matrix item=row name=products_matrix} <tr>{foreach from=$row item=product}{if $product}<td align="center"><a href="product.php?productid={$product.productid}&amp;cat={$cat}&amp;page={$navigation_page}">{$product.product|escape}</a></td>{/if}{/foreach}</tr> <tr>{foreach from=$row item=product}{if $product}<td align="center"><a href="product.php?productid={$product.productid}&amp;cat={$cat}&amp;page={$navigation_page}">{include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.tmbn_x image_y=$product.tmbn_y product=$product.product tmbn_url=$product.tmbn_url}</a></td>{/if}{/foreach}</tr> <tr>{foreach from=$row item=product}{if $product}<td align="center">{include file="currency.tpl" value=$product.taxed_price} {$lng.lbl_including_tax}<br /><br /><br /></td>{/if}{/foreach} {/foreach} </table></center> {/if} {/if}
Result here: http://www.vervangjelamp.nl/Losse-Beamerlampen-Projector-Lampen/
__________________
www.qualitylamps.eu
X-Cart Gold 4.1.8, PHP 5.2.6, MySQL 5.0.51a, Apache 2.2.9

www.vervangjelamp.nl
X-Cart Gold 4.2.0, PHP 5.2.6, MySQL 5.0.37-standard, Apache/2

Sorry for the weird user name, I registered it by mistake
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 12:36 PM.

   

 
X-Cart forums © 2001-2020