Guest Posted November 1, 2011 Share Posted November 1, 2011 Hi I would like to take our internal reference number and add it to the PDF delivery slip as a Barcode. I can get the raw data there i think, and I know I "just" have to change the font of that raw data and it will display as a barcode I have a ttf file with the barcode font in, is there any way I can get the PDF code to use this or am i asking too much? Link to comment Share on other sites More sharing options...
Guest Posted November 9, 2011 Share Posted November 9, 2011 Sorry for the bump Any one help with this? Link to comment Share on other sites More sharing options...
Guest Posted November 14, 2011 Share Posted November 14, 2011 Likely not possible? Shame really I would have thought it would benefit many users Link to comment Share on other sites More sharing options...
ExpressTech Posted October 11, 2014 Share Posted October 11, 2014 This will help you. https://www.xtendify.com/en/modules/prestashop/billing-invoicing/7-invoice-and-delivery-barcode-generator Link to comment Share on other sites More sharing options...
irrelevant Posted May 23, 2015 Share Posted May 23, 2015 (edited) Because I searched and searched and couldn't find an answer, just lots of people asking, here is a solution. This adds a barcode with the order number in it under the address on the invoice - I'm going to be using it for dispatch tracking - But you can use the exact same technique to create barcodes of anything printable anywhere on the templates. Tested on PS 1.6.0.14. Within /pdf/invoice.tpl Just before </table> <!-- / ADDRESSES add <tr> <td style="width: 17%"></td> <td style="width: 83%"> {assign var=black value=[0,0,0]}{assign var=white value=[255,255,255]} {assign var=stuff value=['position'=>'S', 'border'=>false, 'padding'=>4, 'fgcolor'=>$black, 'bgcolor'=>$white, 'text'=>false, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4]} {assign var=params value=TCPDF::serializeTCPDFtagParameters(array($order->getUniqReference(), 'C39', '', '', 40, 15, 0.4, $stuff, 'N'))} <tcpdf method="write1DBarcode" params="{$params}" /> </td> </tr> The item to be barcoded is , in this case, '$order->getUniqReference()' - you can use any variable available to smarty at the point you want to print. For changing the size/style etc, see the TCPDF reference. HTH Edited May 23, 2015 by irrelevant (see edit history) Link to comment Share on other sites More sharing options...
HARI DUDDELA Posted May 25, 2015 Share Posted May 25, 2015 (edited) Because I searched and searched and couldn't find an answer, just lots of people asking, here is a solution. This adds a barcode with the order number in it under the address on the invoice - I'm going to be using it for dispatch tracking - But you can use the exact same technique to create barcodes of anything printable anywhere on the templates. Tested on PS 1.6.0.14. Within /pdf/invoice.tpl Just before </table> <!-- / ADDRESSES add <tr> <td style="width: 17%"></td> <td style="width: 83%"> {assign var=black value=[0,0,0]}{assign var=white value=[255,255,255]} {assign var=stuff value=['position'=>'S', 'border'=>false, 'padding'=>4, 'fgcolor'=>$black, 'bgcolor'=>$white, 'text'=>false, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4]} {assign var=params value=TCPDF::serializeTCPDFtagParameters(array($order->getUniqReference(), 'C39', '', '', 40, 15, 0.4, $stuff, 'N'))} <tcpdf method="write1DBarcode" params="{$params}" /> </td> </tr> The item to be barcoded is , in this case, '$order->getUniqReference()' - you can use any variable available to smarty at the point you want to print. For changing the size/style etc, see the TCPDF reference. HTH Thanks for your code barcode print on invoice It's Working but i have an error in invoice Strict Standards: Non-static method TCPDF::serializeTCPDFtagParameters() should not be called statically in /home/districtcart/public_html/tools/smarty/sysplugins/smarty_internal_templatebase.php(171) : eval()'d code on line 152 can u Please help me to rectify this error in invoice Thanks in Advance Edited May 25, 2015 by harid (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted May 25, 2015 Share Posted May 25, 2015 Disable Debug mode. Link to comment Share on other sites More sharing options...
HARI DUDDELA Posted May 26, 2015 Share Posted May 26, 2015 Disable Debug mode. i am already disable debug mode here is the disable debug code /* Debug only */ if (!defined('_PS_MODE_DEV_')) define('_PS_MODE_DEV_', false); /* Compatibility warning */ define('_PS_DISPLAY_COMPATIBILITY_WARNING_', false); if (_PS_MODE_DEV_ === true) { @ini_set('display_errors', 'on'); @error_reporting(E_ALL | E_STRICT); define('_PS_DEBUG_SQL_', true); } else { @ini_set('display_errors', 'off'); define('_PS_DEBUG_SQL_', false); } define('_PS_DEBUG_PROFILING_', false); define('_PS_MODE_DEMO_', false); Link to comment Share on other sites More sharing options...
irrelevant Posted May 26, 2015 Share Posted May 26, 2015 Try adding an error_reporting(0); in front of that lot. Link to comment Share on other sites More sharing options...
HARI DUDDELA Posted May 27, 2015 Share Posted May 27, 2015 (edited) Try adding an error_reporting(0);in front of that lot. Thanks for your above barcode code print on invoice It's Working but i have an error in invoice Strict Standards: Non-static method TCPDF::serializeTCPDFtagParameters() should not be called statically in /home/districtcart/public_html/tools/smarty/sysplugins/smarty_internal_templatebase.php(171) : eval()'d code on line 152 Below error invoice pdf file has been attached can u Please help me to rectify this error in invoice Thanks in Advance VVS_INV_000027.pdf Edited May 27, 2015 by HARI DUDDELA (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted May 27, 2015 Share Posted May 27, 2015 You can also discard Strict Standards errors in php.ini. Link to comment Share on other sites More sharing options...
HARI DUDDELA Posted May 28, 2015 Share Posted May 28, 2015 (edited) You can also discard Strict Standards errors in php.ini. Thanks tuk problem solved in invoice I have an another strict standard error in homepage Strict Standards: Declaration of Dispatcher::loadRoutes() should be compatible with DispatcherCore::loadRoutes($id_shop = NULL) in /home/districtcart/public_html/override/classes/Dispatcher.php on line 36 Warning: Cannot modify header information - headers already sent by (output started at /home/districtcart/public_html/override/classes/Dispatcher.php:36) in/home/districtcart/public_html/classes/controller/FrontController.php on line 823 Warning: Cannot modify header information - headers already sent by (output started at /home/districtcart/public_html/override/classes/Dispatcher.php:36) in/home/districtcart/public_html/classes/controller/FrontController.php on line 824 Can u please help me to rectify this error Thank in advance Edited May 28, 2015 by HARI DUDDELA (see edit history) Link to comment Share on other sites More sharing options...
irrelevant Posted May 29, 2015 Share Posted May 29, 2015 That one looks like a problem in code added to the override folder - usually by a module. Have you added any lately? Link to comment Share on other sites More sharing options...
gkorolkov Posted April 8, 2016 Share Posted April 8, 2016 irrelevant's solution works. If you want to get rid of the error in pdf and do not mind changing php files you could do the following (tested on PS 1.5): 1. In HTMLTemplateInvoice.php in /classes/pdf or /override/classes/pdf (if you have it there) add the following three lines to getContent() function before $this->smarty->assign(array( $pdf = new PDFGenerator((bool)Configuration::get('PS_PDF_USE_CACHE')); $barcode_params = $pdf->serializeTCPDFtagParameters(array($this->order->getUniqReference(), 'C128', '', '', 0, 0, 0.2, array('position'=>'S', 'border'=>false, 'padding'=>0, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>true, 'font'=>'freesans', 'fontsize'=>8, 'stretchtext'=>0), 'N')); $this->smarty->assign(array('barcode_params' => $barcode_params)); 2. In your invoice.tpl template (in my case it was in /themes/my_theme/pdf) add where you want to place the barcode: <tcpdf method="write1DBarcode" params="{$barcode_params}" /> 3. Change $this->order->getUniqReference() in step 1 to whatever you want to be coded in the barcode. I have order reference there. Read documentation to TCPDF write1DBarcode function here and change barcode parameters to you liking (font, size, border, padding, etc). Have fun! 1 Link to comment Share on other sites More sharing options...
Diamonde Posted October 12, 2016 Share Posted October 12, 2016 I have issue when I add <tcpdf method="write1DBarcode" params="{$barcode}"> to pdf.header.tpl just right after {$title} I generate barcode with $pdf = new PDFGenerator((bool)Configuration::get('PS_PDF_USE_CACHE')); $barcode_params = $pdf->serializeTCPDFtagParameters(array(Configuration::get('PS_INVOICE_PREFIX', (int)$order->id_lang, null, $order->id_shop).sprintf('%06d', $order->invoice_number), 'C128', '', '', 0, 0, 0.2, array('position'=>'S', 'border'=>false, 'padding'=>0, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>true, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>0), 'N')); $this->barcode = array('barcode' => $barcode_params); in HTMLTemplateInvoice.php and added 'barcode' => $this->barcode to classes/pdf/HTMLTemplate.php When I uncomment the <tcpdf method="write1DBarcode" params="{$barcode}"> no logo, title and barcode is shown. Link to comment Share on other sites More sharing options...
Solver Posted July 18, 2017 Share Posted July 18, 2017 Thank you it's working for me in prestashop 1.6 Because I searched and searched and couldn't find an answer, just lots of people asking, here is a solution. This adds a barcode with the order number in it under the address on the invoice - I'm going to be using it for dispatch tracking - But you can use the exact same technique to create barcodes of anything printable anywhere on the templates. Tested on PS 1.6.0.14. Within /pdf/invoice.tpl Just before </table> <!-- / ADDRESSES add <tr> <td style="width: 17%"></td> <td style="width: 83%"> {assign var=black value=[0,0,0]}{assign var=white value=[255,255,255]} {assign var=stuff value=['position'=>'S', 'border'=>false, 'padding'=>4, 'fgcolor'=>$black, 'bgcolor'=>$white, 'text'=>false, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4]} {assign var=params value=TCPDF::serializeTCPDFtagParameters(array($order->getUniqReference(), 'C39', '', '', 40, 15, 0.4, $stuff, 'N'))} <tcpdf method="write1DBarcode" params="{$params}" /> </td> </tr> The item to be barcoded is , in this case, '$order->getUniqReference()' - you can use any variable available to smarty at the point you want to print. For changing the size/style etc, see the TCPDF reference. HTH Link to comment Share on other sites More sharing options...
ietax Posted September 22, 2017 Share Posted September 22, 2017 (edited) Because I searched and searched and couldn't find an answer, just lots of people asking, here is a solution. This adds a barcode with the order number in it under the address on the invoice - I'm going to be using it for dispatch tracking - But you can use the exact same technique to create barcodes of anything printable anywhere on the templates. Tested on PS 1.6.0.14. Within /pdf/invoice.tpl Just before </table> <!-- / ADDRESSES add <tr> <td style="width: 17%"></td> <td style="width: 83%"> {assign var=black value=[0,0,0]}{assign var=white value=[255,255,255]} {assign var=stuff value=['position'=>'S', 'border'=>false, 'padding'=>4, 'fgcolor'=>$black, 'bgcolor'=>$white, 'text'=>false, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4]} {assign var=params value=TCPDF::serializeTCPDFtagParameters(array($order->getUniqReference(), 'C39', '', '', 40, 15, 0.4, $stuff, 'N'))} <tcpdf method="write1DBarcode" params="{$params}" /> </td> </tr> The item to be barcoded is , in this case, '$order->getUniqReference()' - you can use any variable available to smarty at the point you want to print. For changing the size/style etc, see the TCPDF reference. HTH perfect. it works. how can I add it inside mail from Mailalert module? thanks Edited September 22, 2017 by ietax (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts