显示$params数组('{item}' =>...)



需要帮助。在prestshop的PaymentModule.php中添加以下代码:

$params = array(
    '{voucher_amount}' => Tools::displayPrice($voucher->reduction_amount, $this->context->currency, false),
    '{voucher_num}' => $voucher->code,
    '{firstname}' => $this->context->customer->firstname,
    '{lastname}' => $this->context->customer->lastname,
    '{id_order}' => $order->reference,
    '{order_name}' => $order->getUniqReference()
);

我使用$params['firstname']来显示客户firstname,但没有得到任何结果。在/modules/bankwire/bankwire.php中插入$params['firstname']

请告诉我哪里出错了?

谢谢

在你的数组中你有一个{firstname}键,但没有firstname键。

如果你想获取值,你应该使用:$params['{firstname}']

Try

$params = array(
    'voucher_amount' => Tools::displayPrice($voucher->reduction_amount, $this->context->currency, false),
    'voucher_num' => $voucher->code,
    'firstname' => $this->context->customer->firstname,
    'lastname' => $this->context->customer->lastname,
    'id_order' => $order->reference,
    'order_name' => $order->getUniqReference()
);

或者在volkerk是对的情况下,试试

$params['{firstname}'] 

email模板有变量,它只是一个关联数组,为了访问使用

$params['{voucher_amount}']

相关内容

最新更新