我正在尝试修改 OpenCart 的 order.tpl catalog/view/theme/default/template/mail/order.tpl
,因此电子邮件显示如下:
Hello (firstname)!
Welcome to my store... etc.
我相信这与以下方面有关:
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_greeting; ?></p>
但我猜我需要在$text_greeting
上方加载一些新的 PHP。不幸的是,我不熟悉php。
希望有人能帮助我。
更多信息:
似乎我需要从数据库中加载一个新值,即将"firstname"加载到当前在数据库中的目录/视图/主题/默认/模板/邮件/订单.tpl 中。
我真的对 php 不了解,所以我希望任何了解 opencart 和 php 的人都能在这里帮助我。
谢谢
好的,这应该是一个干净的解决方案,可以直接让你到达你需要的地方:
1. 编辑catalog/language/<YOUR_LANGUAGE>/mail/order.php
和行前(英文):
$_['text_new_greeting'] = 'Thank you for your interest in %s products. Your order has been received and will be processed once payment has been confirmed.';
添加这个
$_['text_title'] = 'Hello %s,';
2.打开catalog/model/checkout/order.php
- 搜索方法confirm()
,然后找到行
$template->data['text_greeting'] = sprintf($language->get('text_new_greeting'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'));
在添加这个之前:
$template->data['text_title'] = sprintf($language->get('text_titler'), html_entity_decode($order_info['payment_firstname'], ENT_QUOTES, 'UTF-8'));
我只想提一下,这应该做两次 - 一次用于 HTML 模板部分,一次用于文本模板部分(向下滚动一点用于文本 tpl 部分)。
3. 打开catalog/view/theme/<YOUR_THEME>/template/mail/order.tpl
并找到行:
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_greeting; ?></p>
在添加这个之前:
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_title; ?></p>
现在你应该完成了。