Jump to content

[MOD] Multiple columns in products display


sparky

Recommended Posts

To change the amount of columns displayed on your products page look for {assign var=cols value=2} and change the value to how many columns you want to display.

 

Backup your /templates/orderforms/cart/products.tpl somewhere safe.

 

Then replace all the code in the file with this code below

<link rel="stylesheet" type="text/css" href="templates/orderforms/cart/style.css" />

<p align="center" class="cartheading">{$LANG.cartbrowse}</p>

<div class="cartbox" align="center"><strong>
{foreach key=num item=productgroup from=$productgroups}
{if $gid eq $productgroup.gid}
{$productgroup.name} | 
{else}
<a href="{$smarty.server.PHP_SELF}?gid={$productgroup.gid}">{$productgroup.name}</a> | 
{/if}
{/foreach}
{if $loggedin}<a href="{$smarty.server.PHP_SELF}?gid=addons">{$LANG.cartproductaddons}</a> | {/if}
{if $registerdomainenabled}<a href="{$smarty.server.PHP_SELF}?a=add&domain=register">{$LANG.registerdomain}</a> |{/if}
{if $transferdomainenabled}<a href="{$smarty.server.PHP_SELF}?a=add&domain=transfer">{$LANG.transferdomain}</a> |{/if}
<a href="{$smarty.server.PHP_SELF}?a=view">{$LANG.viewcart}</a>
</strong></div>

<br />

<table border="0" cellpadding="0" cellspacing="0" style="border-width: 0px">
   <tbody>
       <tr>
{assign var=cols value=2}
{foreach name=list key=num item=product from=$products}
<td>
<table border="0" cellpadding="0" cellspacing="0" style="border-width: 0px">
   <tbody>
       <tr>
           <td>
               <strong>{$product.name}</strong> {if $product.qty!=""}<em>({$product.qty} {$LANG.orderavailable})</em>{/if}<br />
               {if $product.description}{$product.description}<br />{/if}
           </td>
           <td>
               <div style="margin:5px;padding:2px;color:#cc0000;">
                   {if $product.paytype eq "free"}
                   {$LANG.orderfree}
                   {elseif $product.paytype eq "onetime"}
                   {$product.pricing.onetime} {$LANG.orderpaymenttermonetime}
                   {elseif $product.paytype eq "recurring"}
                   {if $product.pricing.monthly}{$product.pricing.monthly}<br />{/if}
                   {if $product.pricing.quarterly}{$product.pricing.quarterly}<br />{/if}
                   {if $product.pricing.semiannually}{$product.pricing.semiannually}<br />{/if}
                   {if $product.pricing.annually}{$product.pricing.annually}<br />{/if}
                   {if $product.pricing.biennially}{$product.pricing.biennially}<br />{/if}
                   {/if}
               </div>

               <div align="right"><input type="button" value="{$LANG.ordernowbutton}"{if $product.qty eq "0"} disabled{/if} onclick="window.location='{$smarty.server.PHP_SELF}?a=add&pid={$product.pid}'" /></div>
           </td>
       </tr>
   </tbody>
</table>
</td>
       {if not (($smarty.foreach.list.index +1) mod $cols)}
               {if not $smarty.foreach.list.last}
                       </TR><TR>
               {/if}
       {/if}
       {if $smarty.foreach.list.last}
               {* pad the cells not yet created *}
               {math equation = "n - a % n" n=$cols a=$products|@count assign="cells"}
               {if $cells ne $cols}
               {section name=pad loop=$cells}
                       <TD> </TD>
               {/section}
               {/if}
               </TR>
       {/if}
{/foreach}
</tbody>
</table>
<p align="right"><input type="button" value="{$LANG.viewcart}" onclick="window.location='cart.php?a=view'" /></p>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated