Post by mobarez » Fri Aug 07, 2020 2:58 am

How do i add the name in the shipping information behind to the customer’s name on the order history page?

Attachments

IMG_٢٠٢٠٠٨٠٦_٢٠٤٦٤٩.jpg

The name in order hiatory page - IMG_٢٠٢٠٠٨٠٦_٢٠٤٦٤٩.jpg (120.16 KiB) Viewed 3654 times

IMG_٢٠٢٠٠٨٠٦_٢٠٥١٠٠.jpg

The name in shipping information - IMG_٢٠٢٠٠٨٠٦_٢٠٥١٠٠.jpg (122.54 KiB) Viewed 3653 times

Last edited by mobarez on Sun Aug 09, 2020 8:14 am, edited 3 times in total.

New member

Posts

Joined
Fri May 29, 2020 4:31 pm

Post by paulfeakins » Fri Aug 07, 2020 4:41 pm

mobarez wrote:
Fri Aug 07, 2020 2:58 am
How did the name in the shipping information behind to the customer’s name on the order history page?
Image

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by mobarez » Fri Aug 07, 2020 6:15 pm

How do I add the name in the shipping information next to the customer's name on the order history page

New member

Posts

Joined
Fri May 29, 2020 4:31 pm

Post by mobarez » Fri Aug 07, 2020 6:40 pm

Sorry for my English

New member

Posts

Joined
Fri May 29, 2020 4:31 pm

Post by xxvirusxx » Fri Aug 07, 2020 8:44 pm

You want to display Shipping method name before customer name?

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by letxobnav » Fri Aug 07, 2020 9:43 pm

He wants the name on the shipping address to be listed as a column between the order id column and the customer name column.
Probably for when the person who the shipment is send to is not the same as the customer.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by mobarez » Fri Aug 07, 2020 11:43 pm

letxobnav wrote:
Fri Aug 07, 2020 9:43 pm
He wants the name on the shipping address to be listed as a column between the order id column and the customer name column.
Probably for when the person who the shipment is send to is not the same as the customer.
Exactly

New member

Posts

Joined
Fri May 29, 2020 4:31 pm

Post by letxobnav » Sat Aug 08, 2020 3:21 pm

so which OC version are you using, which template and which extension in admin?
I do not recognize that screen so I suspect you already have a modification running.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by mobarez » Sat Aug 08, 2020 3:47 pm

letxobnav wrote:
Sat Aug 08, 2020 3:21 pm
so which OC version are you using, which template and which extension in admin?
I do not recognize that screen so I suspect you already have a modification running.
I use 3.0.3.2 version
And journal theme only

New member

Posts

Joined
Fri May 29, 2020 4:31 pm

Post by letxobnav » Sat Aug 08, 2020 3:56 pm

then I am afraid you need to contact journal.
I can tell you how to do it default but I think journal does not use those functions so it would be no use to you.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by mobarez » Sat Aug 08, 2020 7:36 pm

letxobnav wrote:
Sat Aug 08, 2020 3:56 pm
then I am afraid you need to contact journal.
I can tell you how to do it default but I think journal does not use those functions so it would be no use to you.
Tell me how do it in default
And how the name on the shipping address to be listed as a column between the order id column and the customer name column in admin panel

New member

Posts

Joined
Fri May 29, 2020 4:31 pm

Post by letxobnav » Sat Aug 08, 2020 8:51 pm

OK,

1) in admin/model/sale/order.php - function getOrders
change the query:

Code: Select all

		$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
to:

Code: Select all

		$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, CONCAT(o.shipping_firstname, ' ', o.shipping_lastname) AS ship_to, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
that will make sure those fields are retrieved as well.

2) in admin/controller/sale/order.php - function getList
change the array assignment:

Code: Select all

			$data['orders'][] = array(
				'order_id'      => $result['order_id'],
				'customer'      => $result['customer'],
				'order_status'  => $result['order_status'] ? $result['order_status'] : $this->language->get('text_missing'),
				'total'         => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
				'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
				'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
				'shipping_code' => $result['shipping_code'],
				'view'          => $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true),
				'edit'          => $this->url->link('sale/order/edit', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true)
			);
to:

Code: Select all

			$data['orders'][] = array(
				'order_id'      => $result['order_id'],
				'customer'      => $result['customer'],
				'ship_to'       => $result['ship_to'],
				'order_status'  => $result['order_status'] ? $result['order_status'] : $this->language->get('text_missing'),
				'total'         => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
				'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
				'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
				'shipping_code' => $result['shipping_code'],
				'view'          => $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true),
				'edit'          => $this->url->link('sale/order/edit', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true)
			);

3) in admin/view/template/sale/order_list.twig
before:

Code: Select all

<td class="text-left">{% if sort == 'customer' %} <a href="{{ sort_customer }}" class="{{ order|lower }}">{{ column_customer }}</a> {% else %} <a href="{{ sort_customer }}">{{ column_customer }}</a> {% endif %}</td>
add:

Code: Select all

<td class="text-left">{{ column_ship_to }}</td>
before:

Code: Select all

<td class="text-left">{{ order.customer }}</td>
add:

Code: Select all

<td class="text-left">{{ order.ship_to }}</td>
4) in your admin/language/xx-xx/sale/order.php
add:

Code: Select all

$_['column_ship_to']            = 'Ship To';

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by khnaz35 » Sat Aug 08, 2020 8:57 pm

letxobnav wrote:
Sat Aug 08, 2020 8:51 pm
OK,

1) in admin/model/sale/order.php - function getOrders
change the query:

Code: Select all

		$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
to:

Code: Select all

		$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, CONCAT(o.shipping_firstname, ' ', o.shipping_lastname) AS ship_to, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
that will make sure those fields are retrieved as well.

2) in admin/controller/sale/order.php - function getList
change the array assignment:

Code: Select all

			$data['orders'][] = array(
				'order_id'      => $result['order_id'],
				'customer'      => $result['customer'],
				'order_status'  => $result['order_status'] ? $result['order_status'] : $this->language->get('text_missing'),
				'total'         => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
				'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
				'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
				'shipping_code' => $result['shipping_code'],
				'view'          => $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true),
				'edit'          => $this->url->link('sale/order/edit', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true)
			);
to:

Code: Select all

			$data['orders'][] = array(
				'order_id'      => $result['order_id'],
				'customer'      => $result['customer'],
				'ship_to'       => $result['ship_to'],
				'order_status'  => $result['order_status'] ? $result['order_status'] : $this->language->get('text_missing'),
				'total'         => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
				'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
				'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
				'shipping_code' => $result['shipping_code'],
				'view'          => $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true),
				'edit'          => $this->url->link('sale/order/edit', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true)
			);

3) in admin/view/template/sale/order_list.twig
before:

Code: Select all

<td class="text-left">{% if sort == 'customer' %} <a href="{{ sort_customer }}" class="{{ order|lower }}">{{ column_customer }}</a> {% else %} <a href="{{ sort_customer }}">{{ column_customer }}</a> {% endif %}</td>
add:

Code: Select all

<td class="text-left">{{ column_ship_to }}</td>
before:

Code: Select all

<td class="text-left">{{ order.customer }}</td>
add:

Code: Select all

<td class="text-left">{{ order.ship_to }}</td>
4) in your admin/language/xx-xx/sale/order.php
add:

Code: Select all

$_['column_ship_to']            = 'Ship To';
That's called help without any expectation of return.

Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by by mona » Sat Aug 08, 2020 9:34 pm

That's called help without any expectation of return.
and that is called calling out people who CHOOSE not to offer their knowledge for free, on the most part, their knowledge is their paid income and we are all entitled to make a living with our skills

I do not see many people offering their products for free

On that point, I would actually like to say thank you to the very kind Scot who offered me candy :) and you know what that is what is I call give and receive ..

You can not force people to help you. I am not here to help everyone that I can .. I choose who I want to help .. We each have our own reasons ... and this may surprise you, but we are entitled to do that

letxobnav is great - instead of your comment dragging others down ..
:clap: :clap: :clap: :clap: :clap: letxobnav :clap: :clap: :clap: :clap: :clap:

and he might not EXPECT anything in return, but he sure deserves to receive something in return ..

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by khnaz35 » Sat Aug 08, 2020 11:22 pm

by mona wrote:
Sat Aug 08, 2020 9:34 pm
That's called help without any expectation of return.
and that is called calling out people who CHOOSE not to offer their knowledge for free, on the most part, their knowledge is their paid income and we are all entitled to make a living with our skills

I do not see many people offering their products for free

On that point, I would actually like to say thank you to the very kind Scot who offered me candy :) and you know what that is what is I call give and receive ..

You can not force people to help you. I am not here to help everyone that I can .. I choose who I want to help .. We each have our own reasons ... and this may surprise you, but we are entitled to do that

letxobnav is great - instead of your comment dragging others down ..
:clap: :clap: :clap: :clap: :clap: letxobnav :clap: :clap: :clap: :clap: :clap:

and he might not EXPECT anything in return, but he sure deserves to receive something in return ..
I have no intention to calling out other people to help every one here its their.

If you want to help some one its your liking if not its also your business i don't mind.

My message was simple to appreciate and encourage those who are willing to help others.

Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by mobarez » Sun Aug 09, 2020 8:13 am

letxobnav wrote:
Sat Aug 08, 2020 8:51 pm
OK,

1) in admin/model/sale/order.php - function getOrders
change the query:

Code: Select all

		$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
to:

Code: Select all

		$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, CONCAT(o.shipping_firstname, ' ', o.shipping_lastname) AS ship_to, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
that will make sure those fields are retrieved as well.

2) in admin/controller/sale/order.php - function getList
change the array assignment:

Code: Select all

			$data['orders'][] = array(
				'order_id'      => $result['order_id'],
				'customer'      => $result['customer'],
				'order_status'  => $result['order_status'] ? $result['order_status'] : $this->language->get('text_missing'),
				'total'         => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
				'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
				'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
				'shipping_code' => $result['shipping_code'],
				'view'          => $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true),
				'edit'          => $this->url->link('sale/order/edit', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true)
			);
to:

Code: Select all

			$data['orders'][] = array(
				'order_id'      => $result['order_id'],
				'customer'      => $result['customer'],
				'ship_to'       => $result['ship_to'],
				'order_status'  => $result['order_status'] ? $result['order_status'] : $this->language->get('text_missing'),
				'total'         => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
				'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
				'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
				'shipping_code' => $result['shipping_code'],
				'view'          => $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true),
				'edit'          => $this->url->link('sale/order/edit', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true)
			);

3) in admin/view/template/sale/order_list.twig
before:

Code: Select all

<td class="text-left">{% if sort == 'customer' %} <a href="{{ sort_customer }}" class="{{ order|lower }}">{{ column_customer }}</a> {% else %} <a href="{{ sort_customer }}">{{ column_customer }}</a> {% endif %}</td>
add:

Code: Select all

<td class="text-left">{{ column_ship_to }}</td>
before:

Code: Select all

<td class="text-left">{{ order.customer }}</td>
add:

Code: Select all

<td class="text-left">{{ order.ship_to }}</td>
4) in your admin/language/xx-xx/sale/order.php
add:

Code: Select all

$_['column_ship_to']            = 'Ship To';
it's working ;D
Thank you very much for your cooperation with me and for giving me help free of charge. This is an unforgettable support :D

New member

Posts

Joined
Fri May 29, 2020 4:31 pm

Post by mobarez » Sun Aug 09, 2020 8:43 am

Do I repeat the same steps with the order history page to get it there?

New member

Posts

Joined
Fri May 29, 2020 4:31 pm

Post by letxobnav » Mon Aug 10, 2020 10:44 am

I do not know what your order history page is.
Default OC has an order list and an order detail page (including a history part which is just a blockchain-line order status/comment record).

Your original image shows the order list named as order history (though it lists the number of products which is not default).
The changes you applied are for the order list so I assume you have another order history page which is journal specific?
order-history.jpg

order-history.jpg (120.16 KiB) Viewed 3113 times

Better state what the route of the page is instead of the name like sale/order or sale/order/info, you find this in the address bar.
Then it is more clear what page you are talking about as people can always change the name but not the route.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by mobarez » Mon Aug 10, 2020 5:07 pm

letxobnav wrote:
Mon Aug 10, 2020 10:44 am
I do not know what your order history page is.
Default OC has an order list and an order detail page (including a history part which is just a blockchain-line order status/comment record).

Your original image shows the order list named as order history (though it lists the number of products which is not default).
The changes you applied are for the order list so I assume you have another order history page which is journal specific?
order-history.jpg

Better state what the route of the page is instead of the name like sale/order or sale/order/info, you find this in the address bar.
Then it is more clear what page you are talking about as people can always change the name but not the route.

/index.php?route=account/order

New member

Posts

Joined
Fri May 29, 2020 4:31 pm

Post by letxobnav » Mon Aug 10, 2020 6:34 pm

ah, on the front-end, no that is not the same but it is exactly the same principle.
for this you need to change catalog/model/account/order.php function getOrders
change:

Code: Select all

$query = $this->db->query("SELECT o.order_id, o.firstname, o.lastname, os.name as status, o.date_added, o.total, o.currency_code, o.currency_value FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_status os ON (o.order_status_id = os.order_status_id) WHERE o.customer_id = '" . (int)$this->customer->getId() . "' AND o.order_status_id > '0' AND o.store_id = '" . (int)$this->config->get('config_store_id') . "' AND os.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY o.order_id DESC LIMIT " . (int)$start . "," . (int)$limit);
to:

Code: Select all

$query = $this->db->query("SELECT o.order_id, o.firstname, o.lastname, o.shipping_firstname, o.shipping_lastname, os.name as status, o.date_added, o.total, o.currency_code, o.currency_value FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_status os ON (o.order_status_id = os.order_status_id) WHERE o.customer_id = '" . (int)$this->customer->getId() . "' AND o.order_status_id > '0' AND o.store_id = '" . (int)$this->config->get('config_store_id') . "' AND os.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY o.order_id DESC LIMIT " . (int)$start . "," . (int)$limit);
in catalog/controller/account/order.php function index
change the array:

Code: Select all

			$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),
			);
to:

Code: Select all

			$data['orders'][] = array(
				'order_id'   => $result['order_id'],
				'name'       => $result['firstname'] . ' ' . $result['lastname'],
				'ship_to'    => $result['shipping_firstname'] . ' ' . $result['shipping_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),
			);

in catalog/view/theme/default/template/account/order_list.twig
before:

Code: Select all

<td class="text-left">{{ column_customer }}</td>
add:

Code: Select all

<td class="text-left">{{ column_ship_to }}</td>
before:

Code: Select all

<td class="text-left">{{ order.name }}</td>
add:

Code: Select all

<td class="text-left">{{ order.ship_to }}</td>
then at last:
in catalog/language/xx-xx/account/order.php
add:

Code: Select all

$_['column_ship_to']       = 'Ship To';
as you can see, same principle, different files.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan
Who is online

Users browsing this forum: No registered users and 35 guests