I am using Magento

I would like to have several the products for several of my categories to be automatically sorted by date added. Currently, in the 'Display Settings' tab for any one of my categories, I am not offered this option in the 'Default Product Listing Sort By" dropdown.

I know 1) how to add this option to the frontend user and I also know 2) how to overwrite a core file to set all categories to sort by entity ID (in descending order) which essentially the same as 'date added'.

However, I want to be able to configure this option for individual categories through the backend. Is there any way to have the 'date added' or 'entity id' added to the 'Default Product Listing Sort By" dropdown in the backend?

1 Answer 1


you cannot modify the attribute created_at in the backend.
So you need to create a module that just activates the created_at attribute for sorting.

For this you will need the following files:

app/etc/modules/[Namespace]_[Module].xml - the declaration file

<?xml version="1.0"?>
                <Mage_Catalog />

app/code/local/[Namespace]/[Module]/etc/config.xml - the configuration file

<?xml version="1.0"?>
                    <class>Mage_Catalog_Model_Resource_Setup</class> <!-- Make sure you use this class for setup -->

app/code/local/[Namespace]/[Module]/sql/[namespace]_[module]_setup/install-1.0.0.php - the install script

$this->updateAttribute('catalog_product', 'created_at', 'frontend_label', 'Date Added'); //Set a label to the attribute because by default it does not have one
$this->updateAttribute('catalog_product', 'created_at', 'used_for_sort_by', '1'); //mark the attribute as used for sorting.

Clear the cache and refresh any page. Now you should have the Date Added (created_at) attribute available for sorting in any category.

  • Also I think you need to set default sort order as DESC for this attribute as Magento will sort is from older to newest otherwise.
    – Amasty
    Jul 28, 2014 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.