in your category controller this code sets the sort field and order if given, otherwise it sets the defaults.
Code: Select all
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
$sort = 'p.sort_order';
}
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} else {
$order = 'ASC';
}
You can check for any given category id (12 in example) and set the default to your liking:
Code: Select all
$parts = explode('_', (string)$this->request->get['path']);
$category_id = (int)array_pop($parts);
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} elseif ($category_id == 12) {
$sort = 'p.date_added';
} else {
$sort = 'p.sort_order';
}
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} elseif ($category_id == 12) {
$order = 'ASC';
} else {
$order = 'ASC';
}