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)
-   -   Multiple columns in (https://forum.x-cart.com/showthread.php?t=47095)

retrtrtrytrutru 04-22-2009 03:54 AM

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!

Victor D 04-22-2009 04:00 AM

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

retrtrtrytrutru 04-22-2009 04:36 AM

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!

retrtrtrytrutru 04-22-2009 06:18 AM

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/


All times are GMT -8. The time now is 12:38 PM.

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