我想在magento 2中的确认电子邮件中添加条件文本。如下所示:
{{if order contains item }}
text
{{else order doesnt contain item}}
other text目前,我意识到电子邮件显示的项目如下:
{{layout handle="sales_email_order_items" order=$order area="frontend"}}这是可配置的吗?
谢谢
发布于 2018-05-08 23:46:55
为此,我使用了一个外部phtml模板:
在设计区域中,创建要修改的模块,在您的情况下,它是Magento_Sales
Magento_Sales
/email
the-email-to-modify.html
/templates
/email
your-template.phtml在-template.phtml中,像往常一样使用php
<?php
//your code, with the test
// to get the variables use:
$myvar=$this->getData('myvar');
...?>
<p>Hello <?php echo $myvar; ?></p>在HTML模板-email-to-modfy.html中,您可以包含模板并发送所需的任何变量,此处为客户名称:
<h1>The title</h1>
{{block class='Magento\\Framework\\View\\Element\\Template'
myvar=$customer.name area='frontend'
template='Magento_Sales::email/your-template.phtml'}}et voila ^^
https://stackoverflow.com/questions/39850776
复制相似问题