Jump to content

[MOD] Display products into separate groups in clientarea


sparky

Recommended Posts

ORIGINAL POST: http://forum.whmcs.com/showthread.php?p=78344#post78344

 

Here's a quick little mod to display the products into separate groups.

It also displays the same sort order that your groups are in.

 

Replace the code in clientareaproducts.tpl in your template folder with the below code.

<p class="heading2">{$LANG.clientareaproducts}</p>
<table width="100%" cellspacing="0" cellpadding="0"><tr><td>{$numproducts} {$LANG.recordsfound},  {$LANG.page} {$pagenumber} {$LANG.pageof} {$totalpages}</td><td align="right">{if $prevpage}<a href="clientarea.php?action=products&page={$prevpage}">{/if}« {$LANG.previouspage}{if $prevpage}</a>{/if}   {if $nextpage}<a href="clientarea.php?action=products&page={$nextpage}">{/if}{$LANG.nextpage} »{if $nextpage}</a>{/if}</td></tr></table>
<br />
{if $services}
{php}$result = mysql_query("SELECT tblproductgroups.name FROM tblproductgroups ORDER BY `order` ASC");while ($data = @mysql_fetch_array ($result)) { $this->assign('groupheader',$data['name']);{/php}
{assign var=disphead value=1}
{foreach name=displaylist key=num item=service from=$services}
{if $service.group eq $groupheader}
{if $disphead}
<table class="clientareatable" cellspacing="1"><tr class="clientareatableheading" style="text-align:left;"><td colspan="6">   {$groupheader}</td></tr><tr class="clientareatableheading"><td>{$LANG.orderproduct}</td><td>{$LANG.orderprice}</td><td>{$LANG.orderbillingcycle}</td><td>{$LANG.clientareahostingnextduedate}</td><td width="20"></td></tr>{assign var=disphead value=0}
{/if}
<tr class="clientareatable{$service.class}"><td>{$service.product}{if $service.domain}<br /><a href="http://{$service.domain}" target="_blank">{$service.domain}</a>{/if}</td><td>{$currencysymbol}{if $service.recurringamount neq "0.00"}{$service.recurringamount}{else}{$service.firstpaymentamount}{/if} {$currency}</td><td>{$service.billingcycle}</td><td>{$service.nextduedate}</td><td><form method="post" action="{$SERVER.PHP_SELF}?action=productdetails"><input type="hidden" name="id" value="{$service.id}" /><input type="image" src="images/viewdetails.gif" alt="{$LANG.clientareaviewdetails}" /></form></td></tr>
{/if}
{if $smarty.foreach.displaylist.last}
{if !$disphead}</table><br />{/if}
{assign var=disphead value=1}
{/if}
{/foreach}
{php} } {/php}
{else}
<table class="clientareatable" cellspacing="1"><tr class="clientareatableheading" style="text-align:left;"><td colspan="6"> </td></tr><tr class="clientareatableheading"><td>{$LANG.orderproduct}</td><td>{$LANG.orderprice}</td><td>{$LANG.orderbillingcycle}</td><td>{$LANG.clientareahostingnextduedate}</td><td width="20"></td></tr><tr class="clientareatableactive"><td colspan="6">{$LANG.norecordsfound}</td></tr></table>
{/if}
<table width="100%" cellspacing="0" cellpadding="0"><tr><td>{$LANG.show}: <a href="clientarea.php?action=products&itemlimit=10">10</a> <a href="clientarea.php?action=products&itemlimit=25">25</a> <a href="clientarea.php?action=products&itemlimit=50">50</a> <a href="clientarea.php?action=products&itemlimit=100">100</a> <a href="clientarea.php?action=products&itemlimit=all">{$LANG.all}</a></td><td align="right">{if $prevpage}<a href="clientarea.php?action=products&page={$prevpage}">{/if}« {$LANG.previouspage}{if $prevpage}</a>{/if}   {if $nextpage}<a href="clientarea.php?action=products&page={$nextpage}">{/if}{$LANG.nextpage} »{if $nextpage}</a>{/if}</td></tr></table>
<table align="center"><tr><td width="10" align="right"><table style="width:10px;height:10px;" cellspacing="1" class="clientareatable"><tr class="clientareatableactive"><td></td></tr></table></td><td>{$LANG.clientareaactive}</td><td width="10" align="right"><table style="width:10px;height:10px;" cellspacing="1" class="clientareatable"><tr class="clientareatablepending"><td></td></tr></table></td><td>{$LANG.clientareapending}</td><td width="10" align="right"><table style="width:10px;height:10px;" cellspacing="1" class="clientareatable"><tr class="clientareatablesuspended"><td></td></tr></table></td><td>{$LANG.clientareasuspended}</td><td width="10" align="right"><table style="width:10px;height:10px;" cellspacing="1" class="clientareatable"><tr class="clientareatableterminated"><td></td></tr></table></td><td>{$LANG.clientareaterminated}</td></tr></table>

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
  • 1 month later...
  • 4 weeks later...

I have some clients that have say 4 hosting accounts, 10 domains, 10 adsl accounts, initially the page loads and displays 2 of the 4 hosting accounts, then the 10 domains, and then say 8 of the adsl account, the next page shows the 2 other hosting accounts and the balance of the adsl accounts, if you select view all or a value where the list size is lower than the selected item size ie 25 then they all display correctly grouped together, ie 4 hosting accts, 10 domains, 10 adsl accounts, any idea why this does this.

 

I would like it to list initially the groups together and not split them across pages, rather list 4 hosting and 6 domains, and then on page 2 the balance of the domains, and then the 10 adsl accounts. Can this be done ? If it cant its no smash I just wanted it to keep the grouped items together for ease of use by the customers

Link to comment
Share on other sites

  • 4 weeks later...

Just added this and came across a problem (and solution).

 

I found that on my installation (others may be different) that when clicking on the view details icon it took me back to the main index.php page.

 

If you have the same issue:

 

Find on line 12:

 

{$SERVER.PHP_SELF}

 

Change to:

 

{$smarty.server.PHP_SELF}

 

Fixed it for me, maybe it was changed in 3.81?

Link to comment
Share on other sites

Fixed formatting of Code, and updated with correct PHP_Self Code.

Some may find this a little easier to read.

(:

 

p.s. don't forget, you can edit your "Products & Services" link on the left hand user account menu, and have it point to:

- ../clientarea.php?action=products&itemlimit=all

 

Instead of:

- ../clientarea.php?action=products

 

<p class="heading2">{$LANG.clientareaproducts}</p>
<table width="100%" cellspacing="0" cellpadding="0"><tr>
   <td>{$numproducts} {$LANG.recordsfound},  {$LANG.page} {$pagenumber} {$LANG.pageof} {$totalpages}</td>
   <td align="right">{if $prevpage}<a href="clientarea.php?action=products&page={$prevpage}">{/if}« {$LANG.previouspage}{if $prevpage}</a>{/if}   {if $nextpage}<a href="clientarea.php?action=products&page={$nextpage}">{/if}{$LANG.nextpage} »{if $nextpage}</a>{/if}</td>
</tr></table>
<br />

{if $services}
   {php}$result = mysql_query("SELECT tblproductgroups.name FROM tblproductgroups ORDER BY `order` ASC");while ($data = @mysql_fetch_array ($result)) { $this->assign('groupheader',$data['name']);{/php}
   {assign var=disphead value=1}
   {foreach name=displaylist key=num item=service from=$services}
   {if $service.group eq $groupheader}
   {if $disphead}

   <table class="clientareatable" cellspacing="1">
       <tr class="clientareatableheading" style="text-align:left;">
           <td colspan="6">   {$groupheader}</td>
       </tr>
       <tr class="clientareatableheading">
           <td>{$LANG.orderproduct}</td>
           <td>{$LANG.orderprice}</td>
           <td>{$LANG.orderbillingcycle}</td>
           <td>{$LANG.clientareahostingnextduedate}</td>
           <td width="20"></td>
       </tr>{assign var=disphead value=0}
{/if}

   <tr class="clientareatable{$service.class}">
       <td>{$service.product}{if $service.domain}<br /><a href="http://{$service.domain}" target="_blank">{$service.domain}</a>{/if}</td>
       <td>{$currencysymbol}{if $service.recurringamount neq "0.00"}{$service.recurringamount}{else}{$service.firstpaymentamount}{/if} {$currency}</td>
       <td>{$service.billingcycle}</td>
       <td>{$service.nextduedate}</td>
       <td><form method="post" action="{$smarty.server.PHP_SELF}?action=productdetails"><input type="hidden" name="id" value="{$service.id}" /><input type="image" src="images/viewdetails.gif" alt="{$LANG.clientareaviewdetails}" /></form></td>
   </tr>

{/if}

   {if $smarty.foreach.displaylist.last}
       {if !$disphead}</table><br />{/if}
           {assign var=disphead value=1}
       {/if}
       {/foreach}
       {php} } {/php}

   {else}

   <table class="clientareatable" cellspacing="1"><tr class="clientareatableheading" style="text-align:left;">
       <td colspan="6"> </td>
   </tr>
   <tr class="clientareatableheading">
       <td>{$LANG.orderproduct}</td>
       <td>{$LANG.orderprice}</td>
       <td>{$LANG.orderbillingcycle}</td>
       <td>{$LANG.clientareahostingnextduedate}</td>
       <td width="20"></td>
   </tr>
   <tr class="clientareatableactive">
       <td colspan="6">{$LANG.norecordsfound}</td>
   </tr>
   </table>

   {/if}

   <table width="100%" cellspacing="0" cellpadding="0"><tr>
       <td>{$LANG.show}: <a href="clientarea.php?action=products&itemlimit=10">10</a> <a href="clientarea.php?action=products&itemlimit=25">25</a> <a href="clientarea.php?action=products&itemlimit=50">50</a> <a href="clientarea.php?action=products&itemlimit=100">100</a> <a href="clientarea.php?action=products&itemlimit=all">{$LANG.all}</a></td>
       <td align="right">{if $prevpage}<a href="clientarea.php?action=products&page={$prevpage}">{/if}« {$LANG.previouspage}{if $prevpage}</a>{/if}   {if $nextpage}<a href="clientarea.php?action=products&page={$nextpage}">{/if}{$LANG.nextpage} »{if $nextpage}</a>{/if}</td>
   </tr></table>

   <table align="center"><tr><td width="10" align="right"><table style="width:10px;height:10px;" cellspacing="1" class="clientareatable"><tr class="clientareatableactive">
       <td></td>
   </tr></table>
   </td>
       <td>{$LANG.clientareaactive}</td>
       <td width="10" align="right">
           <table style="width:10px;height:10px;" cellspacing="1" class="clientareatable"><tr class="clientareatablepending">
               <td></td>
           </tr></table>
       </td>
           <td>{$LANG.clientareapending}</td>
           <td width="10" align="right">
               <table style="width:10px;height:10px;" cellspacing="1" class="clientareatable"><tr class="clientareatablesuspended">
                   <td></td>
               </tr></table>
           </td>
           <td>{$LANG.clientareasuspended}</td>
           <td width="10" align="right">
               <table style="width:10px;height:10px;" cellspacing="1" class="clientareatable"><tr class="clientareatableterminated">
                   <td></td>
               </tr></table>
           </td>
           <td>{$LANG.clientareaterminated}</td>
       </tr></table> [/indent]

Link to comment
Share on other sites

  • 3 months later...

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