"Override Admin Controller" in magento 1.6
In Manageto, you can override admin blocks and models by just creating a copy of core files into local folder and easily override magento core functionality. But you cannot follow this way to override admin controllers. Let's take a look how to override admin controller in magento.
In our example, we are overriding Mage_Adminhtml_Permissions_UserController. To override admin controller create following files at specified location.
- /app/etc/modules/Placement_MyModule.xml
- /app/code/local/Placement/MyModule/etc/config.xml
- /app/code/local/Placement/MyModule/controllers/Permissions/UserController.php
Step 1 - Create /app/etc/modules/Placement_MyModule.xml
<?xml version="1.0"?> <config> <modules> <Placement_MyModule> <active>true</active> <codePool>local</codePool> </Placement_MyModule> </modules> </config>
Step 2 - Create /app/code/local/Placement/MyModule/etc/config.xml
<?xml version="1.0"?> <config> <modules> <Placement_MyModule> <version>1.0.0</version> </Placement_MyModule> </modules> <global> <rewrite> <Placement_MyModule_permissions_user> <from><![CDATA[#^/admin/permissions_user/#]]></from> <to>/placement_mymodule/permissions_user/</to> </Placement_MyModule_permissions_user> </rewrite> </global> <admin> <routers> <placement_mymodule> <use>admin</use> <args> <module>Placement_MyModule</module> <frontName>placement_mymodule</frontName> </args> </placement_mymodule> </routers> </admin> </config>
Step 3 - Create /app/code/local/Placement/MyModule/controllers/Permissions/UserController.php
# Controllers file will not auto included so we have to do it manually require_once 'Mage/Adminhtml/controllers/Permissions/UserController.php'; class Placement_MyModule_Permissions_UserController extends Mage_Adminhtml_Permissions_UserController { public function saveAction() { // Your code for Save Action } }
Created At: 22 November, 2024
Views: 12,887
Social Sharing
Search
Articles
Recently Added Jobs
Rajasthan High Court - Jodhpur Recruitment 2017 for Civil Judges
Last Date: 21 December, 2017
Last Date: 21 December, 2017
WBSEDCL Recruitment - 2017 for Office Executive
Last Date: 16 May, 2017
Last Date: 16 May, 2017
RECRUITMENT OF PROBATIONARY OFFICERS IN STATE BANK OF INDIA
Last Date: 06 March, 2017
Last Date: 06 March, 2017
UPSC Combined Medical Services Examination 2015
Last Date: 10 April, 2015
Last Date: 10 April, 2015
UPSC Engineering Services Examination 2015
Last Date: 10 April, 2015
Last Date: 10 April, 2015