从订单电子邮件中删除商品编号-magento

问题描述 投票:0回答:2

我对magento完全陌生,并使用1.7版。我要在客户下订单时从订单电子邮件中删除SKU号。经过大量的研发,我注意到,使用的模板来自app/design/frontend/base/default/template/email/order/items.phtml,产品名称,SKU编号,数量和价格来自echo $this->getItemHtml($_item)这行。我不确定,如何从这一行中删除sku number列?还是有其他方法可以这样做?

任何帮助表示赞赏。谢谢。

magento-1.7
2个回答
2
投票

让我解释一下所有过程。

您可以在app / locale / en_US / template / email / sales / order_new.html中找到订单电子邮件模板。在此文件中,您可以在行号C中找到此行{{layout handle="sales_email_order_items" order=$order}}。 97

在此您可以看到句柄是“ sales_email_order_items”,您可以在app \ design \ frontend \ base \ default \ layout \ sales.xml行号中找到此块。 268。

<sales_email_order_items>
<block type="sales/order_email_items" name="items" template="email/order/items.phtml">
    <action method="addItemRender"><type>default</type><block>sales/order_email_items_order_default</block><template>email/order/items/order/default.phtml</template></action>
    <action method="addItemRender"><type>grouped</type><block>sales/order_email_items_order_grouped</block><template>email/order/items/order/default.phtml</template></action>
    <block type="sales/order_totals" name="order_totals" template="sales/order/totals.phtml">
        <action method="setLabelProperties"><value>colspan="3" align="right" style="padding:3px 9px"</value></action>
        <action method="setValueProperties"><value>align="right" style="padding:3px 9px"</value></action>
        <block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml">
            <action method="setIsPlaneMode"><value>1</value></action>
        </block>
    </block>
</block>
<block type="core/text_list" name="additional.product.info" />

在此块中,您可以看到文件路径“ email / order / items.phtml(app \ design \ frontend \ base \ default \ template \ email \ order \ items.phtml)“

在此文件中,只需注释此代码第<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Sku') ?></th>行33

现在在上面的块中,您可以看到另一个文件路径'email \ order \ items \ order \ default.phtml(app \ design \ frontend \ base \ default \ template \ email \ order \ items \ order \ default.phtml) '

在此文件中,只需在第1行的第<td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $this->htmlEscape($this->getSku($_item)) ?></td>条注释此代码。 48。

完成。


0
投票

在Magento 2.3中,“ sales_email_order_renderers.xml”呈现了phtml.file,该文件定义了订单电子邮件中商品的内容。

要删除SKU,您可以执行以下步骤:

  • 创建模块(例如COMPANY / SAMPLE)
  • 将“ sales_email_order_renders.xml”从/ vendor / magento / module-sales / view / frontend / layout /复制到/ app / code / COMPANY / SAMPLE / view / frontend / layout /
  • 从/ vendor / magento / module-sales / view / frontend / templates / email / items / order /复制“ default.phtml”到/ app / code / COMPANY / SAMPLE / view / frontend / templates / email / items / order /
  • 更新模块中的“ sales_email_order_renders.xml”以在模块中呈现“ default.phtml”(请参见以下示例)

    <?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Email Creditmemo Items List" design_abstraction="custom">
     <body>
        <referenceBlock name="sales.email.order.renderers">
            <block class="Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder" name="sales.email.order.renderers.default" as="default" 
                    template="COMPANY_SAMPLE::email/items/order/default.phtml"/>
        </referenceBlock>
    </body>
    

    • 从default.phtml中删除SKU
    • 清除缓存(php bin / magento缓存:刷新)
© www.soinside.com 2019 - 2024. All rights reserved.