The best way to get around this without changing the main files is to copy the Toolbar.php file located:
/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
then create a new directory path (if you did not create one):
/app/code/local/Mage/Catalog/Block/Product/List/Toolbar.php
Now replace the following from line 232:
if ($this->getCurrentOrder()) { $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection()); }
to
if ($this->getCurrentOrder()) { if(($this->getCurrentOrder())=='position'){ //defines the sort option //sort by position (ascending) and entity_id (descending) $this->_collection->addAttributeToSort('position','asc')->addAttributeToSort('entity_id','desc'); } else { $this->_collection->setOrder($this->getCurrentOrder(),$this->getCurrentDirection()); } }
Finally, reindex and update the cache on your Magento backend and is ready to go. If you need to define more than one instance of the sort option and paste the code below immediately before} else {
if(($this->getCurrentOrder())=='######'){ //defines the sort option //sort by ###### (ascending) and ###### (descending) $this->_collection->addAttributeToSort('######','asc')->addAttributeToSort('######','desc');
source share