Show $params array('{item}' =>…)

2019-08-15 22:07发布

Need some help. Have this code in PaymentModule.php in Prestashop:

$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()
);

I use $params['firstname'] for showing customer firstname and get nothing. I insert $params['firstname'] in /modules/bankwire/bankwire.php

Please tell me where I make a mistake?

Thanks

3条回答
男人必须洒脱
2楼-- · 2019-08-15 22:13

In your array you have a {firstname} key, but no firstname key.

If you want to get value, you should use: $params['{firstname}']

查看更多
我想做一个坏孩纸
3楼-- · 2019-08-15 22:23

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()
);

or in the case that volkerk is right, try

$params['{firstname}'] 
查看更多
干净又极端
4楼-- · 2019-08-15 22:39

there is variables for email template, it's just assoc array, for access use

$params['{voucher_amount}']
查看更多
登录 后发表回答