正如@timactive 所写,在客户邮件中获取制造商名称的解决方案是编辑 PaymentModule.php。
所以,要在客户邮件中获取制造商的名称:
PaymentModule.php:
foreach ($order->product_list as $product) {
$manufacturer = new Manufacturer((int)$product['id_manufacturer']);
$product_var_tpl = array(
'reference' => $product['reference'],
'name' => $product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : ''),
'unit_price' => Tools::displayPrice($product_price, $this->context->currency, false),
'price' => Tools::displayPrice($product_price * $product['quantity'], $this->context->currency, false),
'quantity' => $product['quantity'],
'customization' => array(),
'manufacturer' => $manufacturer->name
);
在 order_conf_product_list.html 中,像这样调用产品对象:
{$product['manufacturer']}
这是解决方案的一部分,因为我也想在管理员新订单邮件上添加制造商的名称。
在管理员新订单邮件中添加制造商名称:
要完成这个,我必须像这样编辑 MailAlert 模块:
在mailalert.php中,在函数“hookActionValidateOrder”中:
foreach ($products as $key => $product)
{
$manufacturer = new Manufacturer($product['id_manufacturer'], $id_lang);
$items_table .=
'<tr style="background-color:'.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
<td style="padding:0.6em 0.4em;">'.$product['product_reference'].'</td>
<td style="padding:0.6em 0.4em;">'.$manufacturer->name.'</td>
<td style="padding:0.6em 0.4em;">
<strong><a href="'.$url.'">'.$product['product_name'].'</a>'
.(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '')
.(!empty($customization_text) ? '<br />'.$customization_text : '')
.'</strong>
</td>
<td style="padding:0.6em 0.4em; text-align:right;">'.Tools::displayPrice($unit_price, $currency, false).'</td>
<td style="padding:0.6em 0.4em; text-align:center;">'.(int)$product['product_quantity'].'</td>
<td style="padding:0.6em 0.4em; text-align:right;">'
.Tools::displayPrice(($unit_price * $product['product_quantity']), $currency, false)
.'</td>
</tr>';
现在,要创建到单元格,请转到 mailalert/mails/fr/new-order.html 并在第 114 行周围添加这一行:
<th style="border:1px solid #D6D4D4;background-color:#fbfbfb;font-family:Arial;color:#333;font-size:13px;padding:10px">Marque</th>