Questions tagged [controllers]

Denotes questions about controllers and action methods

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

magento 2.4.3 Request validation failed for action "\Controller\Adminhtml\Import\Save\

4.3 admin custom controller redirecting to dashboard <form enctype="multipart/form-data" method="post" action="<?php echo $block->getFormAction(); ?>" id=&...
user avatar
1 vote
0 answers
10 views

Magento 2 : Redirect to customer after login to previous URL

For ex. suppose I open this URL before login. https://d89a529178.nxcli.net/hbftextiles/cuttingapproval/cfa/edit/id/43080 Actual result: It opens up the login page, once I log in it redirects to the ...
user avatar
0 votes
1 answer
124 views

Error on Di compile magento 2

I have set up Magento 2.4.4. On di:compile I am getting this error. Class "Hybrid_Provider_Model_OAuth2" not found#0 /var/www/vhosts/any.com/dev2.any.com/vendor/composer/ClassLoader.php(571) ...
user avatar
0 votes
0 answers
4 views

Duplicate the website is rendering my custom page blank

Due to some issues, my had to duplicate by website on another server, with the same specs (php version, apache...) But for some reason, some of my page are not blank. I've seen this before, I changed ...
user avatar
0 votes
2 answers
55 views

Magento 2 Custom Controller Action Created Using New Module Route Not Working

I am using magento2.3.5-p2 community edition ( open source ) I want to create a custom Controller so that I can post data using ajax to the Controller function created client side will call the ...
user avatar
0 votes
0 answers
49 views

Add UI Component in the Custom Block

Made the layout file in which I have called the custom block. <?xml version="1.0" encoding="UTF-8"?> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"...
user avatar
0 votes
0 answers
17 views

Multiple image upload with preview at frontend side. - M2

I have custom form in phtml template file. i want to add multiple image upload with image preview functionality as showing in above image. Can anyone guide me how i can create such functionality. ...
user avatar
0 votes
0 answers
8 views

Magento 2.4.2 in admin product edit Advanced pricing in Customer Group Price missing how to create this?

Magento 2.4.2 in admin product edit Advanced pricing in Customer Group Price missing how to create this? Please guide me how to add this fields?
user avatar
0 votes
0 answers
34 views

Magento 2.4.1 controller cache control

It seems that on my Magento 2 instance the controller methods are somehow cached because I am doing changes, compiling the code, but they are not visible when they are called. I even added a die() ...
user avatar
  • 15
0 votes
1 answer
181 views

How to Call Controller When hit any URL from website in Magento 2?

I have my custom controller that has my custom code, now I need to run that code when any URL hits from the site. My Controller URL is like common/index/code run can anyone help me how can I archive ...
user avatar
0 votes
2 answers
154 views

Getting information about a request using HttpGetActionInterface

I'm in the process of removing the deprecated Action implementation from my controllers in favor of the ActionInterface implementations. With the old extension approach of the Magento\Framework\App\...
user avatar
0 votes
1 answer
32 views

Get Controller of each request

What I want just to print out name of each controller called at a specific request? So How can I do that any help thanks in advance?
user avatar
0 votes
1 answer
15 views

Can't override magento contact

I seem to be missing something when it comes to overriding controllers. This is a somewhat recurring question in here, but nothing I've found in other questions worked for me, so either they might be ...
user avatar
0 votes
3 answers
81 views

Magento 2, How to call Controller custom function?

I have a controller with custom function getPost(). I want to call this function from my phtml My phtml code: <form id="my-form" method="POST" action="<?php echo $block-...
user avatar
0 votes
1 answer
99 views

add firstname and lastname in newsletter grid in magento 2.3.x

I want to add firstname and lastname in newsletter grid in Magento 2.3.x. first_name and last_name in newsletter form in frontend. adding columns to databse table "newsletter_subscribers". ...
user avatar
  • 498
0 votes
0 answers
37 views

Why is Delete action not deleting?

Hello newbie developer here. Currently I have made a module that will show a list of stores, with this list you can add, edit, save, and delete. My issue at the moment is that I cant get the store to ...
user avatar
0 votes
0 answers
103 views

Magento 2.4.3 - Notice: Undefined property: $_view - Decomposition of Controllers

I have been trying to create module in Magento 2.4.3 that has significant changes where decomposition is favored instead of inheritance - https://community.magento.com/t5/Magento-DevBlog/Decomposition-...
user avatar
2 votes
1 answer
201 views

Find Routes File For Magento 2 Rest API

I have inherited a Magento 2 site, and I am trying to find the rest api that is handling the checkout. The route is <magento_site>/rest/default/V1/<checkout _information>. As is, i have ...
user avatar
0 votes
0 answers
57 views

How to check if controller is redirected?

I want to put some JS code when the customer is successfully registered. What I found is after register \Magento\Customer\Controller\Account\CreatePost redirect it to the account page. I tried \...
user avatar
  • 427
0 votes
1 answer
318 views

Magento 2: How to use redirect in Router.php

I am trying to redirect a cms page to a custom controller. in router.php I can check the current URL, If the current URL is as an example if it matches /test-url i want to do a redirect to /test-url-...
user avatar
  • 45
0 votes
0 answers
19 views

How to create a module to add .well-known/file via controller?

I need to create a dynamic file to add the controller route below and change the content via the admin panel. mystore.com/.well-known/file I can't create a static file, and the admin option is ...
user avatar
0 votes
1 answer
70 views

How get user information inside of controller

I create route, and controller for it. All works fine if i call route like so. .... return $this->_pageFactory->create(); .... However when I want get user data from Magento\Customer\Model\...
user avatar
0 votes
1 answer
45 views

Magento 2 How to create cache for a collection inside controller

Hi am having a controller Search.php every time I do operation it loads all the collection and takes much time to load. So I wanted to cache the custom collection and optimize the loading time. this ...
user avatar
0 votes
0 answers
22 views

Magento 1.9 get post data contactform

I have created a custom contact form with indexcontroller. Emails are sent correctly with full post data but I cannot get the post values in the controller. public function postAction() { $...
user avatar
0 votes
1 answer
105 views

How to call controller in observer or block or helper?

How can I call controller in my observer like my observer function is this public function abcd{ //some code/// how to call controller here? } The controller function is execute ...
user avatar
  • 1,331
0 votes
1 answer
22 views

pop up modal is not submitting and not going to controller action url?

<?php /** /** @var $block \Magento\Catalog\Block\Product\View */ ?> <?php $_product = $block->getProduct(); ?> <?php $buttonTitle = __('Add to Cart'); ?> <?php $isSaleable = $...
user avatar
  • 19
0 votes
1 answer
24 views

Controller does not work

this is my controller <?php namespace Prevaj\Orderswatches\Controller\Index; class Index extends \Magento\Framework\App\Action\Action { protected $_pageFactory; /** * Undocumented ...
user avatar
0 votes
1 answer
286 views

Magento 2 How to pass variable from Controller to Observer on checkout_cart_product_add_after event

I'm trying to send a $price variable from a controller where I add to cart my product to checkout_cart_product_add_after event observer. Here is my Controller: public function execute(){ $...
user avatar
0 votes
1 answer
80 views

gmail receiving html tags - magento 2

Guys I have a module for sending e-mail, which when sending the e-mail is arriving with the html tags, example: br span, that is, it is not being interpreted. I think the code is read by php as a ...
user avatar
  • 197
3 votes
2 answers
55 views

email is coming with tags without interpretation

Guys I have a module for sending e-mail, that when sending the e-mail it is arriving with the html tags, example: br span, that is, it is not being interpreted. I think the code is read by php as a ...
user avatar
  • 197
1 vote
1 answer
240 views

Magento 2 Invalid Form Key when post to a controller

I'm trying to send a form from a Java Spring Application to Magento. What I'm doing in Java is just creating an standard form and on action I wrote Magento's controller path. Like this: http://ip/...
user avatar
0 votes
1 answer
33 views

Magento 2 custom dashboard Page

I want to show a completely custom dashboard. I have a controller for that. I just want to show this page when Admin login. I don't want to show the default Magento dashboard controller I want my ...
user avatar
  • 828
0 votes
1 answer
96 views

Magento 2 call url param in Model Collection filter

I'm trying to get some data that matches the id in the URL. I have a param in admin URL like below. seller/items/index/id/9/ I'm using the admin UI component which is working fine. My model code ...
user avatar
  • 828
1 vote
1 answer
97 views

Magento 2 : I want to add categories from front-end using controller in Magento 2

Here is the code I am using but it is given error. Please help. Thanks in advance. $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $rootCat = $objectManager->create('Magento\...
user avatar
1 vote
2 answers
137 views

Magento 2: Redirect to specific page on customer registration fail

I have made custom registration form which uses Magento's createPost for creating a new customer. On registration fail it is redirecting to customer/account/create I would like it to redirect it to ...
user avatar
  • 548
0 votes
0 answers
67 views

My Account reorder link onclick Ajax call controller in magento 2.4

My Account reorder link onclick Ajax call controller in magento 2.3 app/code/Vendorname/Modulename/view/frontend/templates/order/history.phtml <?php if ($this->helper(\Magento\Sales\Helper\...
user avatar
0 votes
1 answer
26 views

Controller to Observer Conversion?

I am new to Magento 2 modules and would like to create a module to run the below class whenever someone accesses the homepage. I believe it would be easier if I converted this to an observer so I just ...
user avatar
0 votes
1 answer
21 views

Build Customer View URL on Controller

How can I programmatically build this url: http://127.0.0.1/magento2/sales/order/view/order_id/61/? Im in a custom controller with the current Order object.
user avatar
0 votes
2 answers
46 views

null Order on custom controller

Im in a custom controller tying to get the order info with checkout session. There is my code. $order = $this->_checkoutSession->getLastRealOrder(); // Magento\Sales\Model\Order\Interceptor ...
user avatar
0 votes
1 answer
116 views

Is it good to use Access Token in Magento 2 for REST API?

I am using REST API for some product insertion process in my Controller File and i will used that Access Token to generate the token. Is it good to use that on my Live Website Code If not then what ...
user avatar
  • 526
1 vote
2 answers
58 views

How to call a controller function in a block?

Is it possible to call a controller function in a block, if yes, please define how can i achieve that.
user avatar
0 votes
1 answer
91 views

How to display an image using raw controller?

I'm new to magento and learning hard thesedays. I have a task to display an image using raw controller but couldn't really find out how to do this. I have my image on etc/frontend/web/images as shown ...
user avatar
  • 3
0 votes
1 answer
329 views

Magento 2: Multiple file upload not working

I want to upload multiple file using below code from different Choose File option, and it works for single file upload. So I want to upload multiple choose file in one click and save their path in ...
user avatar
0 votes
1 answer
164 views

Warning: Illegal offset type in isset or empty

Controller file code below, data get print successfully but throw Exception #0 (Exception): Warning: Illegal offset type in isset or empty public function execute() { try { ...
user avatar
1 vote
1 answer
95 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() ...
user avatar
0 votes
1 answer
202 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\...
user avatar
  • 95
0 votes
0 answers
225 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, '...
user avatar
  • 95
0 votes
1 answer
150 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 ...
user avatar
1 vote
1 answer
741 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://...
user avatar
  • 95
0 votes
0 answers
181 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 ...
user avatar

1
2 3 4 5
20