How can I override the Magento controller?

I need to check the validity of the coupon code on the check / cart page with the server side code.

Magento already comes with a similar on-site check. However, I need to add it to find out if the user is connected or not: what would be the best way to expand / redefine this action in Magento?

I know that I can copy the PHP controller file to the folder tree /app/code/local/ , but I'm wondering if there is a better way to do this.

+6
source share
1 answer

Everything except the core change, in my opinion. With this in mind, create a simple module with a directory of controllers, etc. With config.xml:

 <config> <frontend> <routers> <checkout> <args> <modules> <My_Module before="Mage_Checkout">My_Module_Checkout</My_Module> </modules> </args> </checkout> </routers> </frontend> </config> 

For more information on how to expand an external controller, see here: http://prattski.com/2010/06/24/magento-overriding-core-files-blocks-models-resources-controllers/

+11
source

Source: https://habr.com/ru/post/890692/


All Articles