Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

[help] Plugin to change number in barcode

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
Photon
Smarty n00b


Joined: 25 Apr 2015
Posts: 3

PostPosted: Sat Apr 25, 2015 2:25 pm    Post subject: [help] Plugin to change number in barcode Reply with quote

Hello,

hello I am a french Prestashop CMS user using Smarty v3.

I would like an opinion on an issue.
I created a plugin to change a number (EAN/UPC code) in barcode.
in certain files tpl it works as desired.
I have a problem when the plugin is used in a template file that ultimately serves to generate a pdf. I have no errors, but the barcode is not displayed. If I call the variable (a number) unmodified it appears good.

here is the code of plugin modifier.barcode.php :
Code:
<?php
/**
 * Smarty plugin
 */

function smarty_modifier_barcode($bc)
{
require_once('barcodes.php');
// include 1D barcode class

// set the barcode content and type
$barcodeobj = new TCPDFBarcode($bc, 'EAN13');

// output the barcode as HTML object
return $barcodeobj->getBarcodeHTML(1, 20, 'black');
}


The code use tcpdf librairy.
I dont understand why the result is different in two template file (.tpl).
If someone can help me it would be cool, i'm not an expert. and Smarty documentation not helped me Sad

Regards,
Chris
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sun Apr 26, 2015 4:07 am    Post subject: Reply with quote

This is not a Smarty problem.

I think for some reason the output of $barcodeobj->getBarcodeHTML(1, 20, 'black'); can't be converted to PDF.
Back to top
View user's profile Send private message
Photon
Smarty n00b


Joined: 25 Apr 2015
Posts: 3

PostPosted: Mon Apr 27, 2015 9:14 am    Post subject: Reply with quote

thanks for your answer.

I thought the tpl file created an html output which itself was converted into pdf by TCPDF class.

the output of $barcodeobj generate a simple <div> element with a lot of <div> inside.

Do you think a smarty function could be better ?
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Mon Apr 27, 2015 6:11 pm    Post subject: Reply with quote

Again I think the problem is that TCPDF does not convert <div> element created by $barcodeobj->getBarcodeHTML(1, 20, 'black') to PDF.

It's not a Smarty problem. You should contact the authors of TCPDF.
Back to top
View user's profile Send private message
Photon
Smarty n00b


Joined: 25 Apr 2015
Posts: 3

PostPosted: Tue Apr 28, 2015 8:02 am    Post subject: Reply with quote

ok, thank you.
I will keep my modifier to display barcodes in the website and look for other solution for pdf output.

regards.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP