0

What variable (or how do we get) the Delivery Date and the customer comment onto the outgoing customer order confirmation email in Magento 2?

1
  • whats the field name for deliverydate and customer comment? Commented Sep 1, 2017 at 5:00

1 Answer 1

0

This may be helpful /From where you send a Email [custom email Function]

public function yourCustomMailSendMethod($emailTemplateVariables,$senderInfo,$receiverInfo)
{
    /* Here we prepare data for our email  */


/* Receiver Detail  */
$receiverInfo = [
    'name' => 'Reciver Name',
    'email' => '[email protected]'
];


/* Sender Detail  */
$senderInfo = [
    'name' => 'Sender Name',
    'email' => '[email protected]',
];


/* Assign values for your template variables  */
$emailTemplateVariables = array();
$emailTempVariables['customer_comment '] = $comment ;
$emailTempVariables['delivery_date'] = $Delivery;
    $this->temp_id = $this->getTemplateId(self::XML_PATH_EMAIL_TEMPLATE_FIELD);
    $this->inlineTranslation->suspend();    
    $this->generateTemplate($emailTemplateVariables,$senderInfo,$receiverInfo);    
    $transport = $this->_transportBuilder->getTransport();
    $transport->sendMessage();        
    $this->inlineTranslation->resume();
}

Here we will use “your_email_template.html” name for email template

{{template config_path="design/email/header_template"}} 
<!-- pathe of template header-->

<!-- here customer_comment ,Delivery_Date are variables in which we
                                 asssign values when we use this template  for send mail-->

<!-- you can Modify content of template according to your requirement-->

<table>
    <tr class="email-information">
        <td>
            <table class="order-details">
                <tr>
                    <td class="address-details">
                        <h3>{{trans "Customer Comment"}}</h3>
                        <p>{{var customer_comment}}</p>
                    </td>
                </tr>
                <tr>
                    <td class="address-details">
                        <h3>{{trans "Delivery Date"}}</h3>
                        <p>{{var delivery_date}}</p>
                    </td>
                </tr>
            </table>
        </td>
    </tr> </table>   {{template config_path="design/email/footer_template"}} <!--footer of template-->

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.