Jump to content
Hamdi ben henda

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';

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More