It seems to be trivial, but it’s not. If you want to use custom table and custom model, and sort collection by one of your table’s column, you can’t just use addAttributeToSort as you do with native Magento collection (like “catalog/product”). Instead of this, you should use setOrder, so your code should look like this:

 

Well, that is pretty simple but in case someone will need this, just:

 

In case someone will need this, it’s quite simple:

 

Preparing such export is quite easy, so let’s begin with adding new button in products listing:

in app/code/core/Mage/Adminhtml/Block/Catalog/Product.php in _prepareLayout() function add such code:

then in app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php add new function:

and thats all. You will get new button with export ability.

Today I had to change Magento default products list sorting to sort by product’s date. In fact we don’t need to sort by date, just by entity_id which is product ID in Magento world. To accomplish this, we need to edit /app/code/core/Mage/Catalog/Block/Product/List.php

You have to find _beforeToHtml() function and change some things inside. First we need to define all available sorting options:

then remove all getters of default sorting and order, and put those:

so finally your _beforeToHtml() should looks like this one:

 

Maybe someone will need it, so here we go with code:

 

the snippet above will give you such output:

root category 1 ; 1
root category 1 > subcategory 1 ; 2
root category 1 > subcategory 1 > subsubcategory 1 ; 3
root category 1 > subcategory 1 > subsubcategory 2 ; 4
root category 1 > subcategory 2 ; 5
root category 1 > subcategory 2 > subsubcategory 1 ; 6