如何使用树枝仅在Opencart版本3中显示邮政编码?
我尝试自定义/admin/view/template/sale/order_shipping.twig
:
{% for order in orders %}
{{ order.shipping_address }}
{{ order.telephone }}
{{ order.store_telephone }}
{{ order.shipping_postcode }} <!-- This one doesn't work -->
{% endfor %}
{{ order.shipping_postcode }}
行不起作用。其余的工作正常。
答案 0 :(得分:2)
邮政编码显示在地址中:
但是如果要单独输出,则需要使用控制器。
在const results = taxItems.reduce(function(sum, taxItem) {
let index = sum.map(item => item.taxCode).indexOf(taxItem.taxCode);
if (index == -1) {
sum.push(taxItem);
} else {
sum[index].taxAmount = sum[index].taxAmount + taxItem.taxAmount;
}
return sum;
}, []);
//results
//[{"taxCode":"430","taxAmount":12,"ItemTaxPercentage":20,"taxCategory":"2"}{"taxCode":"431","taxAmount":5,"ItemTaxPercentage":20,"taxCategory":"2"}]
的{{1}}中搜索:
\admin\controller\sale\order.php
添加:
public function shipping() {
现在您可以在模板中使用:$data['orders'][] = array(
'order_id' => $order_id,
'invoice_no' => $invoice_no,
'date_added' => date($this->language->get('date_format_short'), strtotime($order_info['date_added'])),
'store_name' => $order_info['store_name'],
'store_url' => rtrim($order_info['store_url'], '/'),
'store_address' => nl2br($store_address),
'store_email' => $store_email,
'store_telephone' => $store_telephone,
'email' => $order_info['email'],
'telephone' => $order_info['telephone'],
'shipping_address' => $shipping_address,
'shipping_method' => $order_info['shipping_method'],
'product' => $product_data,
'comment' => nl2br($order_info['comment'])
);