How to create custom router, as many of us use the standard router? You should know that Magento has four types of the routers: admin, standard, cms and default – they are loading in the order we’ve described. But, have you ever faced with such configuration?
Now, let’s start creating own router. First of all, we need to declare router in config.xml:
- class Atwix_Test_Controller_Router extends Mage_Core_Controller_Varien_Router_Standard
- public function match(Zend_Controller_Request_Http $request)
- return true;
The previous code explains Magento that it should transmit control to the indexAction function which is placed in app/code/local/Atwix/Test/controllers/IndexController.php., and your router will be called after admin and standard, but if these routers do not respond for the requests – then your router will be called.
So, now you can check request, proceed it and show page you want before Magento will throw “Not found” page. Hope that simple tutorial will be useful.
Magento Tutorial by Atwix
Here is the library of Magento Download for FREE (all versions)
Your Magento website needs a powerful Magento ERP for stock control.
DON'T MISS THE CHANCE!