Jump to content

Romanooooooo

New Members
  • Posts

    3
  • Joined

  • Last visited

Romanooooooo's Achievements

Newbie

Newbie (1/14)

  • Conversation Starter Rare
  • First Post Rare
  • Week One Done Rare
  • One Month Later Rare
  • One Year In Rare

Recent Badges

0

Reputation

  1. Hello, in the customer confirmation email (order_conf.html) I should be able to add the product reference, name and quantity for each article. Is it normal that this is not a function included in the basic Prestashop? How can I add it in the easiest way please? Thank you
  2. @4you.software Hi, I would like to use the code you provided above, but my ./override/classes/Mail.php file already contains code. Is it possible to integrate your code without losing the code that is already there? Thanks Here is the actual Mail.php file : <?php if (! defined('_PS_VERSION_')){ exit(); } $modulePath = rtrim(_PS_MODULE_DIR_, '/') . '/mailhook/'; require_once $modulePath . 'MailMessage.php'; require_once $modulePath . 'MailMessageAttachment.php'; require_once $modulePath . 'MailMessageEvent.php'; class Mail extends MailCore{ /* * module: mailhook * date: 2022-10-01 16:33:25 * version: 1 */ public static function Send($id_lang, $template, $subject, $template_vars, $to, $to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null, $reply_to = null, $replyToName = null) { $message = new MailMessage(); $message ->setLangId($id_lang) ->setTemplateName($template) ->setSubject($subject) ->setTemplateVariables($template_vars) ->setToEmailAddress($to) ->setToName($to_name) ->setFromEmailAddress($from) ->setFromName($from_name) ->setTemplateFolderPath($template_path) ->setModeSMTP($mode_smtp) ->setShopId($id_shop) ->setBcc($bcc) ->setReplyTo($reply_to) ->setReplyToName($replyToName) ; if ($file_attachment !== null) { $message->setFileAttachment(new MailMessageAttachment($file_attachment)); } $event = new MailMessageEvent($template); $event->setDie($die); $event->addMessage($message); self::executeMailSendingHook($event); return self::processMailEvent($event); } /* * module: mailhook * date: 2022-10-01 16:33:25 * version: 1 */ public static function sendMailWithoutHook($id_lang, $template, $subject, $template_vars, $to, $to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null, $reply_to = null, $replyToName = null) { return parent::Send($id_lang, $template, $subject, $template_vars, $to, $to_name, $from, $from_name, $file_attachment, $mode_smtp, $template_path, $die, $id_shop, $bcc, $reply_to, $replyToName); } /* * module: mailhook * date: 2022-10-01 16:33:25 * version: 1 */ public static function sendMailMessageWithoutHook(MailMessage $message, $isDie) { $file_attachment = null; if ($message->getFileAttachment() !== null) { $file_attachment = $message->getFileAttachment()->toArray(); } return self::sendMailWithoutHook( $message->getLangId(), $message->getTemplateName(), $message->getSubject(), $message->getTemplateVariables(), $message->getToEmailAddress(), $message->getToName(), $message->getFromEmailAddress(), $message->getFromName(), $file_attachment, $message->getModeSMTP(), $message->getTemplateFolderPath(), $isDie, $message->getShopId(), $message->getBcc(), $message->getReplyTo(), $message->getReplyToName() ); } /* * module: mailhook * date: 2022-10-01 16:33:25 * version: 1 */ protected static function executeMailSendingHook(MailMessageEvent $event) { Hook::exec('actionMailSend', array( 'event' => $event )); } /* * module: mailhook * date: 2022-10-01 16:33:25 * version: 1 */ protected static function processMailEvent(MailMessageEvent $event) { $numberOfSuccessfulRecipients = 0; foreach ($event->getMessages() as $message) { $rs = self::sendMailMessageWithoutHook($message, $event->isDie()); if ($rs !== false) { $numberOfSuccessfulRecipients = $rs + $numberOfSuccessfulRecipients; } } if ($numberOfSuccessfulRecipients > 0) { return $numberOfSuccessfulRecipients; } else { return false; } } }
  3. Hello, I seems it does not work on 1.7.8.7. Has anyone looked for this? thanks
×
×
  • Create New...