When you use magento sometime need to customize some admin core functionality based on requirement. If you want to change core functionality of any controller so you need to override controller action with your controller action. Learning how to perform this action may be
helpful to those who have computer forensics degrees.
how to override magento admin controller action
This example to show you override edit action from ProductController.php is located app/code/core/Mage/Adminhtml/controllers/Catalog
Step 1: Create new module from app/etc/Justwebdevelopment_Overridecontroller.xml
<?xml version="1.0"?> <config> <modules> <Justwebdevelopment_Overridecontroller> <active>true</active> <codePool>local</codePool> </Justwebdevelopment_Overridecontroller> </modules> </config>
Step 2: Make config.xml from app/code/local/Justwebdevelopment/Overridecontroller/etc/config.xml
<?xml version="1.0"?> <config> <modules> <Justwebdevelopment_Overridecontroller> <version>0.0.1</version> </Justwebdevelopment_Overridecontroller> </modules> <admin> <routers> <adminhtml> <args> <modules> <Justwebdevelopment_Overridecontroller before="Mage_Adminhtml">Justwebdevelopment_Overridecontroller</Justwebdevelopment_Overridecontroller> </modules> </args> </adminhtml> </routers> </admin> </config>
Using above code you want to override any action from any adminhtml controller. Only you need to make controller file for that.
Here I want to give example of ProductController.php file.
Step 3: Make controller file from app/code/local/Justwebdevelopment/Overridecontroller/controllers/Catalog/ProductController.php
And first include your default controller calss file then write new controller class for update then extends your new controller file to your default controller class like here extends with “Mage_Adminhtml_Catalog_ProductController”. After the define those action whcih you want to override.
<?php include_once("Mage/Adminhtml/controllers/Catalog/ProductController.php"); class Justwebdevelopment_Overridecontroller_Catalog_ProductController extends Mage_Adminhtml_Catalog_ProductController { public function editAction(){ echo "Override Product Edit Action...";exit; } } ?>
If you follow all three steps above then when you try to edit any products from backend then it shows this message “Override Product Edit Action…”. Please be careful with module name and controller name.
Hopefully this information is helpful to override magento adminhtml controllers.
Magento Development | PSD To Magento | Magento Theme Development | Magento Development Services
Magento developers many times get confused for designing a website in a unique way. After visiting this article, one can easily get the overview of designing a particular Ecommerce website. As the matter of fact, various platforms require different kinds of designs for better engagement of a product. So after visiting here, one can easily get the best overview of designing a website.
Thanks for finally talking about > Top 10 Magento 2 Extensions – Justwebdevelopment < Liked it!
Heya! I just wanted to ask if you ever have any problems with hackers?
My last blog (wordpress) was hacked and I ended up losing many months of hard
work due to no data backup. Do you have any solutions to
stop hackers?
Hello! I know this is kinda off topic but I was wondering which blog platform are you using
for this website? I’m getting fed up of WordPress because I’ve had issues with hackers and I’m looking at options for another platform.
I would be awesome if you could point me in the direction of a good platform.