Questions tagged [controllers]
Denotes questions about controllers and action methods
0
votes
0answers
9 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.
...
0
votes
2answers
21 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
14 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
40 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
37 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
79 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
21 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
28 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
100 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
15 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
28 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 ...
5
votes
1answer
90 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
45 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
22 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
31 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
20 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
32 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.
0
votes
1answer
90 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
37 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
14 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
70 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
23 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
41 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
106 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
152 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 ...
0
votes
2answers
84 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
25 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 ...
1
vote
1answer
82 views
Magento 2 Route.xml File not working
Hello I created a simple module Wow_Page to create a Hello world page using route.xml with the help of magento 2 devdocs. But when i type the route in the url it is showing 404 error page not found.
...
1
vote
1answer
95 views
Magento2: I want to set custom quote price programmatically
I want to set custom quote price programmatically. Without the observer method.
The observer method is working fine but it is worked on add to cart button.
Please check my observer file below
<?...
1
vote
1answer
46 views
Magento 2: custom UrlRewrite Controller Router not works with some handlers
I'm creating a module to use custom url rewrites. For this I have created a module and I am using a custom UrlRewrite Controller Router.
For testing purpose, I generated the Router below. It works ...
2
votes
1answer
43 views
Magento 2.2: What controllers are called when a product is added to the cart?
I have the next error when a product is added to the cart:
Requested product doesn't exist
This comes from the following method:
\Magento\Catalog\Model\ProductRepository
public function ...
0
votes
2answers
50 views
Fatal Error : when get child block using controller
When get block using controller got fatal error like
Fatal error: Call to a member function getPostUrl() on null in
/app/design/frontend/theme/Vendor_Module/templates/post/list/item.phtml
on ...
0
votes
1answer
30 views
Magento2 how to get web image in controller file inside?
I am using magneto2 and in controller file I try to call getImageUrl function but unable to get Image url.
Please let me know how to get products image url in controller.
In console i an getting
...
0
votes
0answers
17 views
authorization controller to call to all other controllers best practices
I have created a module in which i have a index controller under authorization folder. In this index controller i have checked if the authorization is valid and if valid it proceed further. Now i ...
1
vote
2answers
62 views
Magento2 : How to create frontend layout files for controller's different action wise?
I have two controller action [1] /app/code/Mycustom/Custompage/Controller/Mypage/View.php and [2]
/app/code/Mycustom/Custompage/Controller/Mypage/View/Mytest.php .
I have cretead frontend layout ...
0
votes
1answer
36 views
can we send some data with other server url in controller magento 2 like below shown
Actually i am trying like this,Please check below code
$this->_eventManager->dispatch('server url', ['FirstName' => $firstname,'LastName' => $lastname,'Postcode' => $Postcode,'...
5
votes
1answer
167 views
Magento2 : Use of echo language construct is discouraged
I have my RSS feed from controller returned /displayed on frontend using echo , how do I replace echo any alternate method availabale?
MEQP1.Security.LanguageConstruct.DirectOutput
public ...
0
votes
1answer
45 views
Magento 2 URL to call custom controller not working
This is the default magento URL:
<base URL>/magento2/multishipping/checkout/billing
Now i have a custom controller i want to call this.
<base URL>/magento2/multishipping/checkout/...
3
votes
1answer
92 views
How to return search API response from controller in magento 2?
I have an API(ukvehicledata) for search using registration id.
I want to integrate with magento 2.2
I am getting response in controller as JSON format. I have converted it into an array.
Now I ...
1
vote
1answer
93 views
Magento 2 Message Manager not working in custom module Front end Controller
My controller without try catch:
class View extends Action
{
protected $resultPageFactory;
protected $productRepository;
protected $_messageManager;
public function __construct(
...
2
votes
0answers
31 views
Disable the full_page cache for a specific controller
I have a controller that I want to exclude from the full page cache however want to cache the block rendered within the controller.
I have tried the below code however this does not seem to work:
...
1
vote
0answers
32 views
Login as a customer from custom table in magento 1.9? [closed]
I want to login with custom field from custom table in magento 1.9, how to manage session,cookies and every default functionality for custom login user.Thank you
4
votes
1answer
37 views
path of controller not found in ajax magento 2
My controller name is Index and the action inside is Index and my route id and front name is evals so what to put in the url on javascript to get the right path of my controller. I put this
type : "...
4
votes
2answers
36 views
Log User in programatically for Magento 2 (via Contoller)
I have a process in Magento 1 to log user in using the below;
$session = Mage::getSingleton('customer/session');
$email = $this->getRequest()->getParam('email');
$password = $this->...
3
votes
2answers
51 views
Max URL Levels in Controller Magento 2
I have custom controller outputting JSON format which works well for the below URL level;
** Works
base url/module/folder/action
//equates to Vendor\Module\Controller\Folder\Index.php
However I ...
1
vote
3answers
57 views
form submit action to a controller
I have created a cms page and try to add form in cms page using phtml. and i need a form action to a controller. but shows an error
app/code/Ventor/Pricebeat/view/frontend/templates/pricebeat.phtml
&...