Skip to main content

Customer number in pdf invoice plugin

More
7 years 9 months ago - 7 years 9 months ago #301911 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 :
  1. custom field I called user type that has 2 possible values
  2. the hikashop user id
I manage to make it work when I request the invoice from the backend (click on invoice in order administration) But it doesn't work when the invoice is sent by mail and returns 000000
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.

More
7 years 9 months ago #301922 by nicolas
hikashop_loadUser is only to load the data of the user currently logged in.
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.

More
7 years 9 months ago #301938 by web-tiki
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
Powered by Kunena Forum