D
D
DeniSidorenko2020-05-12 10:19:21
opencart
DeniSidorenko, 2020-05-12 10:19:21

How can I get the shipping method in the order_list?

Good afternoon, as far as you can see, one controller is responsible for order_list and order_info. BUT how in order_list (, you can get the shipping method

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lazuren, 2020-05-12
@DeniSidorenko

In the index method of the order.php controller after the lines -

$data['orders'][] = array(
        'order_id'   => $result['order_id'],
        'name'       => $result['firstname'] . ' ' . $result['lastname'],
        'status'     => $result['status'],
        'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
        'products'   => ($product_total + $voucher_total),
        'total'      => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
        'view'       => $this->url->link('account/order/info', 'order_id=' . $result['order_id'], true),
      );

Insert -
$totals = $this->model_account_order->getOrderTotals($result['order_id']);

            foreach ($totals as $total) {
                if($total['code'] == 'shipping'){
                    $data['shipping'] = array(
                        'title' => $total['title'],
                        'value'  => $total['value'],
                    );
                }
            }

After that, in the order_list file, you get the shipping array with the keys title (name of the shipping method) and value (delivery amount)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question