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

自古美人都是妖i 提交于 2019-12-13 01:24:40

问题


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


回答1:


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

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




回答2:


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}'] 



回答3:


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

$params['{voucher_amount}']


来源:https://stackoverflow.com/questions/32629999/show-params-arrayitem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!