Magento 2 - Include Customizable Options in Email Template
Using substitution ciphers to generate new alphabets in a novel
Did arcade monitors have same pixel aspect ratio as TV sets?
Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?
Why does the Sun have different day lengths, but not the gas giants?
Terse Method to Swap Lowest for Highest?
Does malloc reserve more space while allocating memory?
Can the US President recognize Israel’s sovereignty over the Golan Heights for the USA or does that need an act of Congress?
Temporarily disable WLAN internet access for children, but allow it for adults
Keeping a ball lost forever
Why is this estimator biased?
Do the primes contain an infinite almost arithmetic progression?
Mimic lecturing on blackboard, facing audience
Hero deduces identity of a killer
How does a computer interpret real numbers?
Can a stoichiometric mixture of oxygen and methane exist as a liquid at standard pressure and some (low) temperature?
The IT department bottlenecks progress. How should I handle this?
A social experiment. What is the worst that can happen?
Is there an injective, monotonically increasing, strictly concave function from the reals, to the reals?
Is aluminum electrical wire used on aircraft?
Why is the "ls" command showing permissions of files in a FAT32 partition?
Redundant comparison & "if" before assignment
Pre-mixing cryogenic fuels and using only one fuel tank
What should you do if you miss a job interview (deliberately)?
What should you do when eye contact makes your subordinate uncomfortable?
Magento 2 - Include Customizable Options in Email Template
I need to include product Customizable Options with price in order email template. For this I have modified the code and added the Customizable Options code. All are showing fine but the Customizable Options is not showing.
Here is my code added in module-sales/view/frontend/templates/email/items.phtml file
<?php $_order = $block->getOrder() ?>
<?php if ($_order): ?>
<?php $_items = $_order->getAllItems(); ?>
<table class="email-items" cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
<thead>
<tr>
<th class="item-info" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Items') ?>
</th>
<th class="item-info" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('SKU') ?>
</th>
<th class="item-qty" align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Qty') ?>
</th>
<th class="item-price" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Price') ?>
</th>
</tr>
</thead>
<?php foreach ($_items as $_item): ?>
<?php if (!$_item->getParentItem()) : ?>
<tbody>
<tr>
<td class="item-info" style="padding:3px 9px;font-size:11px;font-weight:700;"><?= /* @escapeNotVerified */ $_item->getName() ?>
<?php if ($block->getItemOptions()): ?>
<dl class="item-options">
<?php foreach ($block->getItemOptions() as $option): ?>
<dt><strong><em><?= /* @escapeNotVerified */ $option['label'] ?></em></strong></dt>
<dd>
<?= /* @escapeNotVerified */ nl2br($option['value']) ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
</td>
<td class="item-info" style="font-size:11px;"><?= /* @escapeNotVerified */ $_item->getSku() ?></td>
<td align="center" class="item-info" style="font-size:11px;"><?= /* @escapeNotVerified */ $_item->getQtyOrdered() ?></td>
<td class="item-info" style="font-size:11px;">Rs: <?= /* @escapeNotVerified */ $_item->getPrice() ?></td>
</tr>
</tbody>
<?php endif; ?>
<?php endforeach; ?>
<tfoot class="order-totals">
<tr class="subtotal">
<th style="padding-right:20px;font-weight:normal;font-size:11px;" align="right" colspan="3" scope="row">
<?= /* @escapeNotVerified */ __('Subtotal') ?>
</th>
<td>
<span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */ $_order->getSubtotal() ?></span>
</td>
</tr>
<tr class="shipping">
<th style="padding-right:20px;font-weight:normal;font-size:11px;" align="right" colspan="3" scope="row">
<?= /* @escapeNotVerified */ __('Shipping & Handling') ?>
</th>
<td>
<span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */ $_order->getShippingAmount() ?></span>
</td>
</tr>
<tr class="grand_total">
<th style="padding-right:20px;font-size:11px;" align="right" colspan="3" scope="row">
<strong><?= /* @escapeNotVerified */ __('Grant total') ?></strong>
</th>
<td>
<strong><span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */ $_order->getGrandTotal() ?></span></strong>
</td>
</tr>
</tfoot>
</table>
<?php if ($this->helper('MagentoGiftMessageHelperMessage')->isMessagesAllowed('order', $_order, $_order->getStore()) && $_order->getGiftMessageId()): ?>
<?php $_giftMessage = $this->helper('MagentoGiftMessageHelperMessage')->getGiftMessage($_order->getGiftMessageId()); ?>
<?php if ($_giftMessage): ?>
<br />
<table class="message-gift">
<tr>
<td>
<h3><?= /* @escapeNotVerified */ __('Gift Message for this Order') ?></h3>
<strong><?= /* @escapeNotVerified */ __('From:') ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?>
<br /><strong><?= /* @escapeNotVerified */ __('To:') ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?>
<br /><strong><?= /* @escapeNotVerified */ __('Message:') ?></strong>
<br /><?= $block->escapeHtml($_giftMessage->getMessage()) ?>
</td>
</tr>
</table>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
Can anyone let me know what's the issue and how to include custom options with price in this template.
Thanks.
magento2 orders email-templates order-email
add a comment |
I need to include product Customizable Options with price in order email template. For this I have modified the code and added the Customizable Options code. All are showing fine but the Customizable Options is not showing.
Here is my code added in module-sales/view/frontend/templates/email/items.phtml file
<?php $_order = $block->getOrder() ?>
<?php if ($_order): ?>
<?php $_items = $_order->getAllItems(); ?>
<table class="email-items" cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
<thead>
<tr>
<th class="item-info" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Items') ?>
</th>
<th class="item-info" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('SKU') ?>
</th>
<th class="item-qty" align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Qty') ?>
</th>
<th class="item-price" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Price') ?>
</th>
</tr>
</thead>
<?php foreach ($_items as $_item): ?>
<?php if (!$_item->getParentItem()) : ?>
<tbody>
<tr>
<td class="item-info" style="padding:3px 9px;font-size:11px;font-weight:700;"><?= /* @escapeNotVerified */ $_item->getName() ?>
<?php if ($block->getItemOptions()): ?>
<dl class="item-options">
<?php foreach ($block->getItemOptions() as $option): ?>
<dt><strong><em><?= /* @escapeNotVerified */ $option['label'] ?></em></strong></dt>
<dd>
<?= /* @escapeNotVerified */ nl2br($option['value']) ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
</td>
<td class="item-info" style="font-size:11px;"><?= /* @escapeNotVerified */ $_item->getSku() ?></td>
<td align="center" class="item-info" style="font-size:11px;"><?= /* @escapeNotVerified */ $_item->getQtyOrdered() ?></td>
<td class="item-info" style="font-size:11px;">Rs: <?= /* @escapeNotVerified */ $_item->getPrice() ?></td>
</tr>
</tbody>
<?php endif; ?>
<?php endforeach; ?>
<tfoot class="order-totals">
<tr class="subtotal">
<th style="padding-right:20px;font-weight:normal;font-size:11px;" align="right" colspan="3" scope="row">
<?= /* @escapeNotVerified */ __('Subtotal') ?>
</th>
<td>
<span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */ $_order->getSubtotal() ?></span>
</td>
</tr>
<tr class="shipping">
<th style="padding-right:20px;font-weight:normal;font-size:11px;" align="right" colspan="3" scope="row">
<?= /* @escapeNotVerified */ __('Shipping & Handling') ?>
</th>
<td>
<span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */ $_order->getShippingAmount() ?></span>
</td>
</tr>
<tr class="grand_total">
<th style="padding-right:20px;font-size:11px;" align="right" colspan="3" scope="row">
<strong><?= /* @escapeNotVerified */ __('Grant total') ?></strong>
</th>
<td>
<strong><span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */ $_order->getGrandTotal() ?></span></strong>
</td>
</tr>
</tfoot>
</table>
<?php if ($this->helper('MagentoGiftMessageHelperMessage')->isMessagesAllowed('order', $_order, $_order->getStore()) && $_order->getGiftMessageId()): ?>
<?php $_giftMessage = $this->helper('MagentoGiftMessageHelperMessage')->getGiftMessage($_order->getGiftMessageId()); ?>
<?php if ($_giftMessage): ?>
<br />
<table class="message-gift">
<tr>
<td>
<h3><?= /* @escapeNotVerified */ __('Gift Message for this Order') ?></h3>
<strong><?= /* @escapeNotVerified */ __('From:') ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?>
<br /><strong><?= /* @escapeNotVerified */ __('To:') ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?>
<br /><strong><?= /* @escapeNotVerified */ __('Message:') ?></strong>
<br /><?= $block->escapeHtml($_giftMessage->getMessage()) ?>
</td>
</tr>
</table>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
Can anyone let me know what's the issue and how to include custom options with price in this template.
Thanks.
magento2 orders email-templates order-email
add a comment |
I need to include product Customizable Options with price in order email template. For this I have modified the code and added the Customizable Options code. All are showing fine but the Customizable Options is not showing.
Here is my code added in module-sales/view/frontend/templates/email/items.phtml file
<?php $_order = $block->getOrder() ?>
<?php if ($_order): ?>
<?php $_items = $_order->getAllItems(); ?>
<table class="email-items" cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
<thead>
<tr>
<th class="item-info" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Items') ?>
</th>
<th class="item-info" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('SKU') ?>
</th>
<th class="item-qty" align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Qty') ?>
</th>
<th class="item-price" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Price') ?>
</th>
</tr>
</thead>
<?php foreach ($_items as $_item): ?>
<?php if (!$_item->getParentItem()) : ?>
<tbody>
<tr>
<td class="item-info" style="padding:3px 9px;font-size:11px;font-weight:700;"><?= /* @escapeNotVerified */ $_item->getName() ?>
<?php if ($block->getItemOptions()): ?>
<dl class="item-options">
<?php foreach ($block->getItemOptions() as $option): ?>
<dt><strong><em><?= /* @escapeNotVerified */ $option['label'] ?></em></strong></dt>
<dd>
<?= /* @escapeNotVerified */ nl2br($option['value']) ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
</td>
<td class="item-info" style="font-size:11px;"><?= /* @escapeNotVerified */ $_item->getSku() ?></td>
<td align="center" class="item-info" style="font-size:11px;"><?= /* @escapeNotVerified */ $_item->getQtyOrdered() ?></td>
<td class="item-info" style="font-size:11px;">Rs: <?= /* @escapeNotVerified */ $_item->getPrice() ?></td>
</tr>
</tbody>
<?php endif; ?>
<?php endforeach; ?>
<tfoot class="order-totals">
<tr class="subtotal">
<th style="padding-right:20px;font-weight:normal;font-size:11px;" align="right" colspan="3" scope="row">
<?= /* @escapeNotVerified */ __('Subtotal') ?>
</th>
<td>
<span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */ $_order->getSubtotal() ?></span>
</td>
</tr>
<tr class="shipping">
<th style="padding-right:20px;font-weight:normal;font-size:11px;" align="right" colspan="3" scope="row">
<?= /* @escapeNotVerified */ __('Shipping & Handling') ?>
</th>
<td>
<span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */ $_order->getShippingAmount() ?></span>
</td>
</tr>
<tr class="grand_total">
<th style="padding-right:20px;font-size:11px;" align="right" colspan="3" scope="row">
<strong><?= /* @escapeNotVerified */ __('Grant total') ?></strong>
</th>
<td>
<strong><span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */ $_order->getGrandTotal() ?></span></strong>
</td>
</tr>
</tfoot>
</table>
<?php if ($this->helper('MagentoGiftMessageHelperMessage')->isMessagesAllowed('order', $_order, $_order->getStore()) && $_order->getGiftMessageId()): ?>
<?php $_giftMessage = $this->helper('MagentoGiftMessageHelperMessage')->getGiftMessage($_order->getGiftMessageId()); ?>
<?php if ($_giftMessage): ?>
<br />
<table class="message-gift">
<tr>
<td>
<h3><?= /* @escapeNotVerified */ __('Gift Message for this Order') ?></h3>
<strong><?= /* @escapeNotVerified */ __('From:') ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?>
<br /><strong><?= /* @escapeNotVerified */ __('To:') ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?>
<br /><strong><?= /* @escapeNotVerified */ __('Message:') ?></strong>
<br /><?= $block->escapeHtml($_giftMessage->getMessage()) ?>
</td>
</tr>
</table>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
Can anyone let me know what's the issue and how to include custom options with price in this template.
Thanks.
magento2 orders email-templates order-email
I need to include product Customizable Options with price in order email template. For this I have modified the code and added the Customizable Options code. All are showing fine but the Customizable Options is not showing.
Here is my code added in module-sales/view/frontend/templates/email/items.phtml file
<?php $_order = $block->getOrder() ?>
<?php if ($_order): ?>
<?php $_items = $_order->getAllItems(); ?>
<table class="email-items" cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
<thead>
<tr>
<th class="item-info" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Items') ?>
</th>
<th class="item-info" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('SKU') ?>
</th>
<th class="item-qty" align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Qty') ?>
</th>
<th class="item-price" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Price') ?>
</th>
</tr>
</thead>
<?php foreach ($_items as $_item): ?>
<?php if (!$_item->getParentItem()) : ?>
<tbody>
<tr>
<td class="item-info" style="padding:3px 9px;font-size:11px;font-weight:700;"><?= /* @escapeNotVerified */ $_item->getName() ?>
<?php if ($block->getItemOptions()): ?>
<dl class="item-options">
<?php foreach ($block->getItemOptions() as $option): ?>
<dt><strong><em><?= /* @escapeNotVerified */ $option['label'] ?></em></strong></dt>
<dd>
<?= /* @escapeNotVerified */ nl2br($option['value']) ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
</td>
<td class="item-info" style="font-size:11px;"><?= /* @escapeNotVerified */ $_item->getSku() ?></td>
<td align="center" class="item-info" style="font-size:11px;"><?= /* @escapeNotVerified */ $_item->getQtyOrdered() ?></td>
<td class="item-info" style="font-size:11px;">Rs: <?= /* @escapeNotVerified */ $_item->getPrice() ?></td>
</tr>
</tbody>
<?php endif; ?>
<?php endforeach; ?>
<tfoot class="order-totals">
<tr class="subtotal">
<th style="padding-right:20px;font-weight:normal;font-size:11px;" align="right" colspan="3" scope="row">
<?= /* @escapeNotVerified */ __('Subtotal') ?>
</th>
<td>
<span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */ $_order->getSubtotal() ?></span>
</td>
</tr>
<tr class="shipping">
<th style="padding-right:20px;font-weight:normal;font-size:11px;" align="right" colspan="3" scope="row">
<?= /* @escapeNotVerified */ __('Shipping & Handling') ?>
</th>
<td>
<span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */ $_order->getShippingAmount() ?></span>
</td>
</tr>
<tr class="grand_total">
<th style="padding-right:20px;font-size:11px;" align="right" colspan="3" scope="row">
<strong><?= /* @escapeNotVerified */ __('Grant total') ?></strong>
</th>
<td>
<strong><span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */ $_order->getGrandTotal() ?></span></strong>
</td>
</tr>
</tfoot>
</table>
<?php if ($this->helper('MagentoGiftMessageHelperMessage')->isMessagesAllowed('order', $_order, $_order->getStore()) && $_order->getGiftMessageId()): ?>
<?php $_giftMessage = $this->helper('MagentoGiftMessageHelperMessage')->getGiftMessage($_order->getGiftMessageId()); ?>
<?php if ($_giftMessage): ?>
<br />
<table class="message-gift">
<tr>
<td>
<h3><?= /* @escapeNotVerified */ __('Gift Message for this Order') ?></h3>
<strong><?= /* @escapeNotVerified */ __('From:') ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?>
<br /><strong><?= /* @escapeNotVerified */ __('To:') ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?>
<br /><strong><?= /* @escapeNotVerified */ __('Message:') ?></strong>
<br /><?= $block->escapeHtml($_giftMessage->getMessage()) ?>
</td>
</tr>
</table>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
Can anyone let me know what's the issue and how to include custom options with price in this template.
Thanks.
magento2 orders email-templates order-email
magento2 orders email-templates order-email
asked 4 mins ago
mystimysti
184
184
add a comment |
add a comment |
0
active
oldest
votes
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%2f267072%2fmagento-2-include-customizable-options-in-email-template%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f267072%2fmagento-2-include-customizable-options-in-email-template%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