Page 1 of 1

[SOLVED] Add "shipping method" column to Order List

Posted: Thu Oct 15, 2020 6:06 am
by AlanARG
Hey guys! How's it going?

I found this thread: viewtopic.php?f=20&t=48060
that would probably help but it's an old version.
Also, I've found this: https://stackoverflow.com/questions/320 ... t-opencart

Any ideas on how to add the "shipping method" column to the order list menu? 3.0.3.6 version.

Thanks!

Re: Add "shipping method" column to Order List

Posted: Thu Oct 15, 2020 11:38 am
by letxobnav
1) admin/model/sale/order.php -> function getOrders
add:

Code: Select all

o.shipping_method
to the select statement

2) admin/controller/sale/order.php -> function getList
add:

Code: Select all

'shipping_method'	=> $result['shipping_method'],
after

Code: Select all

$data['orders'][] = array(
3) admin/view/template/sale/order_list.twig
add:

Code: Select all

<td class="text-right">Shipping</td>
before:

Code: Select all

<td class="text-left">{% if sort == 'o.date_added' %} <a href="{{ sort_date_added }}" class="{{ order|lower }}">{{ column_date_added }}</a> {% else %} <a href="{{ sort_date_added }}">{{ column_date_added }}</a> {% endif %}</td>
or where you want the column to show

add:

Code: Select all

<td class="text-left">{{ order.shipping_method }}</td>
before:

Code: Select all

<td class="text-left">{{ order.date_added }}</td>
or where you want the column to show

clear your caches

Re: Add "shipping method" column to Order List

Posted: Thu Oct 15, 2020 12:15 pm
by AlanARG
letxobnav wrote:
Thu Oct 15, 2020 11:38 am
1) admin/model/sale/order.php -> function getOrders
add:

Code: Select all

o.shipping_method
to the select statement

2) admin/controller/sale/order.php -> function getList
add:

Code: Select all

'shipping_method'	=> $result['shipping_method'],
after

Code: Select all

$data['orders'][] = array(
3) admin/view/template/sale/order_list.twig
add:

Code: Select all

<td class="text-right">Shipping</td>
before:

Code: Select all

<td class="text-left">{% if sort == 'o.date_added' %} <a href="{{ sort_date_added }}" class="{{ order|lower }}">{{ column_date_added }}</a> {% else %} <a href="{{ sort_date_added }}">{{ column_date_added }}</a> {% endif %}</td>
or where you want the column to show

add:

Code: Select all

<td class="text-left">{{ order.shipping_method }}</td>
before:

Code: Select all

<td class="text-left">{{ order.date_added }}</td>
or where you want the column to show

clear your caches
Thanks a lot man, that was extremely helpful and so easy to do.

You are helping me out over here as well (viewtopic.php?f=199&t=220358&p=801612#p801612) and if you don't mind I'd like to donate something to you for this help. Let me know how :)

Thanks a lot again!