1

I've added some functionality to the Amasty_Xcoupon module, but after upgrading from v1.0.6 to 1.1.6, the codepool of the module changed from community to local. This somehow results in my controller not working anymore (404 page).

Note: I've updated the classnames and everything else works great. Also, I know there have been similar questions posted here, but the solutions mentioned there didn't work for me (or I messed up a bit more).

Here is the original rewritten controller (which worked when the module was in community codepool):

// src/app/code/local/My/Extension/controllers/Adminhtml/ReportController.php
class My_Extension_Adminhtml_ReportController extends Amasty_Xcoupon_Adminhtml_ReportController
{
    // code here
}

The older file was located in src/app/code/community/Amasty/Xcoupon/controllers/Adminhtml/ReportController.php, the newer is located in src/app/code/local/Amasty/Xcoupon/controllers/Adminhtml/Amxcoupon/ReportController.php.

This is the updated controller:

class My_Extension_Adminhtml_ReportController extends Amasty_Xcoupon_Adminhtml_Amxcoupon_ReportController
{
    // code here
}

The config.xml looks like this:

<config>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <My_Extension before="Mage_Adminhtml">My_Extension_Adminhtml</My_Extension>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

This worked with the previous version, but now in the new version when execute the function I go to a nice looking 404 page, so my controller is no longer found.

I've tried using require_once to get the original controller, but no success. Also tried to change the config to this:

<config>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <My_Extension before="Amasty_Xcoupon">My_Extension_Adminhtml</My_Extension>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

As well as adding the previously non-existing Amxcoupon directory in the controllers/Adminhtml directory and adding that to the config, but nothing works.

Does anyone know what I'm doing wrong here? Many thanks to whoever finds the error(s) of my ways.

  • 1
    Have you tried adding dependency in your custom module, in your app/etc/modules/My_Extension.xml file? – Jaimin Sutariya Jan 20 '17 at 11:35
0

After some more trial and error, I've found a way that worked.

First I did have to add the depencdency to my modules, like so:

<config>     
    <modules>
        <My_Extension>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Amasty_Xcoupon/>
            </depends>
        </My_Extension>
    </modules>
</config>

I also replaced the My/Extension/controller/Adminhtml/ReportController.php to My/Extension/Adminhtml/Amasty/Amxcoupon/ReportController.php to match the new file structure of the module.

Lastsly I needed to change the router rewrite, like so:

<config>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <My_Extension before="Amasty_Xcoupon_Adminhtml">My_Extension_Adminhtml_Amasty</My_Extension>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

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.