1

I need to Override Mage/Adminhtml/controllers/Sales/Order/CreateController.php

Step 1:- I write in etc/config.xml

<admin>
   <routers>
       <adminhtml>
           <args>
               <modules>
                   <Mycompany_Mymodule before="Mage_Adminhtml">Mycompany_Mymodule_Adminhtml</Mycompany_Mymodule>
               </modules>
           </args>
       </adminhtml>
   </routers>

Step 2:- I put CreateController.php file on this location /var/www/magento/app/code/community/Mycompany/Mymodule/controllers/Adminhtml/Sales/Order

Step 3: I did changes in controller class name

class Mycompany_Mymodule_Adminhtml_Sales_Order_CreateController extends Mage_Adminhtml_Sales_Order_CreateController
{ }

I am unable to override by this implementation. Please, Help me to override this controller.

  • did you add the file app/etc/modules/Mycompany_Mymodule.xml? – Marius Nov 25 '14 at 15:41
  • and do you get an error or just nothing happens? – David Manners Nov 25 '14 at 15:53
  • Yes, I added and it is working. – Pranav Murari Nov 25 '14 at 16:02
  • @DavidManners I am not getting any error in log file. It just nothing happens. I have checked default CreateController.php is loading. – Pranav Murari Nov 25 '14 at 16:11
  • @PranavKrMurari you controller has no code in it so it will simply call the original controller or am I missing something? – David Manners Nov 25 '14 at 16:25
1

You need to include the admin controller class you are extending off - it doesn't get auto included in controllers:

include_once("Mage/Adminhtml/controllers/Sales/Order/CreateController.php");
class Mycompany_Mymodule_Adminhtml_Sales_Order_CreateController extends Mage_Adminhtml_Sales_Order_CreateController
{ }
  • Thanks for your suggestion but still no luck. – Pranav Murari Nov 26 '14 at 9:49
  • Double check all of your syntax, my guess is something is not declared correctly or you have a typo somewhere. – Jonathan Hussey Nov 26 '14 at 10:26
  • @All Thanks for your valuable suggestion. There was class conflict. CreateController was called in another also. I have resolved my issue. – Pranav Murari Dec 1 '14 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.