- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2018
12:35 AM
06-08-2018
12:35 AM
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.
Labels:
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2018
01:38 AM
06-08-2018
01:38 AM
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; }
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2018
01:38 AM
06-08-2018
01:38 AM
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; }