Magento backend routes and ClearCache module

Magento backend routes and ClearCache module

All of Magento’s built-in backend modules share the same route, which is set during the installation process and defaults to ‘admin’. Here we will show you how to allow custom built modules to use the same route, so that you have consistent url routes in the back-end.

This is done by defining the module’s admin route as fallback of the back-end route in the module’s config.xml file:

    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <clearcache after="Mage_Adminhtml">Atwix_ClearCache</clearcache>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>

Here you must ensure that your module’s route differs from other modules in the system and when no other route is found, the request will be processed by your module.

You probably noticed the module name “Atwix_ClearCache”. This is what I would like to talk about in the second part of the article

If you have ever developed for Magento, you know that it is recommended to disable cache to be able to see changes instantly; however this slows the system down significantly.

While developing a store for our client we came up with the solution of having a menu item in the back-end top menu bar  that would quickly flush all of the caches without going to Configuration -> Cache Management and selecting invalidated relevant cache types. This is also useful on staging servers, which allows you to have cache enabled and clear when new changes are pushed for testing.

You can view this module at GitHub here or download it as zip archive

Read more:

Clients

Smart Brands Choose Us.

From Mark Cuban and Sir Richard Branson backed startups, to Inc 500 US Fastest Growing Companies and Global Brands choose us to deliver and support unparalleled e–°ommerce experience for their customers.