What can I add to the config.xml file to override the linkAction in Downloadable (Magento controller)?

I am trying to override the linkAction method so that I can load downloadable content in S3, etc.

+2


source to share


1 answer


This has been made much easier in the Magento 1.3 branch. All you have to do is add

<frontend>
    <routers>
       <downloadable>
         <args>
           <modules>
             <modulename before="Mage_Downloadable">Yourpackagename_Yourmodulename</modulename>
           </modules>
         </args>
       </downloadable>
    </routers>
</frontend>

      

The <loadable> tag must match the <routers> tag in the module you are trying to override. Mage_Downloadable

is the class prefix. Yourpackagename_Yourmodulename

is the class prefix of your module.

With this in place, Magento will first check your module controllers for compliance.



app/code/local/Packagename/Modulename/controllers/DownloadController.php

      

If no matching action is found, it will revert to the original. Be sure to check out my article Magento Controller Dispatch Logging to help debug routing issues.

What's amazing about this approach (as opposed to the rewrite approach ), you

  • No need to manually query the old controller file in the controller

  • You don't need to specify new layout rules. Magento seems to magically support layouts as they were

+3


source







All Articles