Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't seem to override Checkout Controller in Magento

Tags:

magento

I am trying to make some changes to the Checkout controller in my Magento store, however, when I try to put the controller file into my local directory it does not seem to be respecting the local file for this.

I have checked that the files are in the same spot in their respective code pools and the files are named the same thing, it just will not do it.

  • /app/code/core/Mage/Checkout/controllers|CartController.php
  • /app/code/local/Mage/Checkout/controllers|CartController.php

Those are the file paths for the two files I have.

Is there something special about the checkout files in Magento that prevent them from being overridden?

like image 867
Josh Pennington Avatar asked Aug 18 '11 15:08

Josh Pennington


2 Answers

FYI, controller overriding doesn't work just by placing the related file in local folder with the same folder structure. Rather you need to follow the following syntax for the purpose:

<config>
    <frontend> [1]
        <routers>
            <checkout> [2]
                <args>
                    <modules>
                        <yourModule before="Mage_Checkout">Namespace_Module_Overwrite_Checkout</yourModule> [3]
                    </modules>
                </args>
            </checkout>
        </routers>
    </frontend>
</config>
[1] Depending on the controllers area ,"frontend" or "admin"
[2] Router node of the module to be overridden (look it up in the config.xml of that module)
[3] The tag  can be anything, it must be unique within the  node.
Your_Module_Overwrite_Checkout (is mapped to directory)
Your/Module/controllers/Overwrite/Checkout/

Hope this helps.
Regards
MagePsycho
like image 176
MagePsycho Avatar answered Nov 13 '22 12:11

MagePsycho


Read the Magento Wiki by lichal for a working and complete solution: https://wiki.magento.com/display/m1wiki/How+To+Overload+a+Controller

like image 27
Peter Aba Avatar answered Nov 13 '22 12:11

Peter Aba