2

I am trying to override adminhtml_sales_order_create controller. I have created a small module app/code/local/Akina/Sales/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Akina_Sales>
            <version>0.1</version>
        </Akina_Sales>
    </modules>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <sales before="Mage_Adminhtml">Akina_Sales_Adminhtml</sales> 
                    </modules>
               </args>
            </adminhtml>
        </routers>
    </admin>
</config>

and created controller file as

app/code/local/Akina/Sales/controllers/Adminhtml/Sales/order/CreateorderController.php

<?php
require_once 'Mage/Adminhtml/controllers/Sales/Order/CreateController.php';
class Akina_Sales_Adminhtml_sales_Order_CreateorderController extends Mage_Adminhtml_Sales_Order_CreateController
{
    public function saveAction()
    {
        echo "test";die;
    }
}

My module declaration file

<?xml version="1.0"?>
<config>
    <modules>
        <Akina_Sales>
            <active>true</active>
            <codePool>local</codePool>
        </Akina_Sales>
    </modules>
</config>

I am unable to override this controller, where did I go wrong?

3 Answers 3

0

you need to add this in the module declaration file

<depends>
    <Mage_Adminhtml />
</depends>

right below <codePool>local</codePool>.

place your new controller in app/code/local/Akina/Sales/controllers/Adminhtml/Sales/Order/CreateController.php
and name the controller class Akina_Sales_Adminhtml_Sales_Order_CreateController.
be careful at uppercase letters.

1
  • ' Not working ' Commented Jan 10, 2017 at 11:23
0

Along with the Marius answer

In your config.xml change

<adminhtml>
     <args>
       <modules>
          <sales before="Mage_Adminhtml">Akina_Sales_Adminhtml</sales> 
       </modules>
    </args>
</adminhtml>

To

<adminhtml>
     <args>
       <modules>
          <Akina_Sales_Adminhtml before="Mage_Adminhtml">Akina_Sales_Adminhtml</Akina_Sales_Adminhtml> 
       </modules>
    </args>
</adminhtml>
1
  • I have already done change but is not working Commented Jan 10, 2017 at 11:25
0

Please try

<adminhtml>
     <args>
       <modules>
          <Akina_Sales before="Mage_Adminhtml">Akina_Sales_Adminhtml</Akina_Sales> 
       </modules>
    </args>
</adminhtml>

Instead of

<adminhtml>
     <args>
       <modules>
          <sales before="Mage_Adminhtml">Akina_Sales_Adminhtml</sales> 
       </modules>
    </args>
</adminhtml>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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