I'm using Opencart 1.5.4, clean install.
I have a category that I named "New Arrivals". The products in this category should be automatically sorted so that the newest products will be shown first.
After searching the forum, basically what I've found is to modify 2 lines on the controller/category.php like this:
change $sort = 'p.sort_order'; to $sort = 'p.date_added';
and change $order = 'ASC'; to $order = 'DESC';
Yes, it works BUT it affects ALL category pages!
Now all products in each category are sorted by default newest first.
Whereas, what I want is to apply it in "New Arrivals" category ONLY.
What I have in my mind, applying this to specific category will have something to do with category id (path).
My "New Arrivals" category id is 102. So I must first detect the current path. If it is 102 then apply sort by newest. If it is not 102, then ignore.
Then I tried to modify controller/category.php like this
Part 1, find this:
Code: Select all
$sort = 'p.sort_order';
Code: Select all
if ($this->request->get['path'] == '102')
{
$sort = 'p.date_added';
}
$sort = 'p.sort_order';
Code: Select all
$order = 'ASC';
Code: Select all
if ($this->request->get['path'] == '102')
{
$order = 'DESC';
}
$order = 'ASC';
Or it might be wrong lines (and wrong syntax)?
Please help me

Thank you..