rxvoice Posted August 15, 2008 Share Posted August 15, 2008 Currently my whmcs lists my products in single file down the page. How do i get it to list products 2 on each row? thank you 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted August 15, 2008 Share Posted August 15, 2008 Try This: Backup your /templates/orderforms/cart/products.tpl somewhere safe. Then replace all the code in the file with this code below To change the amount of columns look for{assign var=cols value=2} and change the value to how many columns you want. <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} <br /> {/foreach} </tbody> </table> <p align="right"><input type="button" value="{$LANG.viewcart}" onclick="window.location='cart.php?a=view'" /></p> Enjoy. Matt, Could this be added to the next release if everyone likes it? If so could an option be put into the admin settings to set the amount of columns. 0 Quote Link to comment Share on other sites More sharing options...
rxvoice Posted August 16, 2008 Author Share Posted August 16, 2008 thanks for the help but maybe i wasnt clear what i wanted. I want two products per row. Instead of single file. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted August 16, 2008 Share Posted August 16, 2008 Have you tried it? If you can't be bothered to try it, look at it in action at my site https://tshosting.com.au/cart.php Go there now and have a look I have made 1 group to still display 1 column the other groups are 2 columns (or 2 products per row) Currently my whmcs lists my products in single file down the page. How do i get it to list products 2 on each row? thank you I want two products per row. Instead of single file. You want 2 products on each row that means in a table you need 2 columns (1 product in each column) then it starts a new row with another 2 columns (or another 2 products) That is exactly what what you asked for to my understanding If it was not what you meant then be clear in what you ask 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted August 18, 2008 Share Posted August 18, 2008 An error that ends up adding space to the top of the table Just above {/foreach} remove the <br /> 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.