Jump to content

Cloning "My Products & Services" page issue


Recommended Posts

Hi,

I am having some issues with making a clone of the "My Products & Services" (clientarea.php?action=services) page.

I have created a orderstatus.php & orderstatus.tpl page with what seems like the working/correct details but the table shows as blank? Im sure it is an easy to fix thing but  I cannot get my head around it! 

Here is the two files I am using:

 

orderstatus.php:

<?php
 
 define("CLIENTAREA",true);
 //define("FORCESSL",true); // Uncomment to force the page to use https://
 
 require("init.php");
 
 $ca = new WHMCS_ClientArea();
 
 $ca->setPageTitle("Your Order Status");
 
 $ca->requireLogin(); // Uncomment this line to require a login to access this page

 $ca->initPage();
 
 //$ca->requireLogin(); // Uncomment this line to require a login to access this page
 
 # To assign variables to the template system use the following syntax.
 # These can then be referenced using {$variablename} in the template.
 
 $ca->assign('variablename', $value);


 # Define the template filename to be used without the .tpl extension
 
 $ca->setTemplate('orderstatus');
 
 $ca->output();
 
 ?>

 

orderstatus.tpl page:

{include file="$template/includes/tablelist.tpl" tableName="ServicesList" filterColumn="4" noSortColumns="0"}
<script type="text/javascript">
    jQuery(document).ready( function ()
    {
        var table = jQuery('#tableServicesList').removeClass('hidden').DataTable();
        {if $orderby == 'product'}
            table.order([1, '{$sort}'], [4, 'asc']);
        {elseif $orderby == 'amount' || $orderby == 'billingcycle'}
            table.order(2, '{$sort}');
        {elseif $orderby == 'nextduedate'}
            table.order(3, '{$sort}');
        {elseif $orderby == 'domainstatus'}
            table.order(4, '{$sort}');
        {/if}
        table.draw();
        jQuery('#tableLoading').addClass('hidden');
    });
</script>
<div class="table-container clearfix">
    <table id="tableServicesList" class="table table-list hidden">
        <thead>
            <tr>
				<th></th>
                <th class="text-left">{$LANG.orderproduct}</th>
                <th>{$LANG.clientareaaddonpricing}</th>
                <th>{$LANG.clientareahostingnextduedate}</th>
                <th>{$LANG.clientareastatus}</th>
                <th class="responsive-edit-button" style="display: none;"></th>
            </tr>
        </thead>
        <tbody>
            {foreach key=num item=service from=$services}
                <tr onclick="clickableSafeRedirect(event, 'clientarea.php?action=productdetails&amp;id={$service.id}', false)">
					<td class="text-center{if $service.sslStatus} ssl-info{/if}" data-element-id="{$service.id}" data-type="service"{if $service.domain} data-domain="{$service.domain}"{/if}>
                        {if $service.sslStatus}
                            <img src="{$service.sslStatus->getImagePath()}" data-toggle="tooltip" title="{$service.sslStatus->getTooltipContent()}" class="{$service.sslStatus->getClass()}"/>
                        {elseif !$service.isActive}
                            <img src="{$BASE_PATH_IMG}/ssl/ssl-inactive-domain.png" data-toggle="tooltip" title="{lang key='sslState.sslInactiveService'}">
                        {/if}
                    </td>
                    <td><strong>{$service.product}</strong>{if $service.domain}<br /><a href="http://{$service.domain}" target="_blank">{$service.domain}</a>{/if}</td>
                    <td class="text-center" data-order="{$service.amountnum}">{$service.amount}<br />{$service.billingcycle}</td>
                    <td class="text-center"><span class="hidden">{$service.normalisedNextDueDate}</span>{$service.nextduedate}</td>
                    <td class="text-center"><span class="label status status-{$service.status|strtolower}">{$service.statustext}</span></td>
                    <td class="responsive-edit-button" style="display: none;">
                        <a href="clientarea.php?action=productdetails&amp;id={$service.id}" class="btn btn-block btn-info">
                            {$LANG.manageproduct}
                        </a>
                    </td>
                </tr>
            {/foreach}
        </tbody>
    </table>
    <div class="text-center" id="tableLoading">
        <p><i class="fas fa-spinner fa-spin"></i> {$LANG.loading}</p>
    </div>
</div>

 

All I need the orderstatus.php page to show is the details as the default page, then I can work with changing it from there.

Hopefully, someone can help me!

Thank you :)

Link to comment
Share on other sites

20 minutes ago, Charles Bradbeer said:

I have created a orderstatus.php & orderstatus.tpl page with what seems like the working/correct details but the table shows as blank? Im sure it is an easy to fix thing but  I cannot get my head around it! 

you will need to query the database to get this client's services... normally, you would do that in a hook, but as it's a custom.php file, you can do it in there instead.

https://developers.whmcs.com/advanced/db-interaction/

19 minutes ago, Charles Bradbeer said:

All I need the orderstatus.php page to show is the details as the default page, then I can work with changing it from there.

oh that's all? 🙂

Link to comment
Share on other sites

On 9/04/2020 at 4:00 PM, brian! said:

you will need to query the database to get this client's services... normally, you would do that in a hook, but as it's a custom.php file, you can do it in there instead.

https://developers.whmcs.com/advanced/db-interaction/

oh that's all? 🙂

Hi,

I have added it in:

<?php
 use WHMCS\Database\Capsule;

 define("CLIENTAREA",true);
 //define("FORCESSL",true); // Uncomment to force the page to use https://
 
 require("init.php");

 $ca = new WHMCS_ClientArea();
 
 $ca->setPageTitle("Your Order Status");
 
 $ca->requireLogin(); // Uncomment this line to require a login to access this page

 $ca->initPage();
 
 //$ca->requireLogin(); // Uncomment this line to require a login to access this page
 
 # To assign variables to the template system use the following syntax.
 # These can then be referenced using {$variablename} in the template.
 
 $ca->assign('variablename', $value);


 # Define the template filename to be used without the .tpl extension
 
 $ca->setTemplate('orderstatus');

 $ca->output();
 
 ?>

But it still doesn't work? I'm definitely doing something wrong ;/

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