@macsmart: it’s not configurable from admin yet, take a look in app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php function getCurrentOrder() - it will take the first available. So you can either change this method or change available orders on line 41
I have got rid of the Best Value ,
which I can’t understand much, in any case…
for ex.: what does it mean its code name position ? and
what is the VALUE it’s talking about:
money value? convenience?? ethics ???
In the same place, app / code / core / Mage / Catalog / Block / Product / List / Toolbar.php,
from this:
It works in my front end, but I am not sure if it is a correct practice or
if it may give trouble somewhere, sometimes, later on…
Could some of the code-gurus around here confirm if the above is OK ?
Also, it could be wonderful to be able to add a choice of
DATE , i.e. from newest to oldest and vice-versa.
Anyone would like to suggest the code for this?
And that actually worked. It shows products from newest to oldest books in that category. Thank god the default was to show newest to oldest (DESC).
I was wrong, I think the default is ASC… how do I change the default for Newest to be DESC? I see a function to getCurrentDirection() but not sure that’ll help. How do I set it to ‘desc’ to start with on each page?
I was wrong, I think the default is ASC… how do I change the default for Newest to be DESC? I see a function to getCurrentDirection() but not sure that’ll help. How do I set it to ‘desc’ to start with on each page?
Figured it out: in the same toolbar.php file, around lines 101-110, change this:
public function getCurrentDirection()
{
if ($dir = (string) $this->getRequest()->getParam($this->getDirectionVarName())) {
$dir = strtolower($dir);
if (in_array($dir, array(’desc’, ‘asc’))) {
return $dir;
}
}
return ‘asc’;
}
To this:
public function getCurrentDirection()
{
if ($dir = (string) $this->getRequest()->getParam($this->getDirectionVarName())) {
$dir = strtolower($dir);
if (in_array($dir, array(’desc’, ‘asc’))) {
return $dir;
}
}
return ‘desc’;
}
Along with your ‘newest’ entity_id it works like a charm!
in case someone finds this useful (I know how frustrating magento can get) this is what I had to do:
- I had to sort the products alphabetically in “sort by manufacturer” mode; this means I had to have products sorted after two fields: first by manufacturer and then by name;
what I did is change the same file: app / code / core / Mage / Catalog / Block / Product / List / Toolbar.php
ofcourse that someone can change the hardcoded value like “asc” to get the current direction with “$this->getCurrentDirection()”; and any other hacks someone may need in its project.
WOOOT! GO MOSHE!!! Just remember to put the “,” marks where they should be if you mess with the syntax. I got a fatal error until my noobness figured out I didn’t have a “,” where it should have been.