I am kinda in a pickle at the moment kinda tearing my head off. I am trying to override a controller method in the backend admin of Magento to allow some additional functionality. Here is the url path I am trying to apply my override.
<Magento root path>/index.php/admin/iBanners_banner/edit/id/2/key/4c9796d89ba5e8847e4ce8c893cd6901/
Here is the admin fragment router xml for the original plugin that is present in their config.xml file.
<admin>
<routers>
<adminhtml>
<args>
<modules>
<ibanners before="Mage_Adminhtml">Fishpig_iBanners_Adminhtml</ibanners>
</modules>
</args>
</adminhtml>
</routers>
</admin>
Here is my controller class with the appropriate edit method that I need to override. This file is located in the following directory structure: app/code/local/Leafcutter/Ibanners/controllers/Adminhtml/Ibanners/BannerController.php
<?php
require_once("Fishpig/IBanners/controllers/Adminhtml/IBanners/BannerController.php");
class Leafcutter_iBanners_Adminhtml_iBanners_BannerController extends Fishpig_iBanners_Adminhtml_iBanners_BannerController
{
public function _construct(){
Mage::log('Using Leafcutter Extension');
parent::_construct();
}
public function editAction()
{
die('Leafcurtter has been returned');
}
}
As you would expect if you go to this edit url, my modified edit function should die with a message.
I also apply the what I thought were the appropriate bits of code for the admin fragment router xml in my extension's config.xml file. Now when I refresh the page or I log out and log back into to the backend. My extension's controller does not override the original controller and the original controller loads as if my version did not exist at all.
The following 2 fragments were sample of what I have attempted to override the original extension's controller both did not work but are an example of all of the unsuccessful attempts at getting this to work.
<admin>
<routers>
<adminhtml>
<args>
<modules>
<ibanners before="Mage_Adminhtml">Leafcutter_iBanners_Adminhtml</ibanners>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<admin>
<routers>
<ibanners>
<args>
<modules>
<Leafcutter_iBanners before="Fishpig_iBanners">Leafcutter_iBanners_Adminhtml</Leafcutter_iBanners>
</modules>
</args>
</ibanners>
</routers>
</admin>
Unless if strictly it is impossible to override an extension's backend controller at all and my solution was flawed from the start, if someone can help me especially looking at my admin router code in my config xml then that would be great. Because I don't want to apply a hack to the original extension, which I may have to do if presented with absolutely no choice. Thanks in advance.