Does anyone know a way of adding this Customer Group Column to the Order List (it is already present on the Customer List)?
Thanks
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'];
}
Code: Select all
if (isset($this->request->get['filter_group_customer'])) {
$url .= '&filter_group_customer=' . $this->request->get['filter_group_customer'];
}
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;
}
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;
}
Then, find all instances of:
Code: Select all
'filter_customer' => $filter_customer,
Code: Select all
'filter_group_customer' => $filter_group_customer,
Code: Select all
'customer' => $result['customer'],
Code: Select all
'group_customer' => $result['group_customer'],
Code: Select all
$this->data['column_customer'] = $this->language->get('column_customer');
Code: Select all
$this->data['column_group_customer'] = $this->language->get('column_group_customer');
Code: Select all
$this->data['sort_customer'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'] . '&sort=customer' . $url, 'SSL');
Code: Select all
$this->data['sort_group_customer'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'] . '&sort=group_customer' . $url, 'SSL');
find:
Code: Select all
$_['column_customer'] = 'Customer';
Code: Select all
$_['column_group_customer'] = 'Customer Groups';
find:
Code: Select all
'customer',
Code: Select all
'group_customer',
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";
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";
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'])) . "%'";
}
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'";
}
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>
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>
Code: Select all
<td><input type="text" name="filter_customer" value="<?php echo $filter_customer; ?>" /></td>
Code: Select all
<td><input type="text" name="filter_group_customer" value="<?php echo $filter_group_customer; ?>" /></td>
Code: Select all
<td class="left"><?php echo $order['customer']; ?></td>
Code: Select all
<td class="left"><?php echo $order['group_customer']; ?></td>
Code: Select all
var filter_customer = $('input[name=\'filter_customer\']').attr('value');
if (filter_customer) {
url += '&filter_customer=' + encodeURIComponent(filter_customer);
}
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);
}
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
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?
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Good point. I will send the updated shortly.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 ?
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I'm working on 1.5.4.1
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
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
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
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>
Fixed from 2nd post. Follow the red update step.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:
Anyone else get this figured out?Code: Select all
<td><input type="text" name="filter_group_customer" value="<?php echo $filter_group_customer; ?>" /></td>
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: No registered users and 15 guests