All Questions
39 questions
34
votes
5
answers
60k
views
Magento 2: How to get controller, module, action and router name?
Magento 2: How to get controller, module, action and router name?
8
votes
2
answers
38k
views
Magento 2 - Send form data to Controller using AJAX and return Result to PHTML
I am working on a simple custom module, where user can input height and the weight/BMI will be shown as output on form submit. The page where user enters input is Calculation Page while output is ...
0
votes
1
answer
1k
views
Magento2 How to call model function in Controller
I have following model in one module
namespace Abc\Abcd\Model\Job;
use Magento\Backend\App\Action\Context;
abstract class AbstractJob extends AbstractModel
{
private $name;
public function ...
1
vote
1
answer
3k
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 ...
2
votes
1
answer
2k
views
Magento 2: Submitted Form not calling Controller
To continue with the question below
Magento 2: How to define Scope For Router.php
app\code\Custom\Module\view\frontend\templates\posts\view.phtml
<form class="form post reply"
action="<?...
2
votes
1
answer
930
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
2
answers
3k
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 ...
6
votes
2
answers
18k
views
Magento 2.1: Invoke urlBuilder->getUrl() in a controller in a custom module
I think my issue might have to do with dependency injection, which I'm still trying to grab the concept.
What I would like to do is to be able to get the URL using getUrl() function from Magento\...
3
votes
2
answers
982
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/...
3
votes
2
answers
5k
views
Extending Third Party Modules in Magento 2
In Magento 2 for themes, it's incredibly easy to extend from a parent. This follows a nice logical hierarchy when inheriting theme .xml and .phtml files. This is clearly defined in the theme.xml.
...
3
votes
2
answers
998
views
Magento2: Custom module not working
I have created new module but it is not working.Please Help me on this.
registration
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\...
5
votes
3
answers
3k
views
Constructor for Magento Controller
I need constructor or init function that can be run for my custom module. I need to call it every time when request made to my module's controller in magento.
0
votes
2
answers
426
views
Magento2: Create Module without Controller [duplicate]
How to create a simple module like HelloWorld in Magento2 without controller
0
votes
3
answers
2k
views
How to re-submit form data in custom module?
I want to get post data in phtml . In case form data not save then show error and already fill form .
<form class="trail-register-form"
action="<?php echo htmlspecialchars($this->...
3
votes
2
answers
6k
views
Magento 2.2.0 - __construct() must be an instance of Magento\Framework\View\Result\PageFactory,
Controller File
<?php
namespace Magento2\HelloWorld\Controller\Index;
use \Magento\Framework\App\Action\Action;
use \Magento\Framework\View\Result\PageFactory;
use \Magento\Framework\View\Result\...
2
votes
1
answer
3k
views
Magento 2 - Send processed data from Controller to PHTML
I am working on a simple custom module, where the user can input height and the weight/BMI will be shown as output on form submit. On clicking the submit button user will be redirected to different ...
2
votes
2
answers
6k
views
Magento 2 Set Array Data in Controller and call in PHTML
Controller
public function execute()
{
$bags_result = array( 'height'=>$height,
'weight'=>$weight
);
$result =...
0
votes
3
answers
6k
views
Magento 2 how to get Full Action name in controller action?
My controller working but getFullActionName() not called
My controller path: Magento20/app/code/Test/Module1/Controller/Index/Index
<?php
namespace Test\Module1\Controller\Index;
class Index ...
3
votes
2
answers
14k
views
Fatal error: Call to a member function create() on null in Magento 2
I got this error while saving image
Fatal error: Call to a member function create() on null in
/opt/lampp/htdocs/magento/2.1/app/code/Contact/Modules/Controller/Contact/Index.php
on line 85
...
0
votes
2
answers
526
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 ...
0
votes
2
answers
2k
views
Magento 2 Controller override not working
I have to override 2 controller 1 override is working and 1 override not working
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
2
votes
1
answer
1k
views
Magento 2.1: Letter Case for Controller Actions URL Route
I tried to create a custom payment gateway by creating a custom module based on Paypal module, specically Paypal Express Checkout.
I was able to replicate the route for controller actions: Start, ...
3
votes
1
answer
4k
views
My Custom controller not executing in magento 2
Controller is calling, but .phtml file is not calling. Even though I have debugging both controller and .phtml files controller is accessing through debugging but .phtml file is not accessing.
...
0
votes
2
answers
1k
views
Creating product view block with custom template in controller action fails
I want to create a Magento\Catalog\Block\Product\View block in a custom controller action (which will be used for an AJAX call later on). However I am getting the following error when creating the ...
0
votes
4
answers
1k
views
can't call controller in magento2 2.0.0-rc?
i have custom module. i can't call controller in view of my module.
this url call
http://localhost/magento2-2.0.0-rc/index.php/namespace/modulename/product/view/custom/
Code file Custom.php in ...
2
votes
3
answers
4k
views
Magento2 Stable Release - Render Layout not working in custom module
My module was working perfectly in Magento2 Beta version. In stable version, module is getting listed and custom module backend is working fine. However frontend pages of my module are not working. ...
0
votes
2
answers
378
views
Blank Page with Front End Template in Controller
I have a controller that needs to display text, but I get a blank page. Here is what I have:
Controller/Index/Index.php
namespace Veratad\AgeVerification\Controller\Index;
use Magento\...
1
vote
0
answers
831
views
Compile: Extra parameters passed to parent construct: $context
This has been asked a few times I know and I studied all of them and I also get the ieda what went wrong. However I cannot adapt those solutions to my issue.
I have a Class Post which extends \...
3
votes
0
answers
105
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
0
answers
23
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 ...
2
votes
1
answer
1k
views
Naming convention of Layered Naviations layout file to override state.phtml Magento 2
How is this layout file named , i mean on what basis. (Since there is no controller and router xml)
Magento\LayeredNavigation\view\frontend\layout\catalog_category_view_type_layered.xml
If im ...
2
votes
2
answers
1k
views
Magento 2: How to Set controller, module, action name? [duplicate]
I want to do these codes like in magento 1
$request->setModuleName('catalogsearch')
->setControllerName('advanced')
->setActionName('result');
and then the page load content ...
1
vote
1
answer
197
views
How to write a controller to show all brand?
I am new in learning Magento 2 and I installed a module Ves Brand , now I want to create a page that show all brands I need to create a controller
1
vote
1
answer
834
views
Use imagick within Magento2 Custom controller
I have a beginners question.. I've built a custom module. I want to use Imagick for image manipulation from within the controller.
Imagick is properly installed on my server and works like charm from ...
3
votes
2
answers
553
views
How to access products in custom module
<?php
namespace Queueapp\Queueapp\Controller\Query;
// Mage::app();
class Products extends \Magento\Framework\App\Action\Action {
/** @var \Magento\Framework\View\Result\Page */
protected ...
0
votes
0
answers
95
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\...
2
votes
0
answers
59
views
Implimenting Custom Controller with payment option issues [closed]
I'm hoping someone can contribute to my complex issue. We have implemented a custom registration form with the aim of enrolling 'consultants'. Part of this enrollment is to order a special starter ...
0
votes
1
answer
363
views
Magento 2.1: Do we need to do anything special for the controll action to accept HTTP Post with Json Payload?
I have a controller action that will be used for webhook handler.
When I did the form post to that URL with header content-type:
application/x-www-form-urlencoded
My load is:
MyVariableOne=...
1
vote
2
answers
119
views
Issue in creating custom module
I have created a custom news module in Magento 2.
News module includes admin listing and edit.
But it is showing fatal error.
Fatal error: Class Namespace\Module\Controller\Adminhtml\Enquiry
...