我希望区域代码代替区域名称和国家/地区代码,而不仅仅是发票中的国家/地区名称。
像: 名字, 地址第一行, 英国西萨塞克斯郡
如: 名字, 地址第1行,SXW,英国
我在以下文件中做了一些修改:
的public_html / _admin /控制器/销售/ order.php
if ($order_info['shipping_address_format']) {
$format = $order_info['shipping_address_format'];
} else {
$format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . ", " . '{address_2}' . ", " . '{city} {postcode}' . ", " . '{zone_code}' . "\n" . '{country_code}';
}
我获得的区号很好,但没有获得国家/地区代码,它显示了' {country_code}'仅
如何解决这个问题? 提前谢谢。
答案 0 :(得分:0)
更新文件如下: `$ find = array( '{名字}', '{姓}', '{公司}', '{地址1}', '{地址2}', '{市}', '{}邮编', '{区}', '{} zone_code', '{国家}', '{国家代码}' );
$replace = array(
'firstname' => $order_info['payment_firstname'],
'lastname' => $order_info['payment_lastname'],
'company' => $order_info['payment_company'],
'address_1' => $order_info['payment_address_1'],
'address_2' => $order_info['payment_address_2'],
'city' => $order_info['payment_city'],
'postcode' => $order_info['payment_postcode'],
'zone' => $order_info['payment_zone'],
'zone_code' => $order_info['payment_zone_code'],
'country' => $order_info['payment_country'],
'country_code' => $order_info['shipping_iso_code_3']
);
$data['payment_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format))));
// Shipping Address
if ($order_info['shipping_address_format']) {
$format = $order_info['shipping_address_format'];
} else {
$format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country_code}';
}`
在$ find和$ replace数组中添加了country_code。