如何使用twig只在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 }}
线路不工作。其余的都运行得很好。
发布于 2018-12-17 01:34:13
邮政编码显示在地址中:
但是如果你想单独输出,那么你需要使用控制器。
在public function shipping() {
中搜索\admin\controller\sale\order.php
$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'])
);
添加:
$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']),
'shipping_postcode' => $order_info['shipping_postcode']
);
现在您可以在模板中使用:{{ order.shipping_postcode }}
https://stackoverflow.com/questions/53801171
复制相似问题