Post by bbaccessories » Fri Dec 09, 2011 4:45 am

We need to manage order processing & dispatch by customer group. So we need to filter the Order List by Customer Group before we can really begin processing orders.

Does anyone know a way of adding this Customer Group Column to the Order List (it is already present on the Customer List)?

Thanks

Newbie

Posts

Joined
Fri Dec 02, 2011 4:56 pm

Post by straightlight » Fri Dec 09, 2011 6:59 am

Make a backup of the followings before doing anything.

In admin/controller/sale/order.php file,

find all instances of:

Code: Select all

if (isset($this->request->get['filter_customer'])) {
				$url .= '&filter_customer=' . $this->request->get['filter_customer'];
			}
add after each results found:

Code: Select all

if (isset($this->request->get['filter_group_customer'])) {
				$url .= '&filter_group_customer=' . $this->request->get['filter_group_customer'];
			}
// Update: December 26, 2014

Find all instances of:

Code: Select all

if (isset($this->request->get['filter_customer'])) {
			$filter_customer = $this->request->get['filter_customer'];
		} else {
			$filter_customer = null;
		}
add after:

Code: Select all

if (isset($this->request->get['filter_group_customer'])) {
			$filter_group_customer = $this->request->get['filter_group_customer'];
		} else {
			$filter_group_customer = null;
		}
// End Of December 26, 2014 Update

Then, find all instances of:

Code: Select all

'filter_customer'	     => $filter_customer,
add after each results found:

Code: Select all

'filter_group_customer'	     => $filter_group_customer,
Then, find:

Code: Select all

'customer'      => $result['customer'],
add after:

Code: Select all

'group_customer'      => $result['group_customer'],
Then, find:

Code: Select all

$this->data['column_customer'] = $this->language->get('column_customer');
add after:

Code: Select all

$this->data['column_group_customer'] = $this->language->get('column_group_customer');
Then, find:

Code: Select all

$this->data['sort_customer'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'] . '&sort=customer' . $url, 'SSL');
add after:

Code: Select all

$this->data['sort_group_customer'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'] . '&sort=group_customer' . $url, 'SSL');
In admin/language/english/sale/order.php file,

find:

Code: Select all

$_['column_customer']         = 'Customer';
add after:

Code: Select all

$_['column_group_customer']         = 'Customer Groups';
In admin/model/sale/order.php file,

find:

Code: Select all

'customer',
add after:

Code: Select all

'group_customer',
find:

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 status, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
replace with:

Code: Select all

$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, o.customer_group_id AS group_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 status, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
Then, find:

Code: Select all

if (!empty($data['filter_customer'])) {
			$sql .= " AND LCASE(CONCAT(o.firstname, ' ', o.lastname)) LIKE '" . $this->db->escape(utf8_strtolower($data['filter_customer'])) . "%'";
		}
add after:

Code: Select all

if (isset($data['filter_group_customer']) && !empty($data['filter_group_customer'])) {
	$sql .= " AND o.customer_group_id = '" . (int)$data['filter_group_customer'] . "'";
} else {
	$sql .= " AND o.customer_group_id > '0'";
}
In admin/view/template/sale/order_list.tpl file,

find:

Code: Select all

<td class="left"><?php if ($sort == 'customer') { ?>
                <a href="<?php echo $sort_customer; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_customer; ?></a>
                <?php } else { ?>
                <a href="<?php echo $sort_customer; ?>"><?php echo $column_customer; ?></a>
                <?php } ?></td>
add after:

Code: Select all

<td class="left"><?php if ($sort == 'group_customer') { ?>
                <a href="<?php echo $sort_group_customer; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_group_customer; ?></a>
                <?php } else { ?>
                <a href="<?php echo $sort_group_customer; ?>"><?php echo $column_group_customer; ?></a>
                <?php } ?></td>
Then, find:

Code: Select all

<td><input type="text" name="filter_customer" value="<?php echo $filter_customer; ?>" /></td>
add after:

Code: Select all

<td><input type="text" name="filter_group_customer" value="<?php echo $filter_group_customer; ?>" /></td>
Then, find:

Code: Select all

<td class="left"><?php echo $order['customer']; ?></td>
add after:

Code: Select all

<td class="left"><?php echo $order['group_customer']; ?></td>
Then, find:

Code: Select all

var filter_customer = $('input[name=\'filter_customer\']').attr('value');
	
	if (filter_customer) {
		url += '&filter_customer=' + encodeURIComponent(filter_customer);
	}
add after:

Code: Select all

var filter_group_customer = $('input[name=\'filter_group_customer\']').attr('value');
	
	if (filter_group_customer) {
		url += '&filter_group_customer=' + encodeURIComponent(filter_group_customer);
	}
Remember to do a backup of all these files before proceeding. This is a massive request.
Last edited by straightlight on Sat Dec 27, 2014 8:18 am, edited 1 time in total.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by bbaccessories » Fri Dec 09, 2011 4:20 pm

Hi Straightlight

Wow! Thank you! This really IS MASSIVE!!!

I would not be confident enough to do this on my own at all. Would you charge a fee?

Newbie

Posts

Joined
Fri Dec 02, 2011 4:56 pm

Post by straightlight » Sat Dec 10, 2011 12:30 am

Send me a PM regarding this integration.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Strangeman » Fri Aug 24, 2012 1:55 am

This has been one of the most useful posts I have found so far ! Thank you!!. By following through the steps you have outlined, I have gained a lot more insight into how Opencart works, and have managed to adapt your instructions to have a column in the order list to filter by store_id (although there were a couple of places where things might have changed since you wrote this, so it didn't work straight away). The one remaining difficulty I have found, though, is that the default store has an id of '0' which doesn't seem to filter anything. Is there a way around this ?

New member

Posts

Joined
Tue May 29, 2012 4:39 am

Post by straightlight » Tue Sep 11, 2012 12:22 am

Strangeman wrote:This has been one of the most useful posts I have found so far ! Thank you!!. By following through the steps you have outlined, I have gained a lot more insight into how Opencart works, and have managed to adapt your instructions to have a column in the order list to filter by store_id (although there were a couple of places where things might have changed since you wrote this, so it didn't work straight away). The one remaining difficulty I have found, though, is that the default store has an id of '0' which doesn't seem to filter anything. Is there a way around this ?
Good point. I will send the updated shortly.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by DannyMacD » Wed Jan 09, 2013 4:09 pm

is there a possibility this could be a VQMod?

also would this work with 1.5.4.1?

Active Member

Posts

Joined
Fri Jun 26, 2009 6:39 am

Post by DannyMacD » Wed Feb 20, 2013 3:51 am

is there a possibility this could be a VQMod?

also would this work with 1.5.4.1?

Active Member

Posts

Joined
Fri Jun 26, 2009 6:39 am

Post by pozpoz » Thu Aug 22, 2013 9:31 pm

I tried to make o vqmod of this. Partially works. But there is one 'undefined variable' and I dont know how to deal with it. Maybe someone could check this?

I'm working on 1.5.4.1

Attachments


Newbie

Posts

Joined
Fri Nov 23, 2012 12:51 am

Post by pozpoz » Thu Aug 22, 2013 10:41 pm

I forgot about english language (i'm working with polish). I updated file for english too.

Attachments


Newbie

Posts

Joined
Fri Nov 23, 2012 12:51 am

Post by pozpoz » Fri Aug 23, 2013 6:47 pm

Anyone?

Newbie

Posts

Joined
Fri Nov 23, 2012 12:51 am

Post by straightlight » Sat Sep 14, 2013 12:06 am

I will post an update, shortly.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by emmetje » Wed Nov 20, 2013 11:22 pm

Any update on this?

Code: Select all

I've this error: Notice: Undefined variable: filter_group_customer in /home/***/domains/***/public_html/vqmod/vqcache/vq2-admin_controller_sale_order.php on line 317
Thanks in advance!

User avatar
New member

Posts

Joined
Wed Jun 22, 2011 2:18 am

Post by straightlight » Wed Nov 20, 2013 11:32 pm

Please post an attachment of that file so to see what might be the variable issue you're reporting about

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by emmetje » Thu Nov 21, 2013 12:36 am

Thanks for the really quick reply, it's a vqmod with your code from post 2, i'm using 1.5.3.1 btw...

Attachments


User avatar
New member

Posts

Joined
Wed Jun 22, 2011 2:18 am

Post by emmetje » Thu Nov 21, 2013 12:42 am

And the order.php file

Attachments


User avatar
New member

Posts

Joined
Wed Jun 22, 2011 2:18 am

Post by emmetje » Mon Nov 25, 2013 7:56 pm

straightlight wrote:Please post an attachment of that file so to see what might be the variable issue you're reporting about
Any luck?

User avatar
New member

Posts

Joined
Wed Jun 22, 2011 2:18 am

Post by emmetje » Wed Nov 27, 2013 4:44 pm


User avatar
New member

Posts

Joined
Wed Jun 22, 2011 2:18 am

Post by kelemvor » Sat Dec 20, 2014 11:15 am

Sorry to bump an old thread but I haven't had any responses to posts I've made so I'm hoping someone can help.

I'm using 1.5.5.1.

I tried the VQMod and the order page wouldn't load at all. I then tried this manually and the page loads up in the Filter box for Customer Group it says:

<b>Notice</b>: Undefined variable: filter_group_customer in <b>/public_html/store/vqmod/vqcache/vq2-admin_view_template_sale_order_list.tpl</b> on line <b>76</b>

I don't use the VQMod for this so I don't know why it's looking in there but when I open up that file, the error line is:

Code: Select all

<td><input type="text" name="filter_group_customer" value="<?php echo $filter_group_customer; ?>" /></td>
Anyone else get this figured out?

Active Member

Posts

Joined
Fri Oct 12, 2012 6:58 am

Post by straightlight » Sat Dec 27, 2014 8:18 am

kelemvor wrote:Sorry to bump an old thread but I haven't had any responses to posts I've made so I'm hoping someone can help.

I'm using 1.5.5.1.

I tried the VQMod and the order page wouldn't load at all. I then tried this manually and the page loads up in the Filter box for Customer Group it says:

<b>Notice</b>: Undefined variable: filter_group_customer in <b>/public_html/store/vqmod/vqcache/vq2-admin_view_template_sale_order_list.tpl</b> on line <b>76</b>

I don't use the VQMod for this so I don't know why it's looking in there but when I open up that file, the error line is:

Code: Select all

<td><input type="text" name="filter_group_customer" value="<?php echo $filter_group_customer; ?>" /></td>
Anyone else get this figured out?
Fixed from 2nd post. Follow the red update step.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: stefansmith129 and 200 guests