I have the default sort order for all categories by price low-high (p.date_added ASC
) but for a specific category example "new products" I want the sort to be p.date_added DESC
.
In `catalog/controller/product/category.php I have:
<?php class ControllerProductCategory extends Controller {
public function index() {
$this->language->load('product/category');
$this->load->model('catalog/category');
$this->load->model('catalog/product');
$this->load->model('tool/image');
if (isset($this->request->get['filter'])) {
$filter = $this->request->get['filter'];
} else {
$filter = '';
}
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
$sort = 'p.price';
}
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} else {
$order = 'ASC';
}
How can I make for the category "new products" the sort p.date_added DESC
?
I have tried:
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
$sort = 'p.price';
}
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else (isset($category_id) && $category_id == '109') {
$sort = 'p.date_added';
}
But doesn't work.
Thank You.