How to add sort by date at Magento Backend

How to add sort by date at Magento Backend

October 9, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to add sort by date at Magento Backend

Sorting Products by Created Date in Magento Admin: A Comprehensive Guide

As an e-commerce store owner or developer, you may want to organize your products on the backend based on their creation date. By default, Magento doesn’t offer this sorting option in the admin panel’s configuration section. However, there are a few ways to achieve this.

Understanding the Default Sorting Options

First, let’s clarify the current sorting options available under System > Configuration > Catalog > Product Listing:

  1. Sort by: This drop-down menu allows you to choose between “Position” (manually set in each product page), “Price”, “Name”, or custom attributes. It does not include an option for “Created At”.

  2. Direction: You can select either “Ascending” or “Descending”. However, without the correct sort-by attribute, this option is limited.

The Custom Solution

To enable sorting by created date on the backend, you’ll need to create a custom module. Here’s a step-by-step guide:

  1. Create a new folder in your Magento app/code/local directory: Local/YourCompany/CatalogSort

  2. Inside this folder, create two more folders and files:

    • etc/config.xml
    • app/etc/modules/YourCompany_CatalogSort.xml
  3. Open the config.xml file and add the following code:

<?xml version="1.0"?>
<config>
  <modules>
    <YourCompany_CatalogSort>
      <active>true</active>
      <codepool>local</codepool>
      <depends>
        <Mage_Core />
        <Mage_Catalog />
      </depends>
    </YourCompany_CatalogSort>
  </modules>
</config>
  1. Open the YourCompany_CatalogSort.xml file and add this:
<?xml version="1.0"?>
<config>
  <modules>
    <YourCompany_CatalogSort>
      <active>true</active>
      <codepool>local</codepool>
      <depends>
        <Mage_Core />
        <Mage_Catalog />
      </depends>
    </YourCompany_CatalogSort>
  </modules>
</config>
  1. Now, let’s create the actual sorting functionality. In your app/code/local/YourCompany/CatalogSort/etc/adminhtml.xml file (create if it doesn’t exist), add this section:
<adminhtml>
    <menu>
        <yourcompany translate="title" module="catalogsort">
            <title>Catalog Sort</title>
        </yourcompany>
    </menu>

    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
                <children>
                    <catalogsort translate="title" module="catalogsort">
                        <title>Sort by Created Date</title>
                        <sort_order>50</sort_order>
                    </catalogsort>
                </children>
            </all>
        </resources>
    </acl>

    <layout>
        <updates>
            <catalog_product_index_sortby attribute="created_at">
                <file>yourcompany/catalogsort/index.phtml</file>
            </catalog_product_index_sortby>
        </updates>
    </layout>

    <layout_handles>
        <catalog_product_index_sortby translate="title" module="catalogsort">
            <label>Sort by Created Date</label>
            <sortOrder>40</sortOrder>
        </catalog_product_index_sortby>
    </layout_handles>
</adminhtml>
  1. Finally, create the app/code/local/YourCompany/CatalogSort/sql/catalogsortSetup/install-1.0.0.0.php file and add this:
<?php

$installer = $this;

$installer->startSetup();

$installer->addAttribute("catalog_product", "created_at", array(
    "group" => "General",
    "type" => "datetime",
    "backend" => "",
    "frontend" => "",
    "label" => "Created At",
    "input" => "date",
    "class" => "",
    "source" => "",
    "global" => Mage_Catalog_Model_Product::SCOPE_GLOBAL,
    "visible" => true,
    "required" => false,
    "user_defined" => false,
    "default" => null
));

$installer->endSetup();
  1. Clear your cache and refresh the admin panel.

Now, you should see a new option under System > Configuration > Catalog > Product Listing Sort By: “Created At”. You can select either Ascending or Descending order based on your preference.

Remember to replace YourCompany with your actual company name in all the module files.

Conclusion

While Magento doesn’t offer this feature out of the box, creating a custom module is a straightforward solution. This approach allows you to extend Magento’s core functionality without modifying any core files directly, adhering to best practices for maintainability and upgrade compatibility.

If you’re looking for more advanced customizations or need professional help with your Magento development needs, feel free to contact us at Laravel Company. Our team of experienced Magento developers is always ready to assist you with any e-commerce projects.

Catalog Extensions Admin Configuration

Our network