Jump to content
thirty bees forum

Can't generate barcode in smarty


Bruno

Recommended Posts

Hi guys,

I made a customisation in prestashop 1.6.15, in delivery-slip.tpl to write a barcode with order id: 

{assign var=black value=[0,0,0]}{assign var=white value=[255,255,255]}
{assign var=stuff value=['position'=>'S', 'border'=>false, 'padding'=>3, 'fgcolor'=>$black, 'bgcolor'=>$white, 'text'=>true, 'font'=>'helvetica', 'fontsize'=>20, 'stretchtext'=>4]}
{assign var=params value=TCPDF::serializeTCPDFtagParameters(array("{$order->id}", 'C128', '', '', '0', 40, 0.4, $stuff, 'N'))}
 

<tcpdf method="write1DBarcode" params="{$barcode_params}" />

 

This doesn't work in TB 1.1.x (from github). First it crashes at TCPDF::serializeTCPDFtagParameters but if I move the function call in the controller it still doesn't run write1DBarcode.

This is a critical feature, needed to print carrier labels.

How can I fix it?

Link to comment
Share on other sites

14 hours ago, Bruno said:

Hi guys,

I made a customisation in prestashop 1.6.15, in delivery-slip.tpl to write a barcode with order id: 

{assign var=black value=[0,0,0]}{assign var=white value=[255,255,255]}
{assign var=stuff value=['position'=>'S', 'border'=>false, 'padding'=>3, 'fgcolor'=>$black, 'bgcolor'=>$white, 'text'=>true, 'font'=>'helvetica', 'fontsize'=>20, 'stretchtext'=>4]}
{assign var=params value=TCPDF::serializeTCPDFtagParameters(array("{$order->id}", 'C128', '', '', '0', 40, 0.4, $stuff, 'N'))}
 

<tcpdf method="write1DBarcode" params="{$barcode_params}" />

 

This doesn't work in TB 1.1.x (from github). First it crashes at TCPDF::serializeTCPDFtagParameters but if I move the function call in the controller it still doesn't run write1DBarcode.

This is a critical feature, needed to print carrier labels.

How can I fix it?

 

Class TCPDF doesn't contain static method serializeTCPDFtagParameters, there is only an instance method with the same name. You will need to instantiate the TCPDF object and run the method on it, ie:

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$barcodeParams = TCPDF::serializeTCPDFtagParameters([$order->id, 'C128', '', '', '0', 40, 0.4, $stuff, 'N']);

 

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...