3

I'm trying to override ProfileController located in

app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php

I created a new module to handle that as following :

app/etc/modules/FifoBox_ProductApproval.xml

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

app/code/local/FifoBox/ProductApproval/etc/config.xml

<config>
    <modules>
        <FifoBox_ProductApproval>
            <version>1.0.0</version>
        </FifoBox_ProductApproval>
    </modules>
    <global> 
         ....
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <fifoBox_productapproval before="Mage_Adminhtml">FifoBox_ProductApproval_Adminhtml</fifoBox_productapproval>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

And My main class (controller) located in :

app/code/local/FifoBox/ProductApproval/controllers/Adminhtml/System/Convert/ProfileController.php

<?php require_once Mage::getModuleDir('controllers', 'Mage_Adminhtml') . DS . 'System' . DS . 'Convert' . DS . 'ProfileController.php';

class FifoBox_ProductApproval_Adminhtml_System_Convert_ProfileController extends Mage_Adminhtml_System_Convert_ProfileController {

    public function batchRunAction() {

        die('Overriden');
    }

} ?>

But Magento still call overriding (Original) method (i.e can't access my new class), even I tried to put the new controller file in app/local/Mage/Adminhtml/controllers/System/Convert/ProfileController.php to avoid any xml config error but I got the same result, I cleared catch checked all logs even Apache ones with nothing

The only way I got my new code work is to modify the core file itself

Please help

1 Answer 1

2

Overriding controllers in app/code/local does not work, because controllers are not loaded with the Magento autoloader.

But I guess the reason that your controller is not used, is that there is a controller Mage_Adminhtml_System_Convert_GuiController that extends Mage_Adminhtml_System_Convert_ProfileController and the actual route is adminhtml/system_convert_gui/batchRun and not adminhtml/system_convert_profile/batchRun.

Try to add a class FifoBox_ProductApproval_Adminhtml_System_Convert_GuiController and see if this is used.

Your Answer

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

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