Questions tagged [controllers]

Denotes questions about controllers and action methods

Filter by
Sorted by
Tagged with
1
vote
1answer
27 views

Pass data to block file from ajax request

How do I pass data from the controller to my block file? Below is the code which I am using inside the controller. $this->_view->loadLayout(); $this->_view->getLayout() ...
0
votes
1answer
45 views

Ajax call not working on Magento_Wishlist

I have created a controller for products added wishlist or not, if available include class name, Controller: <?php namespace Vendor\Mymodule\Controller\Index; class Wishlist extends \Magento\...
0
votes
0answers
24 views

Magento 2 controller return 404 error

C:\xampp\htdocs\m2\app\code\Vendor\Mymodule\registration.php <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, '...
0
votes
1answer
20 views

Ajax call to Controller 404'ing

I've created a controller within my custom module to add items to my basket and i'm trying to make an ajax call across to it. However, I can't even call my controller currently as I get a 404 error ...
1
vote
1answer
94 views

How to change Wishlist button color once product added to Wishlist using controller

How to change the wishlist button color once the products added to the wishlist.I am getting an error while using a controller. Ref: 1)https://magento.stackexchange.com/a/256570/57334 2)https://...
0
votes
0answers
16 views

Magento 2 - Passing variable to controller is not working

I want to pass a selected value to a controller. After researching, it seems that I can use Ajax call to pass the value. I don't know why this is not working, but it seems the url that I use to call ...
0
votes
0answers
13 views

How to pass parameter from phtml template file to controller in Magento 2

I have created a custom module. It basically displays a popup modal that prompts user to enter their ship-to location. Below is my code: Learning\etc\module.xml <?xml version="1.0"?> &...
0
votes
0answers
15 views

Magento 2.4: How to display the filename after uploading the file via ajax?

I want to show the filename instead of uniqid(). I have the below code in my controller, how can I display the actual file name after uploading the file <?php namespace Vendor\Module\Controller\...
0
votes
0answers
23 views

Controller Issue (Magento 2)

Controller is not executing Magento\Newsletter\Controller\Subscriber\NewAction.php Below is the ajax request to call the execute method for Magento\Newsletter\Controller\Subscriber\NewAction.php but ...
1
vote
2answers
68 views

Execute method is not calling in controller Magento 2

I am facing issue with newsletter. it suppose to subscribe user in newsletter and send them email which seems not working execute method is not even calling. on direct accessing the url or using ...
1
vote
1answer
15 views

How can I implement HttpMethod (HttpMethodNameActionInterface) for ActionInterface in a controller?

This class Magento\Framework\App\Action\Action is deprecated: What is the interface to be implemented in the controller action? How should I implement the interface in the controller action? What ...
0
votes
0answers
10 views

Accessing block from controller in magento2

I'm trying to use functions in \Magento\Swatches\Block\Product\Renderer\Listing\Configurable directly from my controller. Ive created an instance like this : $swatchInstance = $this->layoutFactory-&...
0
votes
0answers
5 views

Change “Request Method” of a request (controller) Magento 1

Where the type of request "POST & GET" is defined in Magento 1 for controller requests ?
0
votes
0answers
21 views

How to submit form using other controller in Magento 2

I have a form in phtml file. There are 2 fields in that username and password. I want to set that username and password value from other controller and submit that form. I tried using this below way : ...
0
votes
0answers
7 views

Magento 1 Request Flow

I am using Magento 1.4, i can see many request's have "POST" HTTP verb in the request, Specifically "POST" should not be necessarily used for "logoutAction". Where the ...
0
votes
1answer
43 views

After making ajax query controller redirects back to product page

I’m making an ajax query from a product page (code below). If I run it directly in browser, it works but if I run it inside a code (javascript) it redirects me back to the product page with a status ...
0
votes
1answer
22 views

Uncaught Error: Call to a member function dispatch() on null

i am creating custom tab for frontend customer dashboard. it works well but after click the custom tab, the error of the title occurs. nothing comes on debug log. this error occurs before the ...
0
votes
1answer
47 views

Magento 2 - Update collection data through ajax

I have a collection inside my Block file Vendor\MyModule\Block\PostsCollectionList.php protected function postCollection() { return $this->postCollectionFactory->create() ->...
0
votes
1answer
13 views

How to get Html post request value in Controller?

I've been trying to send the SKU of the product from the product page to another page so I can integrate it with an API. Here's my code phtml code: Here's my Controller code: For some reason I can't ...
0
votes
1answer
40 views

How to override a controller using Plugin?

I want to override abstact class controller Magento\Sales\Controller\AbstractController\Reorder.php using Plugin. How can I do that? di.xml <?xml version="1.0"?> <config xmlns:xsi=&...
0
votes
0answers
40 views

How to add condition to reorder.php?

What I am trying to do: So I am trying to edit the reorder button that is in the customer's order page. Condition now: As you can see in the picture below, when one of the item in the order history is ...
0
votes
1answer
42 views

Override abstract class reorder.php controller not working

I am trying to override abstract class controller magento\module-sales\Controller\AbstractController\Reorder.php with my controller. Below are the code New custom module called ReorderButton module....
0
votes
1answer
23 views

in magento controller file there is one get function is there “$mobile -> $model ->getphone();” where is that get phone method defined

in magento custom module controller file there is one get function is there for getting a phone number "$mobile -> $model ->getphone();" where is that get phone method defined.
0
votes
1answer
27 views

Magento 2 Email template How to add Controller Path

I want to add controller path in Email template.I have create custom email template using programmatically. This is my code :- {{template config_path="design/email/header_template"}} <...
0
votes
1answer
17 views

Magento 2 admin controller is not working

Here am added a admin controller, here is my code etc/adminhtml/routes.xml <?xml version="1.0" ?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
2
votes
1answer
181 views

Magento 2 How to Create Shipment Programmatically

Here am trying to make shipment from a controller. here is my controller public function execute() { $orderId= 11; if ($orderId <= 0) { echo 'Order not found.'; ...
0
votes
1answer
23 views

How to hit controller on saving my data of Store->Configuration in Magento 2?

I have created some setting in Store->Configuration in Magento 2 i want to hit a controller if the setting is changed otherwise the i want the controller didn't hit. How would i do that ? My ...
0
votes
0answers
19 views

Send Mail controller goes to 302 in Magento 2?

I have created a custom controller and the controller which is used to send mail goes to 302 in Magento 2. So i think that's why i didn't receive any mail in my mailbox. If it is correct please tell ...
0
votes
0answers
17 views

How to send mail in Magento 2 from custom Module? [duplicate]

I have created a custom module and in phtml file i have added html and by using ajax i will call the controller file. But the issue is on using mail function it will show me an error on mail function ...
0
votes
0answers
24 views

How to execute php file from magento admin in Magento 2?

I have created a php file on root folder of magento in Magento 2 and hit a controller on that file. That process is done and i have tested it it running on terminal. How would i run that script from ...
0
votes
1answer
35 views

How to execute a controller file using shell_exec in Magento 2?

I want to create product using controller so how would i hit the controller using shell_exec. How would i do that ? My controller file is <?php namespace Mageplaza\HelloWorld\Controller\Index; ...
0
votes
0answers
18 views

How to add product weight using program in magento 2?

I have created a controller and create product from that controller hit. But on creating the product it successfully created but it doesn't show on froentend but when i manually enable that the item ...
0
votes
1answer
49 views

Magento 2 Custom Admin Sub Menu Redirects to White Blank Page!

I created a Module and I am getting this 404 page error after I hit the submenu link. Here is the code. I can not figure out what is wrong. acl.xml <?xml version="1.0"?> <!-- /** *...
1
vote
2answers
40 views

Magento 2 How to redirect to a custom block from a Controller

I have added a front phtml file followed by a Block, I need to redirect to that block from a controller. this is the Block path, it's working fine. http://mywebsite.co/schools/schoolzone_search/index/...
0
votes
1answer
199 views

In Custom table always create a new row in magento 2?

I have created a custom table and update data using model and resource model. But it always create a new row on hitting ajax how to update row as old data is appear. I think i want to use Update query ...
0
votes
2answers
44 views

Custom controller goes to 404 for custom form in Magento 2?

I have created a custom controller to show a custom form but it goes to 404 page in Magento 2 ? Controller file path : ( app/code/Company/Module/Controller/Index/Booking.php ) <?php namespace ...
0
votes
1answer
302 views

Magento 2 Interceptor generation error: during running di:compile command

Interceptor generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI ...
0
votes
2answers
60 views

How to get only disabled product in Magento 2 Controller?

How to get only disabled product In Controller I have getting all the products <?php namespace Mageplaza\HelloWorld\Controller\Index; use Magento\Catalog\Model\Product\Attribute\Source\Status; use ...
0
votes
1answer
28 views

Custom Controller goes to 404 in Magento 2?

I have created a custom controller and die on controller execute page but it goes to 404 ? COntroller file ( path : app/code/Mageplaza/HelloWorld/Controller/Index/helloworld.php ) <?php namespace ...
0
votes
1answer
26 views

Magento 2.3.5: How to get csv from the WEB directory of Module?

I want to get csv file from web folder of custom module in magento 2 so how can i do this. please help me. Thanks In Advance.
1
vote
0answers
36 views

Magento 2 add text input to massaction from dropdown

In magento 1, if I wanted to add a text input to send a custom value with my massaction to my controller, I would do something like: $this->getMassactionBlock()->addItem('add_ship_method', array(...
0
votes
1answer
45 views

Magento 2 Create Controller With No Theme?

Is it possible to create a controller with Magento 2 that doesn't have the admin menus/navbars? Essentially I want the page to return just the HTML I write and not put anything else? I considered just ...
0
votes
1answer
22 views

Missing 'return' statement in frontend Controller execute() method (IDE warning notice)

I recently use PhpStorm to write my code and it finds an error in a controller who get data from a <form> to save them in a custom model. (works fine even without correction). Class ...
1
vote
1answer
115 views

Create New Module get 404 error(How to debug code)

Hello, I have create new custom module and run frontend get 404 Page error. How to debug module what problem in code ? Please Help me. THANKS.
0
votes
1answer
126 views

Magento2.3.5: How to override \Magento\Checkout\Controller\Cart\Index Controller?

I was trying to override \Magento\Checkout\Controller\Cart\Index controller. I created a di.xml file <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
1
vote
1answer
49 views

How to get product from custom attribute in Magneto 2?

I have a Custom attribute on Product in which i have save a string i want to get count of those products which have same attribute value in Magento 2 using an Controller or Model.
0
votes
0answers
21 views

Add link and to backend modal and pass values to controller

I have a PrintButton on the backend which links me to a controller. This button should open a modal with a radioset of buttons and pass this to the controller. The xml of the backend page: <...
1
vote
0answers
76 views

How to call function in my controller in browser url which shows 'hello world' in magento 2.3.5

I am here trying to make a hello world message when trying to access my controller function using browser url demomagento.com/app/code/Icosmoz/Unicenta/Controller/Adminhtml/Home/index.php This is the ...
1
vote
2answers
250 views

How to pass Data from a UI Component Form to a Controller?

Hey I'm beginner at Magento 2, and i don't know to much about UI component... I'm creating a register form, and i want to pass Data of a UI Component Form to a Controller. So i have a Form and i got a ...
0
votes
1answer
24 views

Requesting controller action via Curl request

I am sending a CURL request to a controller action and construct() function is working(calling) but it doesn't call the execute() function of the controller. For now, I am calling the execute() ...

1
2 3 4 5
19