Questions tagged [admin-controller]

Denotes questions related to Admin Area's Controller. A controller is a part of Model-View-Controller Architecture.

Filter by
Sorted by
Tagged with
19
votes
6answers
16k views

Magento 2 Custom Admin Action Redirected to Dashboard

I am taking the Magento 2 fundamentals development course and the Admin Router / Controller exercise seems out of date. The router does work, but the controller does not, it always just re-routes to ...
12
votes
2answers
599 views

Public actions in admin controllers

I've discovered that in the class \Magento\Backend\App\AbstractAction (the ancestor of every admin controller action) there is a member called _publicActions that is used in the validation of the ...
11
votes
3answers
6k views

how to save custom field in custom database table while editing product from back-end?

I have created a custom module to display custom tab on product form in back-end. I used this solution. Now on tab i am adding custom fields to save in custom database table. say <input type="...
6
votes
3answers
3k views

What is the purpose of isAllowed method and when It is called in Magento 2?

I have seen that below method. protected function _isAllowed() { return $this->_authorization->isAllowed('Custom_Module::moduleslider_banners'); } What exactly it will do? Will it check ...
5
votes
1answer
356 views

Magento 1: adminhtml controller rewrite and module dependencies

Explanation So I have a module, I'll call it Hello_World with the following code in config.xml <admin> <routers> <adminhtml> <args> &...
5
votes
1answer
6k views

get Admin controller URL in magento 2

Here is my Directory structure of controller file in Magento 2 - app/code/Namespace/Modulename/Controller/Adminhtml/Blacklist/Index.php In Index.php i write the below code - namespace Mynamespace\...
5
votes
1answer
3k views

Is it necessary to override _isAllowed in your Admin controller?

The _isAllowed method is where you, as a Admin Panel programmer, should place your ACL checks. As you can see, by default, this method returns true. That means if you don’t define your own ...
5
votes
4answers
4k views

Magento 2 - Backend custom module 404 error

I'm trying to create my custom module in the back-end, I followed a lot of tutorials, but I continue to get 404 error when I try to access to my controller. The only thing that work fine is the menu ...
4
votes
1answer
1k views

Magento 2: How to submit custom html content from ui_form to controller?

I am developing a module using ui_form. I have developed ui_form and on submit it post all fields except custom html fields. For example: <container name="pl_labelposition" > <...
4
votes
2answers
1k views

I created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error? [duplicate]

Recoverable Error: Argument 1 passed to Webkul\Grid\Controller\Adminhtml\Grid\Index::__construct() must be an instance of Magento\Backend\App\Action\Context, instance of Magento\Framework\...
4
votes
2answers
661 views

How to add common logic to all module controller actions?

I have module with license based.I have to check license is valid or not in my all controllers. Now Actually i'm placing my logic in each action. Is there any better way to check logic & ...
4
votes
1answer
1k views

Magento 1: how to properly redirect from an admin controller observer?

Ok, so I want to do some validations when submitting the mass update product attributes. I've setup an observer like this: <adminhtml> <events> <...
4
votes
2answers
1k views

Magento 225 :Notice: Array to string conversion

When I try to create a new record in my custom module I get the below mentioned error Something went wrong while saving the item.Notice: Array to string conversion in /opt/lampp/htdocs/...
4
votes
1answer
2k views

Magento 2: add admin page content title in layout xml?

I noticed that you can set the page title in the layout xml per how to modify page title. but it's not working in the admin - if I want to change the admin page title, in the Controller, this works: ...
4
votes
0answers
40 views

System stuck on a controller on live instance does not return any thing nor redirect

I am duplicating the category tree with products works fine on my system while checking on live instance. scenario Duplicate category and subcategory but not products works fine. Duplicate category ...
4
votes
1answer
1k views

Magento 2 Blank Layout Page

I tried to create a new tab in customer edit backend. First i create the app/code/Namespace/Point/view/adminhtml/layout/customer_index_edit.xml <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
4
votes
1answer
73 views

Add order status while placing order from admin Magento 1

I want to add a custom dropdown for the order status in the create an order page from admin. Admin can choose the order status while placing the order. Please see attached screenshot!!! Or Can i set ...
4
votes
1answer
2k views

Ajax not working in Magento 2 admin

I'm using ajax in Magento 2 admin. But it not working. My controller: class CustomAjax extends \Magento\Backend\App\Action{ protected $resultJsonFactory; public function __construct( \Magento\...
3
votes
5answers
3k views

“Visible Section not found” at backend login in Magento 2

When I switch the store to a specific domain https:// example.com (secure & unsecure), I get the error "Visible Section not found" when trying to log into the backend. The funny thing: as soon ...
3
votes
1answer
1k views

Magento 2 admin form controller error

So i have a controller to access form with structure like this: Controller>Adminhtml>Preferences>NewAction.php but when i try to acces /preferences/new, it gives me an error like this: Fatal ...
3
votes
2answers
237 views

How can I point admin action method to other than `indexAction()`?

In my module, I am setting up my menu like this. <menu> <catalog> <children> <rkt_arattr translate="title" module="rkt_arattr"> <...
3
votes
2answers
2k views

Magento - include multiple external libraries to Admin Controller actions

I am working on import price of products using xls, xlsx, ods and csv files. For that i need to read these file, i had use seperate external library files to read those files. It works well in my ...
3
votes
2answers
341 views

predispatch on a adminthml controller

I am using magento 1.7. I would like to have a event before the call of this method Mage_Adminhtml_Sales_Order_CreateController save. I tried to do it like this : Config.xml : <adminhtml> ...
3
votes
5answers
8k views

Magento 2 custom Admin controller redirect to Dashboard

I am trying to add a new Admin Menu in Magento 2 for first time. I followed these tutorials: https://www.mageplaza.com/magento-2-module-development/create-admin-menu-magento-2.html https://www....
3
votes
4answers
6k views

How to send ADMIN AJAX request?

I need to retrieve some information from my custom admin controller using AJAX. But when AJAX is used I get current page's entire HTML ! I simply want to get some JSON data from my custom ...
3
votes
1answer
222 views

Magento Adminhtml Controller looking for the wrong URL

So I'm trying to make an Admin menu for a module I'm developing. The menu itself displays fine but when I click on it I get a 404 page. This is my code: Jiri/Servicepunten/etc/config.xml <...
3
votes
1answer
399 views

How can I make my controller return JSON back to my template PHTML

Controller: <?php namespace MyCompany\ExampleAdminNewPage\Controller\Adminhtml\Product; use Magento\Framework\App\Action\Context; use Magento\Framework\Controller\ResultFactory; class Product ...
3
votes
0answers
52 views

Extension works fine on local system but on live instance it gives me error

Can someone please give me some detail about my issue. I am duplicating categories along with the product on my local system it works fine although it takes little more time but works fine on my live ...
3
votes
2answers
266 views

Controller function not working after overwrite afterExecute : M2

Di.xml <type name="Magento\Catalog\Controller\Adminhtml\Category\Save"> <plugin name="mymodule" type="Module\Name\Plugin\Controller\Adminhtml\Category\Save"/> </type> ...
2
votes
2answers
4k views

How to create menu and it's controller in magento 2

I want to add my custom menu in admin and also want to add related controller for that. So how can I do that?
2
votes
3answers
248 views

Magento 2: How to get current category id in admin controller

I have made a custom button on category edit page in admin. The button redirects to custom admin controller. I need to fetch the current category id in the controller.
2
votes
2answers
3k views

Magento 2 - Got Error in Adminhtml Controller

I am trying to create custom module in magento2. I got below error while click on the menu in admin. it seems my admin controller not configured properly. Can anyone help me in this issue. Fatal ...
2
votes
2answers
99 views

Grid with multiple Resource Models

I'm trying to use one grid for multiple ResourceModels, so far I've got one grid working fine. I can load the grid up fine using http:{}/admin/grid/grid/ However when i create a new route to load ...
2
votes
2answers
1k views

Fatal error: Uncaught Error: Call to a member function isLoggedIn() on null in

di.xml <preference for="Magento\Catalog\Controller\Adminhtml\Category\Save" type="Modulename\Complexgrd\Controller\Adminhtml\Category\Save" /> Save.php <?php namespace Modulename\...
2
votes
1answer
559 views

Magento2 make simple afterSave action plugin of custom module

I am trying to create afterSave plugin for my admin form save action controller of my custom module. The purpose of this is to save some data into second table once all data completely save in first ...
2
votes
1answer
427 views

Module action returns 404

I am making a module that adds a button to the Admin order view and allows the user to create a shipment and invoice (among others) once this button is clicked. I have used an observer to add the ...
2
votes
1answer
751 views

Display Block on Custom Admin Page

This should be a fairly easy one, I hope. I've looked over Alan Storm's tutorial on the topic a hundred times, but still can't figure out what I'm missing. I just want to get my custom admin page to ...
2
votes
1answer
75 views

Overwrite admin controller in version 1.6

I am trying to overwrite the controller located at: app/core/code/Mage/Adminhtml/controllers/Catalog/ProductController.php First of all I tried just making a copy in my local code directory app/local/...
2
votes
0answers
162 views

Magento 2 - How to pass parameter from menu.xml

Is there any way to pass a parameter to controller from menu.xml file? Actual URL : http://127.0.0.1/mg231/admin/vendor/module/index/key/...
2
votes
1answer
1k views

Magento 2 | Add Admin Configuration Button Action

I need to call a method from an admin configuration button. This is my simple custom module. The button appear on admin but notthing appen on click. No log is write. I cannot understand what I am ...
2
votes
0answers
471 views

Magento 2 adminhtml layout.xml not loading

The Controller File works fine, die('dasdsa') works. But i am not getting any result on the Backend Page except the Title Change within the Controller. I Guess it's just something simple :X Classy/...
2
votes
0answers
354 views

I want to upload image in each static block of magento

I have not much expertise in magento so please pardon me if i am doing pretty much wrong. I am using Magento ver. 1.9.3.2 I want to add a new image field in magento static block. I want to use this ...
2
votes
2answers
1k views

Dynamic hide form fields for different action

I have 2 action in IndexController: newAction() and editAction(). Both those actions will use a same form (about 5 inputs: First Name, Last Name, Email, Status, Example) But in the newAction(), I ...
2
votes
2answers
1k views

Error While Compiling Magento 2 admin page module

I'm getting error while compiling the Magento 2 admin module. The error which I'm getting is Fatal error: Class Tutorial\SimpleNews\Controller\Adminhtml\News contains 1 abstract method and must ...
1
vote
2answers
9k views

Magento 2: how to redirect from an admin controller

In Magento 1, we were able to do the following directly in a controller action method : $this->_redirect('*/*/index'); Or in a more generic way: $this->_redirect('adminhtml/controller/action')...
1
vote
2answers
1k views

Get frontName of admin from app/etc/local.xml

<admin> <routers> <adminhtml> <args> <frontName><![CDATA[admin]]></frontName> </...
1
vote
2answers
4k views

magento 2 redirect url with parameters from controller

I am trying to redirect to a different controller from one controller . I also want to set an Url parameter along with the redirect. But this is throwing me an error Uncaught Error: Call to ...
1
vote
2answers
5k views

Magento2 custom admin controller always redirects to the admin index page

I've created custom extension in the admin panel under the menu of products. The problem is that I can't get the controller working. Code as fallows: in etc/adminhtml/menu.xml: <config xmlns:xsi="...
1
vote
2answers
104 views

About Admin Side I have a template file in which I have a form submission

In the admin side, I have a template file in which I have a form submission. On form submission, an action would be executed, but it is redirecting to dashboard. can anyone have any idea, how to ...
1
vote
3answers
2k views

Magento2 : admin controller not working

i created a button in the order/view page in magento2 backend, and would like to call a controller when button in clicked. In my module, I added : etc/adminhtml/routes.xml <?xml version="1.0" ?&...