Dear All
I am using 1.5.1.1
I would like to have Admin >Sales > Customers > Customers listing to have default of sort by date_added in DESC order, meaning when i click Admin > Sales > Customers > Customers, the first entry shall be the latest customer who has register.
Can you help to point to which file and what to change?
Many Thank in advance.
Regards
Mike aka ShiokGuy
I am using 1.5.1.1
I would like to have Admin >Sales > Customers > Customers listing to have default of sort by date_added in DESC order, meaning when i click Admin > Sales > Customers > Customers, the first entry shall be the latest customer who has register.
Can you help to point to which file and what to change?
Many Thank in advance.
Regards
Mike aka ShiokGuy
admin/model/sale/customer.php
find
change to
find
Code: Select all
if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
$sql .= " ORDER BY " . $data['sort'];
} else {
$sql .= " ORDER BY name";
}
if (isset($data['order']) && ($data['order'] == 'DESC')) {
$sql .= " DESC";
} else {
$sql .= " ASC";
}
Code: Select all
if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
$sql .= " ORDER BY " . $data['sort'];
} else {
$sql .= " ORDER BY date_added";
}
if (isset($data['order']) && ($data['order'] == 'ASC')) {
$sql .= " ASC";
} else {
$sql .= " DESC";
}
Dear Simon,
Thank you for helping me out. This is what I have changed
However when I click, Admin>Sales>Customers>Customers, the default sorting is still by customer name.
Regards
Mike
Thank you for helping me out. This is what I have changed
Code: Select all
if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
$sql .= " ORDER BY " . $data['sort'];
} else {
// $sql .= " ORDER BY name"; Edit by Yong
$sql .= " ORDER BY date_added";
}
// if (isset($data['order']) && ($data['order'] == 'DESC')) { Edit by Yong
if (isset($data['order']) && ($data['order'] == 'ASC')) {
// $sql .= " DESC"; Edit By Yong
$sql .= " ASC";
} else {
// $sql .= " ASC"; Edit By Yong
$sql .= " DESC";
}
Regards
Mike
Here is the code to sort Admin >Sales > Customers > Customers listing to have default of sort by date in DESC
admin/model/sale/customer.php
admin/controller/sale/customer.php
admin/model/sale/customer.php
Code: Select all
if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
$sql .= " ORDER BY " . $data['sort'];
} else {
$sql .= " ORDER BY c.date_added";
}
if (isset($data['order']) && ($data['order'] == 'ASC')) {
$sql .= " ASC";
} else {
$sql .= " DESC";
}
Code: Select all
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
$sort = 'c.date_added';
}
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} else {
$order = 'DESC';
}
It is far easier to set the default sort column and order where the default it detected.
/admin/controller/sale/customer.php
Find
Change last line to:
Find:
Change last line to:
Easy peasy...
/admin/controller/sale/customer.php
Find
Code: Select all
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
$sort = 'name';
Code: Select all
$sort = 'c.date_added';
Code: Select all
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} else {
$order = 'ASC';
Code: Select all
$order = 'DESC';
@rbuckthal:rbuckthal wrote:It is far easier to set the default sort column and order where the default it detected.
Easy peasy...
Thank you for your excellent advice, this works perfectly in OC-1564.
Regards,
Sun Systems
Industrial Electronics and Instrumentation
Who is online
Users browsing this forum: No registered users and 18 guests