1

Although we have provinces in the Netherlands we do not use them in an address (postcode is the most important thing with us). For this reason I disabled the province in the OpenCart checkout process. It still displays however on the invoice I print out, and since no province is filled in, the first province on the list is standard displayed, which is often the wrong one. For this reason I want to take away the province from the OpenCart invoice.

So I opened admin/view/template/sale/order_invoice.tpl and searched for the relevant part. Unfortunately, the address is referred to as $order['payment_address'] and $order['shipping_address']. Somehow, that code prints out the address including breaklines (<br />).

My question is now: how do I disable just the province in the customer address displayed on the invoice?

4

2 回答 2

1

还打开控制器类admin/controller/sale/order.php并检查填充 和 的相关部分$order['payment_address']$order['shipping_address']注释掉适当的行(被添加到字符串/数组的位置)。

同样的事情也应该在前端完成 - catalog/controller/account/order.php.

应该是这样的:

$find = array(
    '{firstname}',
    '{lastname}',
    '{company}',
    '{address_1}',
    '{address_2}',
    '{city}',
    '{postcode}',
    //'{zone}',
    //'{zone_code}',
    '{country}'
);

$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']  
);

您可能还必须将格式行从

$format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';

到(见/**/评论):

$format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' /*. "\n" . '{zone}'*/ . "\n" . '{country}';

到评论:

现在我不确定,地址格式有可能在创建后存储在订单中。在这种情况下,将控制器中的相应行更改为:

/*if ($order_info['payment_address_format']) { // <-- same for $order_info['shipping_address_format']
    $format = $order_info['payment_address_format'];
} else {
    $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
}*/

$format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' /*. "\n" . '{zone}'*/ . "\n" . '{country}';
于 2013-04-16T09:22:26.087 回答
0

对我来说,这个解决方案有效:

编辑:admin/controller/sale/order.php

$replace = array(
                'firstname' => $order_info['shipping_firstname'],
                'lastname'  => $order_info['shipping_lastname'],
                'company'   => $order_info['shipping_company'],
                'address_1' => $order_info['shipping_address_1'],
                'address_2' => $order_info['shipping_address_2'],
                'city'      => $order_info['shipping_city'],
                'postcode'  => $order_info['shipping_postcode'],
                //'zone'      => $order_info['shipping_zone'],
                //'zone_code' => $order_info['shipping_zone_code'],
                'zone'      => '',
                'zone_code' => '',
                'country'   => $order_info['shipping_country']

首先它不起作用,我认为这是缓存问题并清除所有缓存,但它不起作用。然后我搜索了请求order_invoice,这也用于/system/storage/modification/admin/controller/sale. 清除修改缓存后,它起作用了!

于 2018-10-18T09:22:46.967 回答