I am customising WHMCS invoice template using invoicepdf.tpl
. It is a PHP script basically arrange data in HTML format and convert it to PDF. I can only see client info and invoice details in that file. How can I take product group details there?
Asked
Active
Viewed 1,304 times
1

Harikrishnan
- 9,688
- 11
- 84
- 127
-
have to read this document ? Link :- http://docs.whmcs.com/Products_and_Services – Bhavin Mar 13 '17 at 05:33
-
That describes how to add products via GUI. Not customisation or programming related. Thanks. – Harikrishnan Mar 13 '17 at 06:07
2 Answers
2
You have to use a whmcs invoice hook( https://developers.whmcs.com/hooks-reference/invoices-and-quotes/ ). For example:
- If you want to only customize the way it is displayed https://developers.whmcs.com/hooks-reference/invoices-and-quotes/#viewinvoicedetailspage .
- If you want to modify the invoice when created https://developers.whmcs.com/hooks-reference/invoices-and-quotes/#invoicecreation .
Then in the hook you can request the data you want from tblproductgroups or any other table if needed.

nathanr
- 150
- 1
- 9
2
This should do what you're looking for:
add_hook("InvoiceCreationPreEmail", 1, "invoice_productgroup");
function invoice_productgroup($vars)
{
$result = full_query("SELECT id, description, (SELECT (SELECT (SELECT tblproductgroups.name FROM tblproductgroups WHERE id = tblproducts.gid) FROM tblproducts WHERE id = tblhosting.packageid) FROM tblhosting WHERE id = tblinvoiceitems.relid) AS groupname FROM tblinvoiceitems WHERE invoiceid='".$vars['invoiceid']."' AND type='Hosting';");
while($data = mysql_fetch_array ($result))
if($data['groupname'] !== NULL)
update_query("tblinvoiceitems", array("description" => $data['groupname']." - ".$data['description']), array("id" => $data['id']));
}
https://whmcs.community/topic/126837-product-group-in-invoice-item-description/

sMyles
- 2,418
- 1
- 30
- 44