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

#   Make a custom field display in the PDF plugin invoice

##

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile") Topic Author
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

9 years 11 months ago -  9 years 11 months ago [\#256795](#256795) by [river](/forum/user/9591-river "View river's Profile")  *[Make a custom field display in the PDF plugin invoice](/forum/4-how-to/887773-make-a-custom-field-display-in-the-pdf-plugin-invoice#256795 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.6.4 -- PHP version -- : 7  This is my custom field settings.  I've downloaded the latest version of the PDF and Hikashop business package. Like described in this thread.  If I disable the attach invoice PDF plugin the custom field is displaying fine in the standard invoice. It also displays fine in the order creation email.  Any advice on how to get it to display in the PDF invoice ?")* was created by *[river](/forum/user/9591-river "View river's Profile")*

-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.4
-- PHP version -- : 7

This is my custom field settings.

[ ![custom&#95;field&#95;setting.png](/forum/attachment/34989) ](/forum/attachment/34989 "...ld&#95;setting.png")

I've downloaded the latest version of the PDF and Hikashop business package. Like described in this thread.
[ This thread](https://www.hikashop.com/forum/install-update/886077-pdf-invoice-missing-custom-fields.html)

If I disable the attach invoice PDF plugin the custom field is displaying fine in the standard invoice. It also displays fine in the order creation email.

Any advice on how to get it to display in the PDF invoice ?

- [ ![custom&#95;field&#95;setting.png](/forum/attachment/34989) ](/forum/attachment/34989 "...ld&#95;setting.png") [ ](/forum/attachment/34989?download=1 "...ld&#95;setting.png")

Last edit: 9 years 11 months ago by [river](/forum/user/9591-river "View river's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg4Nzc3My1tYWtlLWEtY3VzdG9tLWZpZWxkLWRpc3BsYXktaW4tdGhlLXBkZi1wbHVnaW4taW52b2ljZT90bXBsPW1hcmtkb3du) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86555
- Thank you received: 14304
-
-

9 years 11 months ago [\#256818](#256818) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Make a custom field display in the PDF plugin invoice](/forum/4-how-to/887773-make-a-custom-field-display-in-the-pdf-plugin-invoice#256818 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.6.4 -- PHP version -- : 7  This is my custom field settings.  I've downloaded the latest version of the PDF and Hikashop business package. Like described in this thread.  If I disable the attach invoice PDF plugin the custom field is displaying fine in the standard invoice. It also displays fine in the order creation email.  Any advice on how to get it to display in the PDF invoice ?")*

Hi,

The thread you're linking to is about the display of custom item fields on the PDF invoice.
The PDF invoice plugin doesn't support yet the display of custom product fields, which is what you want.
So it's normal that it doesn't work.
Supporting it is a bit tricky as the PDF system requires giving a width for each column and thus it can't be standardized. With the HTML invoice, the table adapts itself to the available area so it's not a problem.
We couldn't think yet of a generic way to properly generate invoices with custom product fields.
So for now, I can only recommend to customize the file plugins/hikashop/attachinvoice/attachinvoice/invoice.php if you want to display the custom product fields there.

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

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile") Topic Author
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

9 years 11 months ago [\#256825](#256825) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[Make a custom field display in the PDF plugin invoice](/forum/4-how-to/887773-make-a-custom-field-display-in-the-pdf-plugin-invoice#256825 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.6.4 -- PHP version -- : 7  This is my custom field settings.  I've downloaded the latest version of the PDF and Hikashop business package. Like described in this thread.  If I disable the attach invoice PDF plugin the custom field is displaying fine in the standard invoice. It also displays fine in the order creation email.  Any advice on how to get it to display in the PDF invoice ?")*

OK that would work fine with me.

Could you please advice me what kind of code I need to implement in the invoice.php file in order to display my custom field ?

Tnx

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg4Nzc3My1tYWtlLWEtY3VzdG9tLWZpZWxkLWRpc3BsYXktaW4tdGhlLXBkZi1wbHVnaW4taW52b2ljZT90bXBsPW1hcmtkb3du) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86555
- Thank you received: 14304
-
-

9 years 11 months ago [\#256838](#256838) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Make a custom field display in the PDF plugin invoice](/forum/4-how-to/887773-make-a-custom-field-display-in-the-pdf-plugin-invoice#256838 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.6.4 -- PHP version -- : 7  This is my custom field settings.  I've downloaded the latest version of the PDF and Hikashop business package. Like described in this thread.  If I disable the attach invoice PDF plugin the custom field is displaying fine in the standard invoice. It also displays fine in the order creation email.  Any advice on how to get it to display in the PDF invoice ?")*

Hi,

Something like that: Code:

$class = hikashop_get("class.product"); $data = $class-&gt;get($product-&gt;product_id); echo $data-&gt;XXX;

where XXX is the column name of the custom field.

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

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile") Topic Author
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

9 years 11 months ago -  9 years 11 months ago [\#257148](#257148) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[Make a custom field display in the PDF plugin invoice](/forum/4-how-to/887773-make-a-custom-field-display-in-the-pdf-plugin-invoice#257148 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.6.4 -- PHP version -- : 7  This is my custom field settings.  I've downloaded the latest version of the PDF and Hikashop business package. Like described in this thread.  If I disable the attach invoice PDF plugin the custom field is displaying fine in the standard invoice. It also displays fine in the order creation email.  Any advice on how to get it to display in the PDF invoice ?")*

Tnx it works great.

So I've added a text snippet in front of the code which says delivery
Code:

echo "Delivery: "; $class = hikashop_get("class.product"); $data = $class-&gt;get($product-&gt;product_id); echo $data-&gt;deliverytime;

Not all my products use the above custom field.
So the problem now is that the text "Dilvery" is displaying in the pdf invoice even if the custom field is NOT filled out.

So I need to add an "If condition" so that the text "delivery" only displays when the custom field is filled out in the product and displayed in the invoice.

Any advice on how to write the if condition in the above code ?

tnx

Last edit: 9 years 11 months ago by [river](/forum/user/9591-river "View river's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg4Nzc3My1tYWtlLWEtY3VzdG9tLWZpZWxkLWRpc3BsYXktaW4tdGhlLXBkZi1wbHVnaW4taW52b2ljZT90bXBsPW1hcmtkb3du) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86555
- Thank you received: 14304
-
-

9 years 11 months ago [\#257160](#257160) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Make a custom field display in the PDF plugin invoice](/forum/4-how-to/887773-make-a-custom-field-display-in-the-pdf-plugin-invoice#257160 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.6.4 -- PHP version -- : 7  This is my custom field settings.  I've downloaded the latest version of the PDF and Hikashop business package. Like described in this thread.  If I disable the attach invoice PDF plugin the custom field is displaying fine in the standard invoice. It also displays fine in the order creation email.  Any advice on how to get it to display in the PDF invoice ?")*

Hi,

It's quite easy: Code:

$class = hikashop_get("class.product"); $data = $class-&gt;get($product-&gt;product_id); if(!empty($data-&gt;deliverytime)){ echo "Delivery: "; echo $data-&gt;deliverytime; }

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg4Nzc3My1tYWtlLWEtY3VzdG9tLWZpZWxkLWRpc3BsYXktaW4tdGhlLXBkZi1wbHVnaW4taW52b2ljZT90bXBsPW1hcmtkb3du) 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.052 seconds

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