[Skip to main content](#vessel-content)

#   Customer number in pdf invoice plugin

##

- **[web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile")**
- [![web-tiki's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/45235-web-tiki "View web-tiki's Profile") Topic Author
- [ Offline](/forum/user/45235-web-tiki)

Less More

- Posts: 20
- Thank you received: 0
-
-

7 years 11 months ago -  7 years 11 months ago [\#301911](#301911) by [web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile")  *[Customer number in pdf invoice plugin](/forum/25-install-update/896525-customer-number-in-pdf-invoice-plugin#301911 "-- 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 :  &#42; custom field I called user type that has 2 possible values  &#42; 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 :  I suppose I can't use hikashop&#95;loadUser(true) at that point so how can I get the info to build my customer number?")* was created by *[web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile")*

-- 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:

&lt;?php $user = hikashop_loadUser(true); $userType = $user-&gt;user_type; $userHikashopId = $user-&gt;user_id; $codeClient = $userType . str_pad($userHikashopId, 6, '0', STR_PAD_LEFT); ?&gt; &lt;br/&gt; Code client : &lt;?php echo $codeClient; ?&gt;

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 11 months ago by [web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg5NjUyNS1jdXN0b21lci1udW1iZXItaW4tcGRmLWludm9pY2UtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86593
- Thank you received: 14334
-
-

7 years 11 months ago [\#301922](#301922) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Customer number in pdf invoice plugin](/forum/25-install-update/896525-customer-number-in-pdf-invoice-plugin#301922 "-- 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 :  &#42; custom field I called user type that has 2 possible values  &#42; 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 :  I suppose I can't use hikashop&#95;loadUser(true) at that point so how can I get the info to build my customer number?")*

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-&gt;get($order-&gt;order_user_id);

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg5NjUyNS1jdXN0b21lci1udW1iZXItaW4tcGRmLWludm9pY2UtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile")**
- [![web-tiki's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/45235-web-tiki "View web-tiki's Profile") Topic Author
- [ Offline](/forum/user/45235-web-tiki)

Less More

- Posts: 20
- Thank you received: 0
-
-

7 years 11 months ago [\#301938](#301938) by [web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile")  Replied by *[web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile")* on topic *[Customer number in pdf invoice plugin](/forum/25-install-update/896525-customer-number-in-pdf-invoice-plugin#301938 "-- 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 :  &#42; custom field I called user type that has 2 possible values  &#42; 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 :  I suppose I can't use hikashop&#95;loadUser(true) at that point so how can I get the info to build my customer number?")*

Thank you very much. This works as expected.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg5NjUyNS1jdXN0b21lci1udW1iZXItaW4tcGRmLWludm9pY2UtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.055 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
