cancel
Showing results for 
Search instead for 
Did you mean: 

Email Template for Ordered Items

Email Template for Ordered Items

hi there..

i'm trying to design the template for ordered items.. but i'm not able to align the items it self..

where i have to do this? because i didnt find anything..

 

can you help me?

2 REPLIES

Re: Email Template for Ordered Items

By default, Email Templates coming from Magento_Sales Module.

 

If you want to customization on order item of email templates,

You need to override below phtml file to your theme or module level.

 

Main file is,

vendor/magento/module-sales/view/frontend/templates/email/items.phtml

 

Items of order coming from below phtml files,

vendor/magento/module-sales/view/frontend/templates/email/items/order/default.phtml

 

Refer above files and you can customization as per your requirement.

If Issue Solved, Click Kudos/Accept As solutions.

Re: Email Template for Ordered Items

hi rakesh,

thanks for your answer,

 

i did a try but.. it stills not designed well have a look:

 

<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php $_order = $block->getOrder() ?>
<?php if ($_order): ?>
    <?php $_items = $_order->getAllItems(); ?>
    <table class="email-items">
        <thead>
            <tr>
                <th style="text-align:left" class="item-info">
                    <?= /* @escapeNotVerified */  __('Items'); ?>
                </th>
                <th style="text-align:left" class="item-qty">
                    <?= /* @escapeNotVerified */  __('Qty'); ?>
                </th>
                <th style="text-align:left" class="item-price">
                    <?= /* @escapeNotVerified */  __('Price'); ?>
                </th>
            </tr>
        </thead>
        <?php foreach ($_items as $_item): ?>
            <?php
                if ($_item->getParentItem()) {
                    continue;
                }
            ?>
            <tbody style="text-align:left">
                <?= $block->getItemHtml($_item) ?>
            </tbody>
        <?php endforeach; ?>
        <tfoot class="order-totals">
            <?= $block->getChildHtml('order_totals') ?>
        </tfoot>
    </table>
    <?php if ($this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order', $_order, $_order->getStore()) && $_order->getGiftMessageId()): ?>
        <?php $_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($_order->getGiftMessageId()); ?>
        <?php if ($_giftMessage): ?>
            <br />
            <table class="message-gift">
                <tr>
                    <td style="text-align:left">
                        <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; ?>

2018-04-09_23-47-22.png

 

i want this lines aligned left...