Jump to content

Print EAN13 in Invoice


salvadorbiedma

Recommended Posts

Hello Friends!

Im trying to print the variable EAN13 in the PDF Invoice. Y have the following code:


            $pdf->Cell(0, 0, self::l('EAN13:'.$ean13->value.'.'), '');            $pdf->Ln(10);



Why it doesn't work? EAN13 is printed but not the variable which contain the information.

I really appreciate your help!
Thanks!

Link to comment
Share on other sites

I checked the PDF file source code.
The products information are loaded from ps_order_detail table. In this use product_ean13 instead of ean13.
So you need to use $product[product_ean13'] instead of $product['ean13'].

I have modified my code in my previous post. Please try the new one.

Link to comment
Share on other sites

I just tested following code in PDF, it works fine. Attached is generated PDF invoice. You can see at reference column printed is ean13 code I input at catalog.


Replace this line (around line# 698)

   $this->Cell($w[++$i], $lineSize, ($product['reference'] ? $product['reference'] : '--'), 'B');


with this line

   $this->Cell($w[++$i], $lineSize, ($product['product_ean13'] ? $product['product_ean13'] : '--'), 'B');



I don't which location you want to print the ean13, so it is difficult to give you an accurate instructions.

Link to comment
Share on other sites

  • 2 years later...

Hi,

 

I am using Prestashop 1.4.7.0.

 

I did the following in classes/PDF.php, line 893 :

- replacing

$this->Cell($w[++$i], $lineSize, $product['product_reference'], 'B');

by

$this->Cell($w[++$i], $lineSize, $product['product_ean13'], 'B');

 

But unfortunately, nothing changed both in the delivery slip and in the invoice.

The Reference is still displayed and the EAN13 code is not displayed.

 

Is there any other amendment to make in order to display the EAN13 bar-code on the delivery slip or on the invoice ?

 

Thank you in advance for any help.

 

Patrick

Link to comment
Share on other sites

Hi,

 

I finally managed to display the bar-code number in both the delivery slip and the invoice.

 

To get this, I replaced in classes/PDF.php, line 912 :

$this->Cell($w[++$i], $lineSize, ($product['product_reference'] ? Tools::iconv('utf-8', self::encoding(), $product['product_reference']) : '--'), 'B');

by

$this->Cell($w[++$i], $lineSize, ($product['product_ean13'] ? Tools::iconv('utf-8', self::encoding(), $product['product_ean13']) : '--'), 'B');

 

Is there a way to display, not only the bar-code digits, but also the bar-code image ?

 

 

Thank you in advance for any help.

 

Patrick

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...