Hi,
I want to, in the admin, sort by position and, when some products share the same, sort them by id.
The route is:
catalog > manage categories > "Select categorie" > Category Products, and in this table, sort by position
But I can't find the method that do the work. Any idea?
Solved! Go to Solution.
More or less all the sorting stuff are in:
app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
And the function I was looking for (already modified to fit my pourpouse):
protected function _setCollectionOrder($column)
{
$collection = $this->getCollection();
if ($collection) {
$columnIndex = $column->getFilterIndex() ?
$column->getFilterIndex() : $column->getIndex();
$collection->setOrder($columnIndex, strtoupper($column->getDir()))
->setOrder('entity_id', 'asc'); // new line
}
return $this;
}
More or less all the sorting stuff are in:
app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
And the function I was looking for (already modified to fit my pourpouse):
protected function _setCollectionOrder($column)
{
$collection = $this->getCollection();
if ($collection) {
$columnIndex = $column->getFilterIndex() ?
$column->getFilterIndex() : $column->getIndex();
$collection->setOrder($columnIndex, strtoupper($column->getDir()))
->setOrder('entity_id', 'asc'); // new line
}
return $this;
}