Jump to content

How to Display invoice link to clientssummary page .


Recommended Posts

Hi, guys.

Refer to this topic ,  I hope to replace the 'payment method ' to 'invoice' , in this way , can see the link of invoice to this specific service .

I tried to use the hook of AdminAreaClientSummaryPage . but I didn't know which variant can be use and pass  . 

in that page clientssummary.tpl . I used {debug} , didn't see any invoice variant . 

the hook is like this , but not working . hope anyone can help me , thanks in advance .

<?php

if (!defined("WHMCS")) { die("This file cannot be accessed directly"); }

use WHMCS\Database\Capsule;

add_hook('AdminAreaClientSummaryPage', 1, function($vars) {
    if (!empty($vars['product'])) {
        foreach ($vars['product'] as $key => $product) {

          $data = Capsule::table('tblhosting AS t1')
              ->leftJoin('tblinvoiceitems AS t2', 't1.id', '=', 't2.relid')
              ->leftJoin('tblinvoices AS t3', 't2.invoiceid', '=', 't3.id')
              ->select('invoiceid')
              ->where('t2.type', 'hosting')->where('t1.id', $product['id'])
              ->first();

            $vars['product'][$key]['invoiceid'] = !empty($data) ? $data->invoiceid : "-";
        }

      return ["product" => $vars['product']];
    }
});

 

Link to comment
Share on other sites

  • 3 weeks 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