Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [controllers]

Denotes questions about controllers and action methods

Filter by
Sorted by
Tagged with
0
votes
1answer
40 views

How to override product attribute Save.php controller using modulein magento 2?

I am trying to create a module in which I am facing some issues to override Save.php Controller as well as save that data in the new table. here is my updated di.xml code, but now after click on save,...
0
votes
0answers
16 views

Magento 2 Programmatically adding a ViewModel to a Block when Creating it

I have hit a problem when trying to create a block in a controller in so much as I need the block created in the controller to also create a ViewModel type object. What I am trying to achieve but I ...
0
votes
0answers
13 views

Magento 2 get Controller data in the same page it was sent

I got help to accomplish send data from Controller to a Block, and then display the info from Block in a template. The thing is that I want to send a form and display the data from that form in the ...
0
votes
0answers
7 views

how to possible magento 2 payment card information pass to custom controller

how to pass this card information to another controller in magento 2
0
votes
0answers
24 views

Magento 2 Return Controller data in the same page

I got help to accomplish send data from Controller to a Block, and then display the info from Block in a template. The thing is that I want to send a form and display the data from that form in the ...
0
votes
1answer
53 views

Magento 2 - Call Ajax controller on click of place order?

I've set up the JS, and controller and checkout.html I need to call the controller with ajax to getPrice() method. My controller name is GetAjax.php and here is the controller code. <?php ...
0
votes
1answer
43 views

Magento 2 pass data from Controller to Block and display in Template

I'm a little bit stuck. I want to send a form and display it in a phtml. Here is my code: 1. Controller Search.php <?php namespace Vendor\SearchStores\Controller\Index; use Magento\Framework\...
2
votes
1answer
59 views

Magento 2.3 - How to pass array from controller to template

I am working on a custom module. I am getting array of attribute values in my custom controller and I want to pass these values in my template to list in a select dropdown. Please provide a solution - ...
0
votes
1answer
21 views

Why is the name “Model” in a controller action not allowed?

I created a new controller action called "AddEmailToCustomerModel" But I got an exception after trying to call the route: Exception #0 (Magento\Framework\Exception\RuntimeException): Type Error ...
0
votes
1answer
26 views

redirect to controller from script file with param in Magento2

I have created a script file in root folder of the magento as like below <?php error_reporting(E_ALL); use \Magento\Framework\App\Bootstrap; require __DIR__ . '../../app/bootstrap.php'; $bootstrap ...
0
votes
2answers
20 views

Magento 2 : Check log in customer email id while applying coupon code on cart

I want to check customer's email id when he is applying coupon code on cart page. If customer email is valid for that coupon then coupon code will be apply otherwise display an error. For this, i ...
0
votes
2answers
52 views

How to override the category controller in Magento 2.3?

How to override the category controller in Magento 2.3? Please give me any solution?
0
votes
2answers
52 views

Magento 2 : Can't able to override controller

I need to override this below controller : Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate.php But, I can't able to override. I need to customize checkUniqueOption() function. di....
0
votes
1answer
19 views

How to set GrandTotal in the magento 2.3 via controller?

Kindly give me an example about how to set GrandTotal via the controller in magento 2.3. I am new to Magento.
0
votes
3answers
49 views

How to get product collection in controller in Magento2

I am creating a new module in magento2 and in controller file, I try to get product collection in controller index.php file so how can I get product collection in Magento 2. so give me suggestion to ...
0
votes
1answer
19 views

magento 2 get first level category from current catgeory ID in controller

I am trying to get first level category from current category ID in my controller . For example- I have Maincategory SubCategory1 SubCategory2 SubChild1 SubChild2. ...
2
votes
1answer
48 views

How to execute custom controller action for product in magento2?

I would like to write some custom code product actions in a controller is executed. When I have click on the product than showing multiple brands and after that click on brand then show product ...
1
vote
1answer
41 views

Magento2 : How To Solve Controller 404 Not Found Error On Live Server

I have create one controller and it is working fine in local environment but when i upload that files to live server is shows 404 not found error, These are my code, please let me know if anyone have ...
0
votes
1answer
34 views

Magento 2: Call Controller method from Model

How to call the controller method from model? Or How to programmatically reindexing using API? Here is my code.Below code gives me error like below. { "messages": { "error": [ ...
2
votes
4answers
64 views

Magento 2: Call to a member function setState() on array

I want to change the order Status programmatically but when I run the function realTest() as I mentioned below then it gives me an error Call to a member function setState() on array in the below ...
0
votes
3answers
54 views

How can I change the Order Status in Controller. Magento 2

I'm trying to change the specific order Order Status. for that I tried. <?php namespace Vendor\Module\Controller\Index; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\...
0
votes
2answers
76 views

Magento 2 how to get all categories of a product in controller

I am trying to get all categories with their levels of a product through it's ID in my controller which is overriding default magento controller. Can I get product's category path url through it's id ...
1
vote
2answers
105 views

Magento 2.3: Call to undefined method Magento\Framework\View\Result\Page\Interceptor::setPath()

I want to configure Nextopia Extension, i installed it properly after that when i go to this URL http://mysite.dev.us/nsearch, i get an error like this: And the file /app/code/Nextopia/Search/...
0
votes
2answers
21 views

Get Model Data in ajax request

I am making an ajax request in my module to grab some custom CRUD data to populate a select box on the fly. I have a working ajax request and controller Javascript define(["jquery"], function($){ ...
0
votes
3answers
44 views

Block not showing in custom frontend controller

Here is my custom frontend controller namespace Namespace\Testing\Controller\Payment; class Failure extends \Magento\Framework\App\Action\Action { /** * @var \Magento\Checkout\Model\Session ...
0
votes
2answers
34 views

Custom controller action to specific path in magento 1.9

how to redirect the custom controller path to specific store name http://testurl.com/testmodule/index/testview/id/123/ to http://testurl.com/testname thanks
0
votes
0answers
66 views

Magento 2 A customer with the same email already exists in an associated website error

I'm stuck in a weird problem. Everytime I try to create an account and add an address to that account programmatically I get an error called A customer with the same email already exists in an ...
0
votes
2answers
40 views

Magento 2: Use a custom controller as website root?

I'm building a little module on magento2 and I can currently access it at mysite.com/test/mymodule. I want to be able to access it at mysite.com. How can I do that? I've tried doing a URL rewrite ...
1
vote
1answer
68 views

GET Products by brand and category

I'm trying to create some type of search method for customers where they select the product's brand they want to search and then, if they want, they can also select the category they want (if there ...
1
vote
0answers
33 views

Magento 2 how to receive a webhook body?

I'm doing an integration with a system called Sift Science. What I need to accomplish is to receive a response whenever someone in Sift Science performs an action (for example> Approve account, ban ...
3
votes
2answers
67 views

Controller URL does not work

I have the problem that i always get the error 404 not found, if I want to get the url of my controller. This is my filestructure: And this is the URL I am trying to get loaded: http://localhost/...
0
votes
1answer
33 views

Send data from controller to phtml in Magento 1

Send data from controller to Phtml in Magento 1. I use ajax send data from phtml to controller and handle it. After processing, I want to send the data back to phtml. And put it on <option value ...
0
votes
2answers
37 views

What are getResponse, getRequest functions? (Bonus: explanation of getUrl)

I don't understand getResponse and getRequest functions of the Mage_Core_Controller_Varien_Action class. EDIT: See below an explanation of getUrl function! Thanks!
0
votes
4answers
144 views

Wishlist ajax remove

I want to remove product from wishlist from a custom button on detail. I did a plugin for the Magento\Wishlist\Controller\Index\Remove.php with an aroundExecute but for some reason I can't load/create ...
1
vote
1answer
30 views

Magento 2: Get value from Cron system.xml

I would like to take the value of the ahead schedule of this system.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:...
0
votes
1answer
27 views

Get value changed in admin grid SaveButton magento 2

I created a custom magento 2 form. As far as saving, I would like to take the modified value in the save.php of the controller. Is there any method I can use? This is my save.php controller <?php ...
0
votes
0answers
20 views

how to get guest email address in CollectTotalsObserver page in magento 2

how to get a guest email address in CollectTotalsObserver page in Magento 2. public function execute(\Magento\Framework\Event\Observer $observer) { /** @var \Magento\Quote\Api\Data\...
3
votes
5answers
247 views

Magento2: How can I logout customer from controller?

In Magento 2, I want to write a custom controller. Whenever anyone tries to call the controller URL (http://mymagento.com/mycontroller/index/index). It should redirect to this controller an event ...
1
vote
0answers
23 views

Modifying the custom controller url to SEO friendly in Magento 2

I have created my custom module for loading the custom template. Here is the code of Vendor/Module/etc/frontend/routes.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
0
votes
1answer
63 views

Magento 2 How to send data to Controller with Ajax from a template?

I'm trying to send some data to my Controller from a template.html using Ajax, so my checkout page does not refresh when I send a custom form, but I don't get anything, the information is an extra ...
0
votes
1answer
164 views

Magento 2 - Create csv file for download in admin

I need to create a file in mangento 2 admin. I'm using a button to get in a controller route. My form ui component: <item name="buttons" xsi:type="array"> <item name="save" ...
1
vote
2answers
41 views

I am overriding a controller and want to use a custom helper in the overrided controller,how can i?

I've overridden following controller:- Magento\Customer\Controller\Account\CreatePost.php And the constructor method of this class is:- public function __construct( Context $context, ...
0
votes
0answers
38 views

Magento 2 custom product attribute

Need help/idea's for the following: We have products which can be applied to different car models and car manufacturers. So field manufacturer is multi-select, populating this field is not a problem ...
0
votes
0answers
20 views

Magento 2.3.1 in multi shipping overview Post controller page not working go to Success page

Magento2.3.1 in multi shipping overview Post controller page not working go to Success page Page Redirect is not working how to solve this issues ? Payment id is not showing on this page ???? vendor/...
3
votes
0answers
26 views

Production mode doesnt load any content for custom module

I have created a custom module in Magento 2. In developer mode it is working well, however same module does not show any content in the production mode of Magento its show only white screen. There is ...
0
votes
0answers
25 views

How to edit customer information with custom attributes Magento 2

I have created 2 custom attributes and one is a select type so I succeed to make them appear in the form of edit account but when trying to save I get an error and I am stuck there. I also have two ...
0
votes
0answers
22 views

controller not reaching magento2

One strange thing is happing in my application, I have one custom link in my email. On development server everything works fine, but on production server when I clicked the link nothing happens, ...
0
votes
0answers
32 views

Magento2 redirecting to homepage

Can anyone let me know why below code of refer URL redirects to homepage, instead of last page visited in controller ? This happens only in live website, beta website works perfect: $resultRedirect ...
1
vote
1answer
57 views

Update record error : “Unique constraint violation found” in magento2

In the controller, I am inserting and updating data. But when record is already exist it's not update it's again try to insert so i am getting above error: if(!$checkoutPrescriptionCollection->...
3
votes
1answer
175 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 ...