- Posts: 20
- Thank you received: 0
Customer number in pdf invoice plugin
7 years 9 months ago - 7 years 9 months ago #301911
by web-tiki
Customer number in pdf invoice plugin was created by web-tiki
-- HikaShop version -- : 4.0.1
-- Joomla version -- : 3.9.1
-- PHP version -- : 7.2.12
-- Browser(s) name and version -- : Firefox 65.0b5
Hello,
I have configured the pdf invoice plugin to send the invoice with confirmation email. It works well but I have an issue :
I need to display a customer number in the ivoice. This number is made of 2 fields :
This is the code I user to display the number in attachinvoice/attachinvoice/invoice.php :
I suppose I can't use hikashop_loadUser(true) at that point so how can I get the info to build my customer number?
-- Joomla version -- : 3.9.1
-- PHP version -- : 7.2.12
-- Browser(s) name and version -- : Firefox 65.0b5
Hello,
I have configured the pdf invoice plugin to send the invoice with confirmation email. It works well but I have an issue :
I need to display a customer number in the ivoice. This number is made of 2 fields :
- custom field I called user type that has 2 possible values
- the hikashop user id
This is the code I user to display the number in attachinvoice/attachinvoice/invoice.php :
Code:
<?php
$user = hikashop_loadUser(true);
$userType = $user->user_type;
$userHikashopId = $user->user_id;
$codeClient = $userType . str_pad($userHikashopId, 6, '0', STR_PAD_LEFT);
?>
<br/>
Code client : <?php echo $codeClient; ?>
I suppose I can't use hikashop_loadUser(true) at that point so how can I get the info to build my customer number?
Last edit: 7 years 9 months ago by web-tiki.
Please Log in or Create an account to join the conversation.
7 years 9 months ago #301922
by nicolas
Replied by nicolas on topic Customer number in pdf invoice plugin
hikashop_loadUser is only to load the data of the user currently logged in.
Instead, you want to do that:
Instead, you want to do that:
Code:
$userClass = hikashop_get('class.user');
$user = $userClass->get($order->order_user_id);
Please Log in or Create an account to join the conversation.
7 years 9 months ago #301938
by web-tiki
Replied by web-tiki on topic Customer number in pdf invoice plugin
Thank you very much. This works as expected.
Please Log in or Create an account to join the conversation.
Time to create page: 0.190 seconds