Jump to content

Generate a Barcode image and send it by email Prestashop 1.7.5


Recommended Posts

Hello,

Can anyone please help me ,

i would like to attache a generated Barcode image (png) in the order_conf email

i started by generate the barcode image : 

$barcodeobj = new TCPDFBarcode($order->order_barcode, 'C128');
$barcode = base64_encode($barcodeobj->getBarcodePNG(1, 30, array(255,255,255)));

and then
Mail::Send(
(int) $order->id_lang, 'order_conf',
Context::getContext()->getTranslator()->trans( 'Order confirmation', array(), 'Emails.Subject', $orderLanguage->locale ),
$data,
$this->context->customer->email,
$this->context->customer->firstname . ' ' . $this->context->customer->lastname,
null,
null,
$barcode,
null,
_PS_MAIL_DIR_,
false,
(int) $order->id_shop
);

also i tried to attache it like this but i didn't work 

$extra_pdf = array();
$extra_pdf['content'] = $barcode.'.png';
$extra_pdf['name'] = 'barcode.png';
$extra_pdf['mime'] = 'image/png';

 

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