1

This is my xml:

    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <mynamespace_mymodule before="Mage_Adminhtml">Mynamespace_Mymodule_Adminhtml</mynamespace_mymodule>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>

and this is my controller:

require_once 'Mage/Adminhtml/Sales/Order/controllers/CreateController.php';

class Mynamespace_Mymodule_Adminhtml_CreateController extends Mage_Adminhtml_Sales_Order_CreateController
{
    public function loadBlockAction(){
        echo 1; exit();
    }
}

I didn't get the echo 1 . What did I do wrong ? thx

1

replace <mynamespace_mymodule> before="Mage_Adminhtml"> with <mynamespace_mymodule before="Mage_Adminhtml">

<admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <mynamespace_mymodule before="Mage_Adminhtml">Mynamespace_Mymodule_Adminhtml</mynamespace_mymodule>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>

also your directory structure is must be same after adminhtml folder Sales/Orders/CreateController.php

require_once Mage::getModuleDir('controllers', 'Mage_Adminhtml') . DS . 'Sales' . DS . 'Orders' . DS . 'CreateController.ph‌​p';

class Mynamespace_Mymodule_Adminhtml_Sales_Order_CreateController extends Mage_Adminhtml_Sales_Order_CreateController
{
    public function loadBlockAction(){
        echo 1; exit();
    }
}
10
  • Thx, but now I got this error message: Fatal error: require_once(): Failed opening required 'Mage/Adminhtml/Sales/Order/controllers/CreateController.php' – Attila Naghi Feb 2 '17 at 11:49
  • @Chester updated the code require_once 'Mage/Adminhtml/controllers/Sales/Orders/CreateController.php'; check that – Qaisar Satti Feb 2 '17 at 11:50
  • 1
    I believed I should use Mage::getModuleDir , but i don't know how for require_once – Attila Naghi Feb 2 '17 at 11:55
  • 1
    @Chester require_once Mage::getModuleDir('controllers', 'Mage_Adminhtml') . DS . 'Sales' . DS . 'Orders' . DS . 'CreateController.ph‌​p' is the syntax you are looking for. – Matthéo Geoffray Feb 2 '17 at 12:08
  • 1
    require_once Mage::getModuleDir('controllers', 'Mage_Adminhtml').DS.'Sales'. DS .'Order'. DS .'CreateController.php'; this works:D thx a lot !!! – Attila Naghi Feb 2 '17 at 12:13

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.