我可以在Prestashop 1.6中找到电子邮件模板的所有变量

时间:2017-09-05 09:37:21

标签: prestashop

在哪个班级,我可以在PrestaShop中找到电子邮件模板的所有变量? 我的意思是{firstname}或{lastname}。或者它可能取决于类方法。例如。如果我创建新的付款模板,那么我需要去PaymentModule.php吗?谢谢你的帮助。

亲切的问候

2 个答案:

答案 0 :(得分:1)

正如我在评论中所说,它取决于发送电子邮件的方法。如果您要创建新的付款模板,则必须查看PaymentModule.php并检查ValidateOrder方法。
这是您可以在电子邮件模板中使用的所有变量:

$data = array(
'{firstname}' => $this->context->customer->firstname,
'{lastname}' => $this->context->customer->lastname,
'{email}' => $this->context->customer->email,
'{delivery_block_txt}' => $this->_getFormatedAddress($delivery, "\n"),
'{invoice_block_txt}' => $this->_getFormatedAddress($invoice, "\n"),
'{delivery_block_html}' => $this->_getFormatedAddress($delivery, '<br />', array(
    'firstname'    => '<span style="font-weight:bold;">%s</span>',
    'lastname'    => '<span style="font-weight:bold;">%s</span>'
)),
'{invoice_block_html}' => $this->_getFormatedAddress($invoice, '<br />', array(
        'firstname'    => '<span style="font-weight:bold;">%s</span>',
        'lastname'    => '<span style="font-weight:bold;">%s</span>'
)),
'{delivery_company}' => $delivery->company,
'{delivery_firstname}' => $delivery->firstname,
'{delivery_lastname}' => $delivery->lastname,
'{delivery_address1}' => $delivery->address1,
'{delivery_address2}' => $delivery->address2,
'{delivery_city}' => $delivery->city,
'{delivery_postal_code}' => $delivery->postcode,
'{delivery_country}' => $delivery->country,
'{delivery_state}' => $delivery->id_state ? $delivery_state->name : '',
'{delivery_phone}' => ($delivery->phone) ? $delivery->phone : $delivery->phone_mobile,
'{delivery_other}' => $delivery->other,
'{invoice_company}' => $invoice->company,
'{invoice_vat_number}' => $invoice->vat_number,
'{invoice_firstname}' => $invoice->firstname,
'{invoice_lastname}' => $invoice->lastname,
'{invoice_address2}' => $invoice->address2,
'{invoice_address1}' => $invoice->address1,
'{invoice_city}' => $invoice->city,
'{invoice_postal_code}' => $invoice->postcode,
'{invoice_country}' => $invoice->country,
'{invoice_state}' => $invoice->id_state ? $invoice_state->name : '',
'{invoice_phone}' => ($invoice->phone) ? $invoice->phone : $invoice->phone_mobile,
'{invoice_other}' => $invoice->other,
'{order_name}' => $order->getUniqReference(),
'{date}' => Tools::displayDate(date('Y-m-d H:i:s'), null, 1),
'{carrier}' => ($virtual_product || !isset($carrier->name)) ? Tools::displayError('No carrier') : $carrier->name,
'{payment}' => Tools::substr($order->payment, 0, 32),
'{products}' => $product_list_html,
'{products_txt}' => $product_list_txt,
'{discounts}' => $cart_rules_list_html,
'{discounts_txt}' => $cart_rules_list_txt,
'{total_paid}' => Tools::displayPrice($order->total_paid, $this->context->currency, false),
'{total_products}' => Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $order->total_products : $order->total_products_wt, $this->context->currency, false),
'{total_discounts}' => Tools::displayPrice($order->total_discounts, $this->context->currency, false),
'{total_shipping}' => Tools::displayPrice($order->total_shipping, $this->context->currency, false),
'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $this->context->currency, false),
'{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $this->context->currency, false));

如果您正在创建新模块,则可以传递所需的所有变量,“覆盖”ValidateOrder方法

答案 1 :(得分:0)

变量是数据库表中各列的名称,例如:对于无税装运值的变量,您可以查询表pr_orders和所需的列,在这种情况下为{ {1}},因此您可以使用值total_shipping_tax_excl在邮件中使用此值。