选择付款方式时,opencart会在购物车中获得总价

时间:2014-12-07 17:54:07

标签: php opencart payment cart

这是我的opencart自定义付款方式代码:

<?php
class ControllerPaymentportmanat extends Controller {
    protected function index() {
        $this->data['button_confirm'] = $this->language->get('button_confirm_portmanat');

        $this->data['continue'] = $this->url->link('checkout/success');
        $this->data['order_id'] = $this->session->data['order_id'];

        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/portmanat.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/payment/portmanat.tpl';
        } else {
            $this->template = 'default/template/payment/portmanat.tpl';
        }   

        $this->render();
    }

    public function confirm() {
        $this->load->model('checkout/order');

        $this->model_checkout_order->confirm($this->session->data['order_id'], $this->config->get('portmanat_order_status_id'));
    }
}
?>

如何在代码中获得当前的 TOTAL 大小?我想在我的代码上定义 TOTAL 价格。

1 个答案:

答案 0 :(得分:0)

您可以使用getOrder并使用会话中存储的order_id来获取订单信息:

$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);

现在您可以使用$ order_info ['total']

获取订单总额
相关问题