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

#   PDF Invoice product custom fields

##

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

Less More

- Posts: 91
- Thank you received: 5
-
-

5 years 11 months ago [\#327069](#327069) by [bolando](/forum/user/38611-bolando "View bolando's Profile")  *[PDF Invoice product custom fields](/forum/27-checkout/901452-pdf-invoice-product-custom-fields#327069 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24 -- Browser(s) name and version -- : Chrome latest  Hello,  I have some product custom fields created and I want them to appear on the invoice, e.g. one of them is a statistical number. They appeared on HTML invoice correctly.  I have bought today PDF invoice plugin and changed PHP code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php to make the invoice look like I want. But I don't see custom fields there.  Questions: 1) How can I add product custom fields to products table in PDF invoice? Can you prepare a new version of the plugin maybe? I didn't expect that it doesn't support CF. 2) Is there a way to show net price and tax on the PDF invoice as well? 3) I addes some data in the footer in the plugin field in Joomla. But the Polish characters don't appear correctly, although I checked the dejavusans font which should support them. Polish characters in product data appear correctly on PDF invoice.  Thanks for your support.")* was created by *[bolando](/forum/user/38611-bolando "View bolando's Profile")*

-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.23
-- PHP version -- : 7.3.24
-- Browser(s) name and version -- : Chrome latest

Hello,

I have some product custom fields created and I want them to appear on the invoice, e.g. one of them is a statistical number.
They appeared on HTML invoice correctly.

I have bought today PDF invoice plugin and changed PHP code in
/plugins/hikashop/attachinvoice/attachinvoice/invoice.php
to make the invoice look like I want. But I don't see custom fields there.

Questions:
1) How can I add product custom fields to products table in PDF invoice? Can you prepare a new version of the plugin maybe? I didn't expect that it doesn't support CF.
2) Is there a way to show net price and tax on the PDF invoice as well?
3) I addes some data in the footer in the plugin field in Joomla. But the Polish characters don't appear correctly, although I checked the dejavusans font which should support them. Polish characters in product data appear correctly on PDF invoice.

Thanks for your support.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwMTQ1Mi1wZGYtaW52b2ljZS1wcm9kdWN0LWN1c3RvbS1maWVsZHM/dG1wbD1tYXJrZG93bg==) 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: 86587
- Thank you received: 14325
-
-

5 years 11 months ago [\#327080](#327080) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[PDF Invoice product custom fields](/forum/27-checkout/901452-pdf-invoice-product-custom-fields#327080 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24 -- Browser(s) name and version -- : Chrome latest  Hello,  I have some product custom fields created and I want them to appear on the invoice, e.g. one of them is a statistical number. They appeared on HTML invoice correctly.  I have bought today PDF invoice plugin and changed PHP code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php to make the invoice look like I want. But I don't see custom fields there.  Questions: 1) How can I add product custom fields to products table in PDF invoice? Can you prepare a new version of the plugin maybe? I didn't expect that it doesn't support CF. 2) Is there a way to show net price and tax on the PDF invoice as well? 3) I addes some data in the footer in the plugin field in Joomla. But the Polish characters don't appear correctly, although I checked the dejavusans font which should support them. Polish characters in product data appear correctly on PDF invoice.  Thanks for your support.")*

Hi,

1. It does support custom fields, but not of the table "product".
The reason is that with the PDF plugin, the columns need to be spaced manually in pixels based on the available columns and the width available. And if we don't know how many columns there is to display, we can't set the width adequately.
If we were to add support for them, then, the likely result would be some of the columns of the listing of products going out of the page.
So the problem you're raising it quite well known but unfortunately, we couldn't find a suitable solution for it.
If you really want to add an extra column, you can edit the invoice file and add the HTML / PHP / CSS code to display it.
But I don't recommend adding generic "custom product fields" support as additional columns of the listing, even if you're a developer, as you'll end up with the listing going out of the page with more than 1 or 2 columns, even with extra CSS to cope with them.

2. The invoice, be it with the PDF plugin or not, will always display the taxes between the subtotal and the total. And then total will always be NET.
The subtotal, and the price of each product can be either with or without taxes. It depends on how is configured the "show taxed prices" setting in the HikaShop configuration.
And if you want to force it, you can add such code at the beginning of the invoice.php file of the plugin:
&lt;?php $config-&gt;set('price_with_tax', 1); ?&gt;

3. Could you provide the text that you added in the footer so that we can try to reproduce the issue ?

The following user(s) said Thank You: [bolando](/forum/user/38611-bolando "View bolando's Profile")

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

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

Less More

- Posts: 91
- Thank you received: 5
-
-

5 years 11 months ago [\#327193](#327193) by [bolando](/forum/user/38611-bolando "View bolando's Profile")  Replied by *[bolando](/forum/user/38611-bolando "View bolando's Profile")* on topic *[PDF Invoice product custom fields](/forum/27-checkout/901452-pdf-invoice-product-custom-fields#327193 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24 -- Browser(s) name and version -- : Chrome latest  Hello,  I have some product custom fields created and I want them to appear on the invoice, e.g. one of them is a statistical number. They appeared on HTML invoice correctly.  I have bought today PDF invoice plugin and changed PHP code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php to make the invoice look like I want. But I don't see custom fields there.  Questions: 1) How can I add product custom fields to products table in PDF invoice? Can you prepare a new version of the plugin maybe? I didn't expect that it doesn't support CF. 2) Is there a way to show net price and tax on the PDF invoice as well? 3) I addes some data in the footer in the plugin field in Joomla. But the Polish characters don't appear correctly, although I checked the dejavusans font which should support them. Polish characters in product data appear correctly on PDF invoice.  Thanks for your support.")*

Hello,

Thanks for your answer

1) OK, I see the reason.
But still I can try to add the fields under each product name.
So after the code Code:

if ($config-&gt;get('show_code')) { echo '&lt;br/&gt;'.$product-&gt;order_product_code; } ?&gt;

in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php:224
I added Code:

&lt;br/&gt; &lt;?php $itemFields = $fieldsClass-&gt;getFields($item_type,$product,'product'); if(!empty($itemFields)){ foreach($itemFields as $field){ echo $namekey = $field-&gt;field_namekey; echo $fieldsClass-&gt;show($field,$product-&gt;$namekey); echo '&lt;br/&gt;'; } }?&gt;

It displays correct 3 custom field names, but not values. What am I doing wrong?

2) Thanks, that clarifies a bit.

3) Please try with "Prezes Zarządu" (CEO). It displays like "Prezes Zarz?du"

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwMTQ1Mi1wZGYtaW52b2ljZS1wcm9kdWN0LWN1c3RvbS1maWVsZHM/dG1wbD1tYXJrZG93bg==) 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: 86587
- Thank you received: 14325
-
-

5 years 11 months ago [\#327205](#327205) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[PDF Invoice product custom fields](/forum/27-checkout/901452-pdf-invoice-product-custom-fields#327205 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24 -- Browser(s) name and version -- : Chrome latest  Hello,  I have some product custom fields created and I want them to appear on the invoice, e.g. one of them is a statistical number. They appeared on HTML invoice correctly.  I have bought today PDF invoice plugin and changed PHP code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php to make the invoice look like I want. But I don't see custom fields there.  Questions: 1) How can I add product custom fields to products table in PDF invoice? Can you prepare a new version of the plugin maybe? I didn't expect that it doesn't support CF. 2) Is there a way to show net price and tax on the PDF invoice as well? 3) I addes some data in the footer in the plugin field in Joomla. But the Polish characters don't appear correctly, although I checked the dejavusans font which should support them. Polish characters in product data appear correctly on PDF invoice.  Thanks for your support.")*

Hi,

1. $product contains the data of the product in the order (from the hikashop_order_product table), not the data of the product (from the hikashop_product table).
So you would need to add such code:
$productClass = hikashop_get('class.product');
$productData = $productClass-&gt;get($product-&gt;product_id);
And then you can use $productData-&gt;$namekey instead of $product-&gt;$namekey

3. I was able to reproduce the issue on my end.
I worked on it the whole afternoon and I can see the issue comes from the HTML2PDF we're using which breaks UTF8 characters (at least some) in the footer. I looked into the HTML2PDF library to try to fix it, but I couldn't find how.
All I can propose is to not use the "footer" option if you want to add this text and instead edit the invoice.php file of the plugin to add your text before the &lt;/page&gt; tag at the end.
Or try not to use special characters.
A better solution would be to redo the plugin from scratch to use a more modern solution to generate the PDF but that's a big work.

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

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

Less More

- Posts: 91
- Thank you received: 5
-
-

5 years 11 months ago [\#327253](#327253) by [bolando](/forum/user/38611-bolando "View bolando's Profile")  Replied by *[bolando](/forum/user/38611-bolando "View bolando's Profile")* on topic *[PDF Invoice product custom fields](/forum/27-checkout/901452-pdf-invoice-product-custom-fields#327253 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24 -- Browser(s) name and version -- : Chrome latest  Hello,  I have some product custom fields created and I want them to appear on the invoice, e.g. one of them is a statistical number. They appeared on HTML invoice correctly.  I have bought today PDF invoice plugin and changed PHP code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php to make the invoice look like I want. But I don't see custom fields there.  Questions: 1) How can I add product custom fields to products table in PDF invoice? Can you prepare a new version of the plugin maybe? I didn't expect that it doesn't support CF. 2) Is there a way to show net price and tax on the PDF invoice as well? 3) I addes some data in the footer in the plugin field in Joomla. But the Polish characters don't appear correctly, although I checked the dejavusans font which should support them. Polish characters in product data appear correctly on PDF invoice.  Thanks for your support.")*

Hello,

1) Many thanks, I updated my code to Code:

&lt;br/&gt; &lt;?php $itemFields = $fieldsClass-&gt;getFields($item_type,$product,'product'); $productClass = hikashop_get('class.product'); $productData = $productClass-&gt;get($product-&gt;product_id); if(!empty($itemFields)){ foreach($itemFields as $field){ $namekey = $field-&gt;field_namekey; if ($productData-&gt;$namekey) { echo $namekey . ": ". $productData-&gt;$namekey ."&lt;br/&gt;"; } } }?&gt;

and it works now.

3) Thanks. The problem is that if I add this content to &lt;page&gt; than it's not always at the bottom of the page. I used even HTML entities but it didn't help. OK, if you change the plugin in the future, it will be a big help for many users.

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

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

Less More

- Posts: 91
- Thank you received: 5
-
-

5 years 11 months ago [\#327280](#327280) by [bolando](/forum/user/38611-bolando "View bolando's Profile")  Replied by *[bolando](/forum/user/38611-bolando "View bolando's Profile")* on topic *[PDF Invoice product custom fields](/forum/27-checkout/901452-pdf-invoice-product-custom-fields#327280 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24 -- Browser(s) name and version -- : Chrome latest  Hello,  I have some product custom fields created and I want them to appear on the invoice, e.g. one of them is a statistical number. They appeared on HTML invoice correctly.  I have bought today PDF invoice plugin and changed PHP code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php to make the invoice look like I want. But I don't see custom fields there.  Questions: 1) How can I add product custom fields to products table in PDF invoice? Can you prepare a new version of the plugin maybe? I didn't expect that it doesn't support CF. 2) Is there a way to show net price and tax on the PDF invoice as well? 3) I addes some data in the footer in the plugin field in Joomla. But the Polish characters don't appear correctly, although I checked the dejavusans font which should support them. Polish characters in product data appear correctly on PDF invoice.  Thanks for your support.")*

That's even a better version of the code, with full field names, in case somebody needs it: Code:

&lt;br/&gt; &lt;?php $itemFields = $fieldsClass-&gt;getFields($item_type,$product,'product'); $productClass = hikashop_get('class.product'); $productData = $productClass-&gt;get($product-&gt;product_id); if(!empty($itemFields)){ foreach($itemFields as $field){ $namekey = $field-&gt;field_namekey; if ($productData-&gt;$namekey) { echo $fieldsClass-&gt;getFieldName($field) . ": ". $productData-&gt;$namekey ."&lt;br/&gt;"; } } }?&gt;

The following user(s) said Thank You: [deboni](/forum/user/61732-deboni "View deboni's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwMTQ1Mi1wZGYtaW52b2ljZS1wcm9kdWN0LWN1c3RvbS1maWVsZHM/dG1wbD1tYXJrZG93bg==) 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: 86587
- Thank you received: 14325
-
-

5 years 11 months ago [\#327274](#327274) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[PDF Invoice product custom fields](/forum/27-checkout/901452-pdf-invoice-product-custom-fields#327274 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24 -- Browser(s) name and version -- : Chrome latest  Hello,  I have some product custom fields created and I want them to appear on the invoice, e.g. one of them is a statistical number. They appeared on HTML invoice correctly.  I have bought today PDF invoice plugin and changed PHP code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php to make the invoice look like I want. But I don't see custom fields there.  Questions: 1) How can I add product custom fields to products table in PDF invoice? Can you prepare a new version of the plugin maybe? I didn't expect that it doesn't support CF. 2) Is there a way to show net price and tax on the PDF invoice as well? 3) I addes some data in the footer in the plugin field in Joomla. But the Polish characters don't appear correctly, although I checked the dejavusans font which should support them. Polish characters in product data appear correctly on PDF invoice.  Thanks for your support.")*

Hi,

2. The only solution I can see with the current PDF plugin is to create an image with the text you want in the footer, upload it to the joomla media manager and add the img tag of that image in the footer setting.
That way, you'll avoid the issue of the UTF8 characters not being rendered properly in the footer.

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

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