Magento Asked by Claims on December 14, 2020
My target URL is: http://mylocalhost/devis/customer/printPdf
But it triggers a 404 and I can’t find why
I have my frontend router
app/code/FT/Devis/etc/frontend/routex.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="devis" frontName="devis">
<module name="FT_Devis" />
</route>
</router>
</config>
And I have my Controller
app/code/FT/Devis/Controller/Customer/PrintPdf.php
And of course, this class extends the action to have his own construct and execute method.
Can’t figure out why this routes is not working.
Moreover, it was something who worked before I think.
Step 1: Create routes.xml file. File: app/code/Vendor/HelloWorld/etc/frontend/routes.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route frontName="helloworld" id="helloworld">
<module name="Vendor_HelloWorld"/>
</route>
</router>
</config>
Step 2: Create controller file File: app/code/Vendor/HelloWorld/Controller/Index/Index.php
<?php
namespace VendorHelloWorldControllerIndex;
class Index extends MagentoFrameworkAppActionAction
{
protected $_pageFactory;
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $pageFactory)
{
$this->_pageFactory = $pageFactory;
return parent::__construct($context);
}
public function execute()
{
echo'magentocontroller'; exit;
return $this->_pageFactory->create();
}
}
Browse http://<yourhost.com>/helloworld/index/index
Answered by Hamendra Sunthwal on December 14, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP