Add custom email variable to invoice emailhow to add custom data in order email in magento 2How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlRemove Price from email invoice?Custom variable in emailmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Add custom e-mail variableMagento 2 Sending emails triggered by observerMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom Options
Is there enough fresh water in the world to eradicate the drinking water crisis?
What is the opposite of 'gravitas'?
Is the next prime number always the next number divisible by the current prime number, except for any numbers previously divisible by primes?
Can a Bard use an arcane focus?
Partial sums of primes
How to be able to process a large JSON response?
Modern Day Chaucer
Resetting two CD4017 counters simultaneously, only one resets
Blender - show edges angles “direction”
Have I saved too much for retirement so far?
Why are on-board computers allowed to change controls without notifying the pilots?
Why are all the doors on Ferenginar (the Ferengi home world) far shorter than the average Ferengi?
Simulating a probability of 1 of 2^N with less than N random bits
Bob has never been a M before
Should my PhD thesis be submitted under my legal name?
Can the electrostatic force be infinite in magnitude?
Are Warlocks Arcane or Divine?
QGIS Geometry Generator Line Type
Perfect riffle shuffles
How do ultrasonic sensors differentiate between transmitted and received signals?
Is it okay / does it make sense for another player to join a running game of Munchkin?
What should I use for Mishna study?
Meta programming: Declare a new struct on the fly
Why does this part of the Space Shuttle launch pad seem to be floating in air?
Add custom email variable to invoice email
how to add custom data in order email in magento 2How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlRemove Price from email invoice?Custom variable in emailmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Add custom e-mail variableMagento 2 Sending emails triggered by observerMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom Options
I am referring to question -
how to add custom data in order email in magento 2
Below is by observer execute method
public function execute(MagentoFrameworkEventObserver $observer)
/** @var MagentoFrameworkAppActionAction $controller */
$transport = $observer->getTransport();
$transport['businessname'] = "XYZ";
Below is my event.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="email_invoice_set_template_vars_before">
<observer name="custom_invoice_email_variable" instance="VendorNameModuleNameObserverSalesInvoiceTemplateVarsBefore" />
</event>
</config>
I am calling it in a template as - raw . But still I am not getting it in the email template. I checked by putting logs in observer and my observer method is getting called, But the variable is not get set and not shown in invoice template.
Please help.
magento2 email-templates invoice
add a comment |
I am referring to question -
how to add custom data in order email in magento 2
Below is by observer execute method
public function execute(MagentoFrameworkEventObserver $observer)
/** @var MagentoFrameworkAppActionAction $controller */
$transport = $observer->getTransport();
$transport['businessname'] = "XYZ";
Below is my event.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="email_invoice_set_template_vars_before">
<observer name="custom_invoice_email_variable" instance="VendorNameModuleNameObserverSalesInvoiceTemplateVarsBefore" />
</event>
</config>
I am calling it in a template as - raw . But still I am not getting it in the email template. I checked by putting logs in observer and my observer method is getting called, But the variable is not get set and not shown in invoice template.
Please help.
magento2 email-templates invoice
1
Maybe Magento bug: github.com/magento/magento2/issues/10210
– PY Yick
Nov 17 '17 at 8:44
add a comment |
I am referring to question -
how to add custom data in order email in magento 2
Below is by observer execute method
public function execute(MagentoFrameworkEventObserver $observer)
/** @var MagentoFrameworkAppActionAction $controller */
$transport = $observer->getTransport();
$transport['businessname'] = "XYZ";
Below is my event.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="email_invoice_set_template_vars_before">
<observer name="custom_invoice_email_variable" instance="VendorNameModuleNameObserverSalesInvoiceTemplateVarsBefore" />
</event>
</config>
I am calling it in a template as - raw . But still I am not getting it in the email template. I checked by putting logs in observer and my observer method is getting called, But the variable is not get set and not shown in invoice template.
Please help.
magento2 email-templates invoice
I am referring to question -
how to add custom data in order email in magento 2
Below is by observer execute method
public function execute(MagentoFrameworkEventObserver $observer)
/** @var MagentoFrameworkAppActionAction $controller */
$transport = $observer->getTransport();
$transport['businessname'] = "XYZ";
Below is my event.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="email_invoice_set_template_vars_before">
<observer name="custom_invoice_email_variable" instance="VendorNameModuleNameObserverSalesInvoiceTemplateVarsBefore" />
</event>
</config>
I am calling it in a template as - raw . But still I am not getting it in the email template. I checked by putting logs in observer and my observer method is getting called, But the variable is not get set and not shown in invoice template.
Please help.
magento2 email-templates invoice
magento2 email-templates invoice
asked Nov 17 '17 at 6:27
manish_khotmanish_khot
14011
14011
1
Maybe Magento bug: github.com/magento/magento2/issues/10210
– PY Yick
Nov 17 '17 at 8:44
add a comment |
1
Maybe Magento bug: github.com/magento/magento2/issues/10210
– PY Yick
Nov 17 '17 at 8:44
1
1
Maybe Magento bug: github.com/magento/magento2/issues/10210
– PY Yick
Nov 17 '17 at 8:44
Maybe Magento bug: github.com/magento/magento2/issues/10210
– PY Yick
Nov 17 '17 at 8:44
add a comment |
2 Answers
2
active
oldest
votes
Its a bug of magento as wrote in the comment of your question.
I resolved the problem in this way (but I changed order comments email vars, but use same changes for invoice core classes):
1) I created preference class for core class because it bad way write code in core file.
- added in di.xml code
<preference for="MagentoSalesModelOrderEmailSenderOrderCommentSender" type="NamespaceExtensionNameModelOrderEmailSenderOrderCommentSender" />
2) Fixed source code in my class. The main idea: we added prepareTemplate and we need extend source MagentoSalesModelOrderEmailSenderOrderCommentSender to prevent another core error.
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace SfdevSecretDeliveryModelOrderEmailSender;
use MagentoFrameworkOauthException;
use MagentoSalesModelOrder;
use MagentoSalesModelOrderEmailContainerOrderCommentIdentity;
use MagentoSalesModelOrderEmailContainerTemplate;
use MagentoSalesModelOrderEmailNotifySender;
use MagentoSalesModelOrderAddressRenderer;
use MagentoFrameworkEventManagerInterface;
/**
* Class OrderCommentSender
*/
class OrderCommentSender extends **MagentoSalesModelOrderEmailSenderOrderCommentSender**
/**
* @var Renderer
*/
protected $addressRenderer;
/**
* Application Event Dispatcher
*
* @var ManagerInterface
*/
protected $eventManager;
**public $comment = '';**
/**
* @param Template $templateContainer
* @param OrderCommentIdentity $identityContainer
* @param OrderEmailSenderBuilderFactory $senderBuilderFactory
* @param PsrLogLoggerInterface $logger
* @param Renderer $addressRenderer
* @param ManagerInterface $eventManager
*/
public function __construct(
Template $templateContainer,
OrderCommentIdentity $identityContainer,
MagentoSalesModelOrderEmailSenderBuilderFactory $senderBuilderFactory,
PsrLogLoggerInterface $logger,
Renderer $addressRenderer,
ManagerInterface $eventManager
)
parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger, $addressRenderer, $eventManager);
$this->addressRenderer = $addressRenderer;
$this->eventManager = $eventManager;
/**
* Send email to customer
*
* @param Order $order
* @param bool $notify
* @param string $comment
* @return bool
*/
public function send(Order $order, $notify = true, $comment = '')
**$this->comment = $comment;**
return $this->checkAndSend($order, $notify);
/**
* Prepare email template with variables
*
* @param Order $order
* @return void
*/
**protected function prepareTemplate(Order $order)**
$transport = [
'order' => $order,
'comment' => $this->comment,
'billing' => $order->getBillingAddress(),
'store' => $order->getStore(),
'formattedShippingAddress' => $this->getFormattedShippingAddress($order),
'formattedBillingAddress' => $this->getFormattedBillingAddress($order),
];
$transport = new MagentoFrameworkDataObject($transport);
$this->eventManager->dispatch(
'email_order_comment_set_template_vars_before',
['sender' => $this, 'transport' => $transport]
);
try
$this->templateContainer->setTemplateVars($transport->getData());
parent::prepareTemplate($order);
catch (Exception $e)
$this->logger->error('ERROR EMAIL VARS');
$this->logger->error($e->getMessage());
3) The result is - we can use core dispatch 'email_order_comment_set_template_vars_before' - it is working correctly
add a comment |
The problem is that you are not calling the right event.
It should be:
<event name="email_order_set_template_vars_before">
I think the event you are observing is when you are sending email by "Asynchronous sending".
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f201955%2fadd-custom-email-variable-to-invoice-email%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Its a bug of magento as wrote in the comment of your question.
I resolved the problem in this way (but I changed order comments email vars, but use same changes for invoice core classes):
1) I created preference class for core class because it bad way write code in core file.
- added in di.xml code
<preference for="MagentoSalesModelOrderEmailSenderOrderCommentSender" type="NamespaceExtensionNameModelOrderEmailSenderOrderCommentSender" />
2) Fixed source code in my class. The main idea: we added prepareTemplate and we need extend source MagentoSalesModelOrderEmailSenderOrderCommentSender to prevent another core error.
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace SfdevSecretDeliveryModelOrderEmailSender;
use MagentoFrameworkOauthException;
use MagentoSalesModelOrder;
use MagentoSalesModelOrderEmailContainerOrderCommentIdentity;
use MagentoSalesModelOrderEmailContainerTemplate;
use MagentoSalesModelOrderEmailNotifySender;
use MagentoSalesModelOrderAddressRenderer;
use MagentoFrameworkEventManagerInterface;
/**
* Class OrderCommentSender
*/
class OrderCommentSender extends **MagentoSalesModelOrderEmailSenderOrderCommentSender**
/**
* @var Renderer
*/
protected $addressRenderer;
/**
* Application Event Dispatcher
*
* @var ManagerInterface
*/
protected $eventManager;
**public $comment = '';**
/**
* @param Template $templateContainer
* @param OrderCommentIdentity $identityContainer
* @param OrderEmailSenderBuilderFactory $senderBuilderFactory
* @param PsrLogLoggerInterface $logger
* @param Renderer $addressRenderer
* @param ManagerInterface $eventManager
*/
public function __construct(
Template $templateContainer,
OrderCommentIdentity $identityContainer,
MagentoSalesModelOrderEmailSenderBuilderFactory $senderBuilderFactory,
PsrLogLoggerInterface $logger,
Renderer $addressRenderer,
ManagerInterface $eventManager
)
parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger, $addressRenderer, $eventManager);
$this->addressRenderer = $addressRenderer;
$this->eventManager = $eventManager;
/**
* Send email to customer
*
* @param Order $order
* @param bool $notify
* @param string $comment
* @return bool
*/
public function send(Order $order, $notify = true, $comment = '')
**$this->comment = $comment;**
return $this->checkAndSend($order, $notify);
/**
* Prepare email template with variables
*
* @param Order $order
* @return void
*/
**protected function prepareTemplate(Order $order)**
$transport = [
'order' => $order,
'comment' => $this->comment,
'billing' => $order->getBillingAddress(),
'store' => $order->getStore(),
'formattedShippingAddress' => $this->getFormattedShippingAddress($order),
'formattedBillingAddress' => $this->getFormattedBillingAddress($order),
];
$transport = new MagentoFrameworkDataObject($transport);
$this->eventManager->dispatch(
'email_order_comment_set_template_vars_before',
['sender' => $this, 'transport' => $transport]
);
try
$this->templateContainer->setTemplateVars($transport->getData());
parent::prepareTemplate($order);
catch (Exception $e)
$this->logger->error('ERROR EMAIL VARS');
$this->logger->error($e->getMessage());
3) The result is - we can use core dispatch 'email_order_comment_set_template_vars_before' - it is working correctly
add a comment |
Its a bug of magento as wrote in the comment of your question.
I resolved the problem in this way (but I changed order comments email vars, but use same changes for invoice core classes):
1) I created preference class for core class because it bad way write code in core file.
- added in di.xml code
<preference for="MagentoSalesModelOrderEmailSenderOrderCommentSender" type="NamespaceExtensionNameModelOrderEmailSenderOrderCommentSender" />
2) Fixed source code in my class. The main idea: we added prepareTemplate and we need extend source MagentoSalesModelOrderEmailSenderOrderCommentSender to prevent another core error.
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace SfdevSecretDeliveryModelOrderEmailSender;
use MagentoFrameworkOauthException;
use MagentoSalesModelOrder;
use MagentoSalesModelOrderEmailContainerOrderCommentIdentity;
use MagentoSalesModelOrderEmailContainerTemplate;
use MagentoSalesModelOrderEmailNotifySender;
use MagentoSalesModelOrderAddressRenderer;
use MagentoFrameworkEventManagerInterface;
/**
* Class OrderCommentSender
*/
class OrderCommentSender extends **MagentoSalesModelOrderEmailSenderOrderCommentSender**
/**
* @var Renderer
*/
protected $addressRenderer;
/**
* Application Event Dispatcher
*
* @var ManagerInterface
*/
protected $eventManager;
**public $comment = '';**
/**
* @param Template $templateContainer
* @param OrderCommentIdentity $identityContainer
* @param OrderEmailSenderBuilderFactory $senderBuilderFactory
* @param PsrLogLoggerInterface $logger
* @param Renderer $addressRenderer
* @param ManagerInterface $eventManager
*/
public function __construct(
Template $templateContainer,
OrderCommentIdentity $identityContainer,
MagentoSalesModelOrderEmailSenderBuilderFactory $senderBuilderFactory,
PsrLogLoggerInterface $logger,
Renderer $addressRenderer,
ManagerInterface $eventManager
)
parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger, $addressRenderer, $eventManager);
$this->addressRenderer = $addressRenderer;
$this->eventManager = $eventManager;
/**
* Send email to customer
*
* @param Order $order
* @param bool $notify
* @param string $comment
* @return bool
*/
public function send(Order $order, $notify = true, $comment = '')
**$this->comment = $comment;**
return $this->checkAndSend($order, $notify);
/**
* Prepare email template with variables
*
* @param Order $order
* @return void
*/
**protected function prepareTemplate(Order $order)**
$transport = [
'order' => $order,
'comment' => $this->comment,
'billing' => $order->getBillingAddress(),
'store' => $order->getStore(),
'formattedShippingAddress' => $this->getFormattedShippingAddress($order),
'formattedBillingAddress' => $this->getFormattedBillingAddress($order),
];
$transport = new MagentoFrameworkDataObject($transport);
$this->eventManager->dispatch(
'email_order_comment_set_template_vars_before',
['sender' => $this, 'transport' => $transport]
);
try
$this->templateContainer->setTemplateVars($transport->getData());
parent::prepareTemplate($order);
catch (Exception $e)
$this->logger->error('ERROR EMAIL VARS');
$this->logger->error($e->getMessage());
3) The result is - we can use core dispatch 'email_order_comment_set_template_vars_before' - it is working correctly
add a comment |
Its a bug of magento as wrote in the comment of your question.
I resolved the problem in this way (but I changed order comments email vars, but use same changes for invoice core classes):
1) I created preference class for core class because it bad way write code in core file.
- added in di.xml code
<preference for="MagentoSalesModelOrderEmailSenderOrderCommentSender" type="NamespaceExtensionNameModelOrderEmailSenderOrderCommentSender" />
2) Fixed source code in my class. The main idea: we added prepareTemplate and we need extend source MagentoSalesModelOrderEmailSenderOrderCommentSender to prevent another core error.
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace SfdevSecretDeliveryModelOrderEmailSender;
use MagentoFrameworkOauthException;
use MagentoSalesModelOrder;
use MagentoSalesModelOrderEmailContainerOrderCommentIdentity;
use MagentoSalesModelOrderEmailContainerTemplate;
use MagentoSalesModelOrderEmailNotifySender;
use MagentoSalesModelOrderAddressRenderer;
use MagentoFrameworkEventManagerInterface;
/**
* Class OrderCommentSender
*/
class OrderCommentSender extends **MagentoSalesModelOrderEmailSenderOrderCommentSender**
/**
* @var Renderer
*/
protected $addressRenderer;
/**
* Application Event Dispatcher
*
* @var ManagerInterface
*/
protected $eventManager;
**public $comment = '';**
/**
* @param Template $templateContainer
* @param OrderCommentIdentity $identityContainer
* @param OrderEmailSenderBuilderFactory $senderBuilderFactory
* @param PsrLogLoggerInterface $logger
* @param Renderer $addressRenderer
* @param ManagerInterface $eventManager
*/
public function __construct(
Template $templateContainer,
OrderCommentIdentity $identityContainer,
MagentoSalesModelOrderEmailSenderBuilderFactory $senderBuilderFactory,
PsrLogLoggerInterface $logger,
Renderer $addressRenderer,
ManagerInterface $eventManager
)
parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger, $addressRenderer, $eventManager);
$this->addressRenderer = $addressRenderer;
$this->eventManager = $eventManager;
/**
* Send email to customer
*
* @param Order $order
* @param bool $notify
* @param string $comment
* @return bool
*/
public function send(Order $order, $notify = true, $comment = '')
**$this->comment = $comment;**
return $this->checkAndSend($order, $notify);
/**
* Prepare email template with variables
*
* @param Order $order
* @return void
*/
**protected function prepareTemplate(Order $order)**
$transport = [
'order' => $order,
'comment' => $this->comment,
'billing' => $order->getBillingAddress(),
'store' => $order->getStore(),
'formattedShippingAddress' => $this->getFormattedShippingAddress($order),
'formattedBillingAddress' => $this->getFormattedBillingAddress($order),
];
$transport = new MagentoFrameworkDataObject($transport);
$this->eventManager->dispatch(
'email_order_comment_set_template_vars_before',
['sender' => $this, 'transport' => $transport]
);
try
$this->templateContainer->setTemplateVars($transport->getData());
parent::prepareTemplate($order);
catch (Exception $e)
$this->logger->error('ERROR EMAIL VARS');
$this->logger->error($e->getMessage());
3) The result is - we can use core dispatch 'email_order_comment_set_template_vars_before' - it is working correctly
Its a bug of magento as wrote in the comment of your question.
I resolved the problem in this way (but I changed order comments email vars, but use same changes for invoice core classes):
1) I created preference class for core class because it bad way write code in core file.
- added in di.xml code
<preference for="MagentoSalesModelOrderEmailSenderOrderCommentSender" type="NamespaceExtensionNameModelOrderEmailSenderOrderCommentSender" />
2) Fixed source code in my class. The main idea: we added prepareTemplate and we need extend source MagentoSalesModelOrderEmailSenderOrderCommentSender to prevent another core error.
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace SfdevSecretDeliveryModelOrderEmailSender;
use MagentoFrameworkOauthException;
use MagentoSalesModelOrder;
use MagentoSalesModelOrderEmailContainerOrderCommentIdentity;
use MagentoSalesModelOrderEmailContainerTemplate;
use MagentoSalesModelOrderEmailNotifySender;
use MagentoSalesModelOrderAddressRenderer;
use MagentoFrameworkEventManagerInterface;
/**
* Class OrderCommentSender
*/
class OrderCommentSender extends **MagentoSalesModelOrderEmailSenderOrderCommentSender**
/**
* @var Renderer
*/
protected $addressRenderer;
/**
* Application Event Dispatcher
*
* @var ManagerInterface
*/
protected $eventManager;
**public $comment = '';**
/**
* @param Template $templateContainer
* @param OrderCommentIdentity $identityContainer
* @param OrderEmailSenderBuilderFactory $senderBuilderFactory
* @param PsrLogLoggerInterface $logger
* @param Renderer $addressRenderer
* @param ManagerInterface $eventManager
*/
public function __construct(
Template $templateContainer,
OrderCommentIdentity $identityContainer,
MagentoSalesModelOrderEmailSenderBuilderFactory $senderBuilderFactory,
PsrLogLoggerInterface $logger,
Renderer $addressRenderer,
ManagerInterface $eventManager
)
parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger, $addressRenderer, $eventManager);
$this->addressRenderer = $addressRenderer;
$this->eventManager = $eventManager;
/**
* Send email to customer
*
* @param Order $order
* @param bool $notify
* @param string $comment
* @return bool
*/
public function send(Order $order, $notify = true, $comment = '')
**$this->comment = $comment;**
return $this->checkAndSend($order, $notify);
/**
* Prepare email template with variables
*
* @param Order $order
* @return void
*/
**protected function prepareTemplate(Order $order)**
$transport = [
'order' => $order,
'comment' => $this->comment,
'billing' => $order->getBillingAddress(),
'store' => $order->getStore(),
'formattedShippingAddress' => $this->getFormattedShippingAddress($order),
'formattedBillingAddress' => $this->getFormattedBillingAddress($order),
];
$transport = new MagentoFrameworkDataObject($transport);
$this->eventManager->dispatch(
'email_order_comment_set_template_vars_before',
['sender' => $this, 'transport' => $transport]
);
try
$this->templateContainer->setTemplateVars($transport->getData());
parent::prepareTemplate($order);
catch (Exception $e)
$this->logger->error('ERROR EMAIL VARS');
$this->logger->error($e->getMessage());
3) The result is - we can use core dispatch 'email_order_comment_set_template_vars_before' - it is working correctly
edited Sep 24 '18 at 6:03
Ranganathan
545416
545416
answered Jul 12 '18 at 16:18
Stanislav PotapenkoStanislav Potapenko
262
262
add a comment |
add a comment |
The problem is that you are not calling the right event.
It should be:
<event name="email_order_set_template_vars_before">
I think the event you are observing is when you are sending email by "Asynchronous sending".
add a comment |
The problem is that you are not calling the right event.
It should be:
<event name="email_order_set_template_vars_before">
I think the event you are observing is when you are sending email by "Asynchronous sending".
add a comment |
The problem is that you are not calling the right event.
It should be:
<event name="email_order_set_template_vars_before">
I think the event you are observing is when you are sending email by "Asynchronous sending".
The problem is that you are not calling the right event.
It should be:
<event name="email_order_set_template_vars_before">
I think the event you are observing is when you are sending email by "Asynchronous sending".
answered yesterday
abelbmabelbm
312
312
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f201955%2fadd-custom-email-variable-to-invoice-email%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Maybe Magento bug: github.com/magento/magento2/issues/10210
– PY Yick
Nov 17 '17 at 8:44