Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [controllers]

Denotes questions about controllers and action methods

0
votes
0answers
17 views

How to add massaction in product grid in magento 1

What is the easiest way to add add mass action to product grid using only observer and controller(no block). I would like to see a simple example because it is the first time I create it.
2
votes
2answers
42 views

Magento 2 secret key problem

I've a form that performs an Ajax call to a controller, but the response always is You entered an invalid Secret Key. Please refresh the page. PereiraTech/Faturamento/Controller/Adminhtml/Ac/Index....
3
votes
2answers
58 views

Magento 2 - Unable to Get Request Params in controller

I am trying to get input data in the controller but controller not getting url params. <?php namespace Crud\Crudatfrontend\Controller\Result; use Magento\Framework\App\Action\Context; use ...
2
votes
1answer
21 views

Magento 2.1.7 - Unable to send form data to controller using AJAX

I am trying to fetch input value but I am unable to get values in the controller. Here is my code, Controller\Index\Index.php <?php namespace Crud\Crudatfrontend\Controller\Index; class Index ...
1
vote
0answers
17 views

how to fix 5.5.2 Syntax error. m189sm22281031qkf.2 - gsmtp in magento 2 email [closed]

controller delete.php <?php namespace Webkul\Mpquotesystem\Controller\Adminhtml\Managequotes; use Magento\Backend\App\Action; use Webkul\Mpquotesystem; class Delete extends \Magento\Backend\...
0
votes
0answers
10 views

Setting X-Magento Tags for custom controller

I have a custom controller for infinite scroll and filtered attributes which simply returns a json response. When modifying a category or product these cached responses are not cleared however. ...
4
votes
2answers
32 views

set x-frame-options in custom controller magento2

I have a custom controller with below code. namespace Vendor\Module\Controller\Service; class Login extends \Magento\Framework\App\Action\Action{ protected $_storeManager; protected $_customerFactory;...
0
votes
0answers
15 views

How to set the coupon on the specific product using SKU. Magento 2

I followed this code $price = 100; $sku = '24-WG085'; $discount = ($price - (($price + 1) / 2)); $shoppingCartPriceRule = $this->_objectManager->create('Magento\SalesRule\Model\Rule'); $...
0
votes
1answer
20 views

Cannot call my custom Helper Class. Magento 2

I'm trying to call my custom Helper class in Controller but when I call the function of my helper in Controller it gives me Fatal error: Uncaught Error: Call to undefined method Magento\Backend\Helper\...
0
votes
1answer
24 views

call a controller in other module

I've installed a module and I need to get some value from frontend and pass it to a controller in my module. is it a good practice to update in other module js files that are not created by me? and ...
0
votes
0answers
21 views

Magento 2.3.1 Download an excel file with PHPSpreadsheet

Trying to create a download button for an Xlsx file. Using PHPSpreadsheet for this however when downloading the file it seems corrupted with a stack trace at the bottom of excel files: Stack trace: #...
1
vote
0answers
26 views

Ajax call always returns in error from controller Magento 2

From my controller, I return a JSON data to my Ajax call but it always goes in the error section, even when it's not an error. jQuery.ajax({ type: 'POST', url: '/yxcustomer/index/...
1
vote
1answer
55 views

Unable to get newly inserted Product's Id using After Plugin for Catalog Product save controller method

I have created interceptor for catalog product controller's save action <type name="Magento\Catalog\Controller\Adminhtml\Product\Save"> <plugin name="ricky_catalog_save_product" ...
0
votes
1answer
42 views

Magento 2 : custom controller with multiple functions (actions) [closed]

i need index controller file in that i need to write addaction,deleteaction,getinfo,updateaction, like this place code multiple functions.same as like magento 1 after thaif i want add data can call ...
2
votes
0answers
29 views

Delete and add product again from cart in Magento 2

I have used below code to delete quote item from the cart and add it again in my controller $referenceProductId = $this->getRequest()->getPost('product_id') $customPrice = 100; $params = ...
3
votes
2answers
106 views

Allow only one qty of item into cart in Magento 2

I have created a custom controller in my module and calling via ajax to add the item to cart. Below is my controller code. <?php namespace {Vendor}\{Module}\Controller\Product; ...
0
votes
0answers
37 views

UI component save button controller magento 2

I have UI admin form xml file. I've got SaveButton.php block file, but I need to save form in db. As far as I know I need controller. How this controller would look like and in which directory it ...
6
votes
2answers
318 views

“We can't save the customer” error after Migration - Magento 2.3

I have migrated store from Magento 1.7.0.2 to Magento 2.3. When i Create the customer it shows me error "We can't save the customer." I have checked log file and i can see log, "Class Magento\Eav\...
2
votes
1answer
19 views

How to call a function which is in a overwritten controller block?

I have developed a module to overwrite a controller. I have the next route: Lecasa/Javinewlistproductcontroller/Block/Catalog/Product/List.phtml This List.phtml file is: class ...
0
votes
0answers
11 views

Trouble understanding Magento 2 context DI order in core code

In the module-customer/Controller/Adminhtml/Group , the Context class is passed into the __construct method 3rd to last, before the resultForwardFactory and resultPageFactory factory classes. ...
1
vote
1answer
25 views

Which block file calls for My Account page when it loads

I have written some helper functions, which does some database inserts The problem is I am calling all these functions from my phtml which gets loaded first time when My account is loaded for the ...
1
vote
0answers
16 views

How many ways are there to create a controller and what are they?

I have been developing with Magento 1.9 for the last two weeks. I have found several problems to develop each project (probably because my first project with magento had a high level...). I come ...
0
votes
0answers
16 views

Copy the cart to new page, but no action triggered when click on “update shopping cart”

I've copied my cart summary into a new page. I see my cart like if it was in checkout_cart_index, that's ok. But when I change a quantity and click on "update shopping cart", the page reloads and ...
0
votes
1answer
87 views

magento2 file upload Pdf not working

i have create controller for save data but i have not save pdf file so please help me how can fix this issue Thanks!! <?php public function execute() { $resultRedirect = $this->...
3
votes
1answer
42 views

Override OnepageController.php Not Working

I'm trying to override the successAction in the app/code/core/Mage/Checkout/controllers/OnepageController.php. I have done the following: I've created my override folder here: app/code/...
1
vote
1answer
18 views

Magento override Catalog Compare controller doesn't work

for some reason the Compare controller override doesn't work for me, I tried about everything I could find, but it just doesn't happen and I am running out of ideas. Do you see anything I am doing ...
0
votes
2answers
129 views

Add multiple items to cart in Magento2

I am implementing add to cart functionality from ajax using product id. This is my code of template file <tr class="border_bottom child-items selected"> <td >...
0
votes
1answer
67 views

Magento 2 Write to CSV within Controller

I have the following code: protected $_fileSystem; protected $_directoryList; public function __construct( \Magento\Framework\Filesystem $fileSystem, \Magento\Framework\App\Filesystem\...
0
votes
1answer
69 views

Magento 2 controller redirect on button click in phtml file

I want to redirect customer using controller when button is clicked in one of my phtml files. So far I got, controller: public function execute(){ return $this->addToCart(); } public ...
0
votes
1answer
386 views

Magento 2 redirect to external URL from controller

I want to redirect to a external URL in my controller but not in the execute() function. This code works fine and the result is a redirect to google: public function execute() { $resultRedirect =...
0
votes
0answers
27 views

Show Messages from Message Manger after Redirect

I am currently using the message manager to display a series of messages from my controller. $this->_messageManager->addSuccessMessage(__("All requested products have been added to the cart."));...
0
votes
1answer
32 views

Magento 2 Error

can anyone tell me what am I doing wrong with this code <?php namespace Feedback\Addon\Controller\Index; use Magento\Framework\App\Action\Context; use Feedback\Addon\Model\InsertFactory; class ...
7
votes
1answer
117 views

The purpose of the http verbs interfaces

In Magento 2.3 there are some interfaces for all the http verbs Magento\Framework\App\Action\HttpPostActionInterface Magento\Framework\App\Action\HttpGetActionInterface, ... All of them are empty ...
0
votes
2answers
107 views

How to create AJAX action for POST requests in Magento 2.3?

How to create a controller action that can be requested by POST properly in own custom payment module in Magento 2.3? How to create a parent class that will be extended by classes corresponding to ...
0
votes
1answer
30 views

show template in module magento 2

I am new at developing Magento 2 (Magento 2.3), I develop module to show my custom template But I get this error when I die('sumthing') in execute function it works correctly 1 exception(s): ...
0
votes
2answers
48 views

Redirect from Controller

In my controller BVZ\Customer\Controller\Index I'm doing a redirect using return $this->_redirect('customer/index/firstAccess'); When the code execute, the request are made (see the print below) ...
1
vote
1answer
29 views

Get breadcrumb in Controller Action

I need to get the breadcrumb in the controller action because I am using the cache modules(FPC and another system externally). It cached the breadcrumb in the frontend page. With that, I would use ...
1
vote
1answer
39 views

Magento 2, How to call front controller from admin page?

Using magento 2, front and admin, I need to access controller in print button on sale order page to print invoice which generate pdf in front view controller. Plz.
1
vote
2answers
253 views

magento2.3 controller won't handle post method

This is something I used to be able to do in 2.2, but in 2.3 I can't. A simple controller to handle a POST method, and only receive and send application/json content type. It works for GET/PUT ...
0
votes
1answer
55 views

Magento 2 - Request from Javascript is returned with Status code 302

I´m sending a POST request with data via XMLHttpRequest. The response that I´m getting do have the status code 302. Javascript function: function createCSV() { let xhttp = new XMLHttpRequest(); ...
0
votes
0answers
16 views

Magento 2 in how to change the password in direct in database link to connect using Seller without hash method?

i have try to change direct connect in database but its not working? <input type="password" placeholder="New Password" id="password" required> <input type="password"...
2
votes
1answer
110 views

Module custom page 404 error

An extension I'm using creates two custom pages in website: app/design/frontend/mytheme/default/layout/scommerce_competition.xml <?xml version="1.0"?> <layout version="0.1.0"> <...
0
votes
0answers
34 views

Magento 2 in How to change password in programmatically without hash method in password? [duplicate]

I am trying below code but it is not working $customer = $this->_CustomerRepositoryInterface->getById($id); $customerSecure = $this->_customerRegistry->retrieveSecureData($customer->...
0
votes
1answer
63 views

while call function from another controller “ should be compatible with ”

I am trying to call function from other controller . I am using version 2.2.6 . While call it is working properly without arugument. If i send argument it provide error should be compatible with ...
0
votes
3answers
219 views

Magento 2 : Overriding Default Contact Form Controller POST.php file

I'm trying to override the contact form post controller in Magento 2.2.6, by following the answer from this thread (Override module-contact view and controller) by creating my own module. I added \...
0
votes
1answer
204 views

Magento 2 login popup

I have a client login popup on my page with the form action="<?= $block->escapeUrl($block->getPostActionUrl()) ?>" How can I change this so the form will not redirect to the account ...
1
vote
2answers
162 views

Magento 2.2.6 Change 'From' field of magento contact form email to the sender

Currently, when customer submit a contact form through our website, the "sent from" email address we received is our support@example.com. I would like to change the "send from" email address to be the ...
0
votes
1answer
17 views

Magento 2 custom module shortened url with query string goes 404

I have a custom controller page : http://dev.test/myfrontend/ The above works fine. also the bellow one works http://dev.test/myfrontend/index/index/ Now if I add query string: http://dev.test/...
0
votes
2answers
27 views

How to create Single abstract controller to inherit in other controllers

I would like to create a single abstract controller in which i will define my authorization code to check for user validity and want to inherit that controller in my other controllers, so that i don't ...
0
votes
0answers
26 views

Call a function in every controller

I have controller file called Authorize.php, in this file i have check either the user is allowed to make request and i have other controller files like products.php and etc, i would like to call ...