product code in pdf invoice

  • Posts: 23
  • Thank you received: 0
10 years 3 months ago #165987

-- url of the page with the problem -- : local
-- HikaShop version -- : 2.3.2
-- Joomla version -- : 3.3.2
-- PHP version -- : 5.5.11
-- Browser(s) name and version -- : Firefox 31.0

Hi
I use the pdf invoice plugin.
I'd like to display the product code in my pdf invoice.
I'd lke to have the product code with the product name.
I do have the product code in the email but not in the pdf invoice.
What do I need to add?
Thanks in advance

Last edit: 10 years 1 month ago by ip-studio.

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

  • Posts: 12953
  • Thank you received: 1778
10 years 3 months ago #166004

Hello,
Note that the display of the PDF invoice is customizable through the file: "plugins/hikashop/attachinvoice/attachinvoice/invoice.php".

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

  • Posts: 23
  • Thank you received: 0
10 years 2 months ago #166088

Hi,
Yes I've already customized the invoice but I'm not really good with php coding... So I'm wondering if someone already did that by the past and could give me the piece of code to add in the file.

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

  • Posts: 13201
  • Thank you received: 2322
10 years 2 months ago #166097

Hi,

In that file you just have to add:

echo $product->order_product_code;
After:
<?php echo implode('<br/>',$this->str_split_unicode(strip_tags($product->order_product_name),50));

Last edit: 10 years 2 months ago by nicolas.

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

  • Posts: 344
  • Thank you received: 3
10 years 2 months ago #166568

This solution does not work,
I tried implementing

echo $product->order_product_name
on line life below, and after....

....and both times it gives me an error.

Any solution ?

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

  • Posts: 82683
  • Thank you received: 13337
  • MODERATOR
10 years 2 months ago #166573

Indeed the code of Xavier was not correct. I've fixed it.

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

  • Posts: 23
  • Thank you received: 0
10 years 2 months ago #167967

Thank you Xavier and Nicolas, that works perfectly!

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

  • Posts: 344
  • Thank you received: 3
9 years 11 months ago #178474

I downloaded the latest version of the "Attach Invoice to the order confirmation e-mail" plugin in order to bulk print invoices from the back-end.

But I need the Product Code to display in these invoices ?

It use to work with an earlier version like described in this thread. But not with the latest version.

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

  • Posts: 23
  • Thank you received: 0
9 years 11 months ago #178479

Hi
Just add :
echo $product->order_product_code;
where you except to see the code in plugins/hikashop/attachinvoice/attachinvoice/invoice.php

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

  • Posts: 13201
  • Thank you received: 2322
9 years 11 months ago #178480

Hi,

Are you sure that you are editing the file correctly, that there is no other override ?

The given code must still be working, there was no changes in the plugin.
You have maybe added the code at teh wrong place, please try to change the code position and not in a if condition.

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

  • Posts: 344
  • Thank you received: 3
8 years 10 months ago #223734

ip-studio wrote: Hi
Just add :
echo $product->order_product_code;
where you except to see the code in plugins/hikashop/attachinvoice/attachinvoice/invoice.php


This works fine, and my product code(red underlined) is displaying like this in the invoice:



I need it do display like this (red underline), on a separate line.



Any advice on how to fix this ?

Attachments:

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

  • Posts: 82683
  • Thank you received: 13337
  • MODERATOR
8 years 10 months ago #223765

You can do like that:
echo '<br/>'.$product->order_product_code;

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

  • Posts: 344
  • Thank you received: 3
8 years 10 months ago #223888

It works perfect. One last question:

It is possible to include the brand name of the product in the invoice. Plese see image on how I want it to look (brand name is illustrated with red)



Any advice on how to do this ?

Attachments:
Last edit: 8 years 10 months ago by river.

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

  • Posts: 82683
  • Thank you received: 13337
  • MODERATOR
8 years 10 months ago #223912

It's more complex:

$productClass = hikashop_get('class.product');
$productData = $productClass->get($product->product_id);
$categoryClass = hikashop_get('class.category');
$category = $categoryClass->get($productData->product_manufacturer_id);
echo $category->category_name;

The following user(s) said Thank You: river

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

  • Posts: 344
  • Thank you received: 3
8 years 10 months ago #223963

Perfect ....it works, Tnx a lot !

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

  • Posts: 344
  • Thank you received: 3
8 years 8 months ago #228528

nicolas wrote: It's more complex:

$productClass = hikashop_get('class.product');
$productData = $productClass->get($product->product_id);
$categoryClass = hikashop_get('class.category');
$category = $categoryClass->get($productData->product_manufacturer_id);
echo $category->category_name;


Note: Hikashop version: 2.6

OK this works fine, but I have a little problem.

When the products has Characteristics/with variants the brand name does not display.

When the product has no variants the brand name display's just fine.

In the product with variants I use different product codes. i.e:

Original product code: 660021_01
Variant a product code: 660021
Variant b product code: 660022

The invoice is displaying the correct product code, but I am missing the brand name with the products with "variants"

Any advice ?

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

  • Posts: 82683
  • Thank you received: 13337
  • MODERATOR
8 years 8 months ago #228574

It's more complex in that case:

$productClass = hikashop_get('class.product');
$productData = $productClass->get($product->product_id);
if($productData->product_parent_id){
 $parentProductData = $productClass->get($product->product_parent_id);
 $productData->product_manufacturer_id = $parentProductData->product_manufacturer_id;
}
$categoryClass = hikashop_get('class.category');
$category = $categoryClass->get($productData->product_manufacturer_id);
echo $category->category_name;

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

  • Posts: 344
  • Thank you received: 3
8 years 8 months ago #229723

Very nice, it works ! tnx a lot :)

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

  • Posts: 344
  • Thank you received: 3
8 years 5 months ago #239857

Note: Hikashop 2.6.1

OK I will just continue using this thread since I am probarly the only person with this request.

It is possible to include the product quantity or a message saying: "Product on stock" in the product invoice.
Like this:



I only need this message to be displayed if the quantity of the product is 1 or above.

I have some products the have Quantity: Unlimited, but on these products I do not need the message to be displayed since these products are not in my own warehouse.

Looking forward to hear from you.

Attachments:

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

  • Posts: 82683
  • Thank you received: 13337
  • MODERATOR
8 years 5 months ago #239861

Hi,

You can do like that:

$productClass = hikashop_get('class.product');
$productData = $productClass->get($product->product_id);
if($productData->product_quantity>0) echo 'Product on stock';

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

Time to create page: 0.132 seconds
Powered by Kunena Forum