Custom field display in the PDF plugin invoic

  • Posts: 48
  • Thank you received: 0
  • Hikashop Multisite
1 week 1 day ago #368778

-- HikaShop version -- : 6.1.0
-- Joomla version -- : 4.4.13
-- PHP version -- : 8

Hello, I have the invoice PDF plugin installed and I need to include a custom text field in the product table (it’s a batch for traceability). How can I do this? Thank you.

Please Log in or Create an account to join the conversation.

  • Posts: 84497
  • Thank you received: 13739
  • MODERATOR
1 week 1 day ago #368780

Hi,

Go in the menu Display>Views and search for the pdf_layout view.
You'll find the 4 different layout files corresponding to the "layout" setting in the PDF invoice plugin.
So edit the one corresponding to the layout you're using.
There, the product name is displayed with the code:

echo implode('<br/>',$this->str_split_unicode(strip_tags($product->order_product_name),50));
In $product , you don't directly have the custom product fields data, however you have the product_id.
So, you can use such code, below the product name display code:
$productClass = hikashop_get('class.product');
$productData = $productClass->get($product->product_id);
echo '<br/>'. $productData->xxx;
where xxx is the column name of your custom product field.

Please Log in or Create an account to join the conversation.

Time to create page: 0.054 seconds
Powered by Kunena Forum