Magento 2 | Create frontend route The Next CEO of Stack OverflowMagento 2 - Sample module displays blank pageHow can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlMagento 2: How to define scope in di.xml & Router.phpmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2 The page isn’t redirecting properly in custom moduleHow to create a shorter route in Magento 2?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom Options
Is it ever safe to open a suspicious html file (e.g. email attachment)?
Different harmonic changes implied by a simple descending scale
I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin
Inappropriate reference requests from Journal reviewers
What exact does MIB represent in SNMP? How is it different from OID?
What was the first Unix version to run on a microcomputer?
Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?
Why did we only see the N-1 starfighters in one film?
If a black hole is created from light, can this black hole then move at speed of light?
MessageLevel in QGIS3
Is there a way to save my career from absolute disaster?
How to count occurrences of text in a file?
If/When UK leaves the EU, can a future goverment conduct a referendum to join the EU?
Extending anchors in TikZ
What's the best way to handle refactoring a big file?
Can we say or write : "No, it'sn't"?
How fast would a person need to move to trick the eye?
At which OSI layer a user-generated data resides?
How does the mv command work with external drives?
Won the lottery - how do I keep the money?
Would a galaxy be visible from outside, but nearby?
Why does standard notation not preserve intervals (visually)
"and that skill is always a class skill for you" - does "always" have any meaning in Pathfinder?
What benefits would be gained by using human laborers instead of drones in deep sea mining?
Magento 2 | Create frontend route
The Next CEO of Stack OverflowMagento 2 - Sample module displays blank pageHow can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlMagento 2: How to define scope in di.xml & Router.phpmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2 The page isn’t redirecting properly in custom moduleHow to create a shorter route in Magento 2?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom Options
I want to create a custom frontend route. It should have this link:
www.mysite.com/myroute
<?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="myroute" frontName="myroute">
<module />
</route>
</router>
</config>
I've already created the route but I don't know where to place the controller.
Can you help me please?
Thanks!
magento2 router
add a comment |
I want to create a custom frontend route. It should have this link:
www.mysite.com/myroute
<?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="myroute" frontName="myroute">
<module />
</route>
</router>
</config>
I've already created the route but I don't know where to place the controller.
Can you help me please?
Thanks!
magento2 router
You can accept answer. If it will helpful for you :)
– Rohan Hapani
Jul 18 '18 at 13:32
add a comment |
I want to create a custom frontend route. It should have this link:
www.mysite.com/myroute
<?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="myroute" frontName="myroute">
<module />
</route>
</router>
</config>
I've already created the route but I don't know where to place the controller.
Can you help me please?
Thanks!
magento2 router
I want to create a custom frontend route. It should have this link:
www.mysite.com/myroute
<?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="myroute" frontName="myroute">
<module />
</route>
</router>
</config>
I've already created the route but I don't know where to place the controller.
Can you help me please?
Thanks!
magento2 router
magento2 router
edited 14 mins ago
k33n
asked Jul 18 '18 at 13:20
k33nk33n
455110
455110
You can accept answer. If it will helpful for you :)
– Rohan Hapani
Jul 18 '18 at 13:32
add a comment |
You can accept answer. If it will helpful for you :)
– Rohan Hapani
Jul 18 '18 at 13:32
You can accept answer. If it will helpful for you :)
– Rohan Hapani
Jul 18 '18 at 13:32
You can accept answer. If it will helpful for you :)
– Rohan Hapani
Jul 18 '18 at 13:32
add a comment |
4 Answers
4
active
oldest
votes
Here is complete example of how the fronted route work it is combination of controller,layout,block and template.
Route
app/code/QaisarSatti/HelloWorld/etc/frontend/routes.xml
<?xml version="1.0"?>
<!--
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/-->
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="QaisarSatti_HelloWorld" />
</route>
</router>
</config>
Controller
app/code/QaisarSatti/HelloWorld/Controller/Index/Index.php
<?php
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
namespace QaisarSattiHelloWorldControllerIndex;
class Index extends MagentoFrameworkAppActionAction
public function execute()
$this->_view->loadLayout();
$this->_view->renderLayout();
Layout File
app/code/QaisarSatti/HelloWorld/view/frontend/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<!--
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/-->
<page
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
layout="1column"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block
class="QaisarSattiHelloWorldBlockHelloWorld"
name="HelloWorld"
template="QaisarSatti_HelloWorld::HelloWorld.phtml">
.
</block>
</referenceContainer>
</body>
</page>
Template File
app/code/QaisarSatti/HelloWorld/view/frontend/templates/HelloWorld.phtml
<?php
/**
* Catalog Product Rewrite Helper
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
echo 'Hello World';
Custom Block
app/code/QaisarSatti/HelloWorld/Block/HelloWorld.php
<?php
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
namespace QaisarSattiHelloWorldBlock;
class HelloWorld extends MagentoFrameworkViewElementTemplate
public function _prepareLayout()
parent::_prepareLayout();
$this->pageConfig->getTitle()->set(__('First Hello World Module'));
return $this;
Reference
add a comment |
create Index.php controller in on below path :
/app/code/UO/NewsletterUV/Controller/Index/
<?php
namespace UONewsletterUVControllerIndex;
use MagentoFrameworkAppActionAction;
class Index extends Action
public function execute()
echo "Controller call successfully";
add a comment |
Try this:
Create PHP file at app/code/UO/NewsletterUV/Controller/Index/ with Index.php.
Code should be like this in that file.
namespace UONewsletterUVControllerIndex;
use MagentoFrameworkAppActionAction;
/**
* Class Index
* @package UONewsletterUVControllerIndexIndex
*/
class Index extends Action
/**
* Function execute
* @return MagentoFrameworkViewResultPage
*/
public function execute()
echo "Rout Called";
add a comment |
For this route, the controller must be in UO/NewsletterUv/Controllers ...
So if you access www.mysite.com/myroute -> it will call UO/Newsletter/Controllers/Index/Index.php
If you access www.mysite.com/myroute/my-action -> it will call UO/Newsletter/Controllers/MyAction/Index.php.
And so on...
The Controllers content looks like Rohan's answer.
I hope it helps.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f235006%2fmagento-2-create-frontend-route%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here is complete example of how the fronted route work it is combination of controller,layout,block and template.
Route
app/code/QaisarSatti/HelloWorld/etc/frontend/routes.xml
<?xml version="1.0"?>
<!--
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/-->
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="QaisarSatti_HelloWorld" />
</route>
</router>
</config>
Controller
app/code/QaisarSatti/HelloWorld/Controller/Index/Index.php
<?php
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
namespace QaisarSattiHelloWorldControllerIndex;
class Index extends MagentoFrameworkAppActionAction
public function execute()
$this->_view->loadLayout();
$this->_view->renderLayout();
Layout File
app/code/QaisarSatti/HelloWorld/view/frontend/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<!--
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/-->
<page
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
layout="1column"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block
class="QaisarSattiHelloWorldBlockHelloWorld"
name="HelloWorld"
template="QaisarSatti_HelloWorld::HelloWorld.phtml">
.
</block>
</referenceContainer>
</body>
</page>
Template File
app/code/QaisarSatti/HelloWorld/view/frontend/templates/HelloWorld.phtml
<?php
/**
* Catalog Product Rewrite Helper
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
echo 'Hello World';
Custom Block
app/code/QaisarSatti/HelloWorld/Block/HelloWorld.php
<?php
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
namespace QaisarSattiHelloWorldBlock;
class HelloWorld extends MagentoFrameworkViewElementTemplate
public function _prepareLayout()
parent::_prepareLayout();
$this->pageConfig->getTitle()->set(__('First Hello World Module'));
return $this;
Reference
add a comment |
Here is complete example of how the fronted route work it is combination of controller,layout,block and template.
Route
app/code/QaisarSatti/HelloWorld/etc/frontend/routes.xml
<?xml version="1.0"?>
<!--
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/-->
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="QaisarSatti_HelloWorld" />
</route>
</router>
</config>
Controller
app/code/QaisarSatti/HelloWorld/Controller/Index/Index.php
<?php
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
namespace QaisarSattiHelloWorldControllerIndex;
class Index extends MagentoFrameworkAppActionAction
public function execute()
$this->_view->loadLayout();
$this->_view->renderLayout();
Layout File
app/code/QaisarSatti/HelloWorld/view/frontend/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<!--
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/-->
<page
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
layout="1column"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block
class="QaisarSattiHelloWorldBlockHelloWorld"
name="HelloWorld"
template="QaisarSatti_HelloWorld::HelloWorld.phtml">
.
</block>
</referenceContainer>
</body>
</page>
Template File
app/code/QaisarSatti/HelloWorld/view/frontend/templates/HelloWorld.phtml
<?php
/**
* Catalog Product Rewrite Helper
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
echo 'Hello World';
Custom Block
app/code/QaisarSatti/HelloWorld/Block/HelloWorld.php
<?php
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
namespace QaisarSattiHelloWorldBlock;
class HelloWorld extends MagentoFrameworkViewElementTemplate
public function _prepareLayout()
parent::_prepareLayout();
$this->pageConfig->getTitle()->set(__('First Hello World Module'));
return $this;
Reference
add a comment |
Here is complete example of how the fronted route work it is combination of controller,layout,block and template.
Route
app/code/QaisarSatti/HelloWorld/etc/frontend/routes.xml
<?xml version="1.0"?>
<!--
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/-->
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="QaisarSatti_HelloWorld" />
</route>
</router>
</config>
Controller
app/code/QaisarSatti/HelloWorld/Controller/Index/Index.php
<?php
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
namespace QaisarSattiHelloWorldControllerIndex;
class Index extends MagentoFrameworkAppActionAction
public function execute()
$this->_view->loadLayout();
$this->_view->renderLayout();
Layout File
app/code/QaisarSatti/HelloWorld/view/frontend/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<!--
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/-->
<page
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
layout="1column"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block
class="QaisarSattiHelloWorldBlockHelloWorld"
name="HelloWorld"
template="QaisarSatti_HelloWorld::HelloWorld.phtml">
.
</block>
</referenceContainer>
</body>
</page>
Template File
app/code/QaisarSatti/HelloWorld/view/frontend/templates/HelloWorld.phtml
<?php
/**
* Catalog Product Rewrite Helper
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
echo 'Hello World';
Custom Block
app/code/QaisarSatti/HelloWorld/Block/HelloWorld.php
<?php
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
namespace QaisarSattiHelloWorldBlock;
class HelloWorld extends MagentoFrameworkViewElementTemplate
public function _prepareLayout()
parent::_prepareLayout();
$this->pageConfig->getTitle()->set(__('First Hello World Module'));
return $this;
Reference
Here is complete example of how the fronted route work it is combination of controller,layout,block and template.
Route
app/code/QaisarSatti/HelloWorld/etc/frontend/routes.xml
<?xml version="1.0"?>
<!--
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/-->
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="QaisarSatti_HelloWorld" />
</route>
</router>
</config>
Controller
app/code/QaisarSatti/HelloWorld/Controller/Index/Index.php
<?php
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
namespace QaisarSattiHelloWorldControllerIndex;
class Index extends MagentoFrameworkAppActionAction
public function execute()
$this->_view->loadLayout();
$this->_view->renderLayout();
Layout File
app/code/QaisarSatti/HelloWorld/view/frontend/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<!--
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/-->
<page
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
layout="1column"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block
class="QaisarSattiHelloWorldBlockHelloWorld"
name="HelloWorld"
template="QaisarSatti_HelloWorld::HelloWorld.phtml">
.
</block>
</referenceContainer>
</body>
</page>
Template File
app/code/QaisarSatti/HelloWorld/view/frontend/templates/HelloWorld.phtml
<?php
/**
* Catalog Product Rewrite Helper
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
echo 'Hello World';
Custom Block
app/code/QaisarSatti/HelloWorld/Block/HelloWorld.php
<?php
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
namespace QaisarSattiHelloWorldBlock;
class HelloWorld extends MagentoFrameworkViewElementTemplate
public function _prepareLayout()
parent::_prepareLayout();
$this->pageConfig->getTitle()->set(__('First Hello World Module'));
return $this;
Reference
edited Aug 2 '18 at 12:50
Marc-André Appel
1034
1034
answered Jul 19 '18 at 6:41
Qaisar SattiQaisar Satti
27k1256109
27k1256109
add a comment |
add a comment |
create Index.php controller in on below path :
/app/code/UO/NewsletterUV/Controller/Index/
<?php
namespace UONewsletterUVControllerIndex;
use MagentoFrameworkAppActionAction;
class Index extends Action
public function execute()
echo "Controller call successfully";
add a comment |
create Index.php controller in on below path :
/app/code/UO/NewsletterUV/Controller/Index/
<?php
namespace UONewsletterUVControllerIndex;
use MagentoFrameworkAppActionAction;
class Index extends Action
public function execute()
echo "Controller call successfully";
add a comment |
create Index.php controller in on below path :
/app/code/UO/NewsletterUV/Controller/Index/
<?php
namespace UONewsletterUVControllerIndex;
use MagentoFrameworkAppActionAction;
class Index extends Action
public function execute()
echo "Controller call successfully";
create Index.php controller in on below path :
/app/code/UO/NewsletterUV/Controller/Index/
<?php
namespace UONewsletterUVControllerIndex;
use MagentoFrameworkAppActionAction;
class Index extends Action
public function execute()
echo "Controller call successfully";
answered Jul 18 '18 at 13:26
Rohan HapaniRohan Hapani
6,76331865
6,76331865
add a comment |
add a comment |
Try this:
Create PHP file at app/code/UO/NewsletterUV/Controller/Index/ with Index.php.
Code should be like this in that file.
namespace UONewsletterUVControllerIndex;
use MagentoFrameworkAppActionAction;
/**
* Class Index
* @package UONewsletterUVControllerIndexIndex
*/
class Index extends Action
/**
* Function execute
* @return MagentoFrameworkViewResultPage
*/
public function execute()
echo "Rout Called";
add a comment |
Try this:
Create PHP file at app/code/UO/NewsletterUV/Controller/Index/ with Index.php.
Code should be like this in that file.
namespace UONewsletterUVControllerIndex;
use MagentoFrameworkAppActionAction;
/**
* Class Index
* @package UONewsletterUVControllerIndexIndex
*/
class Index extends Action
/**
* Function execute
* @return MagentoFrameworkViewResultPage
*/
public function execute()
echo "Rout Called";
add a comment |
Try this:
Create PHP file at app/code/UO/NewsletterUV/Controller/Index/ with Index.php.
Code should be like this in that file.
namespace UONewsletterUVControllerIndex;
use MagentoFrameworkAppActionAction;
/**
* Class Index
* @package UONewsletterUVControllerIndexIndex
*/
class Index extends Action
/**
* Function execute
* @return MagentoFrameworkViewResultPage
*/
public function execute()
echo "Rout Called";
Try this:
Create PHP file at app/code/UO/NewsletterUV/Controller/Index/ with Index.php.
Code should be like this in that file.
namespace UONewsletterUVControllerIndex;
use MagentoFrameworkAppActionAction;
/**
* Class Index
* @package UONewsletterUVControllerIndexIndex
*/
class Index extends Action
/**
* Function execute
* @return MagentoFrameworkViewResultPage
*/
public function execute()
echo "Rout Called";
edited Jul 18 '18 at 13:34
answered Jul 18 '18 at 13:27
kunjkunj
2,6702523
2,6702523
add a comment |
add a comment |
For this route, the controller must be in UO/NewsletterUv/Controllers ...
So if you access www.mysite.com/myroute -> it will call UO/Newsletter/Controllers/Index/Index.php
If you access www.mysite.com/myroute/my-action -> it will call UO/Newsletter/Controllers/MyAction/Index.php.
And so on...
The Controllers content looks like Rohan's answer.
I hope it helps.
add a comment |
For this route, the controller must be in UO/NewsletterUv/Controllers ...
So if you access www.mysite.com/myroute -> it will call UO/Newsletter/Controllers/Index/Index.php
If you access www.mysite.com/myroute/my-action -> it will call UO/Newsletter/Controllers/MyAction/Index.php.
And so on...
The Controllers content looks like Rohan's answer.
I hope it helps.
add a comment |
For this route, the controller must be in UO/NewsletterUv/Controllers ...
So if you access www.mysite.com/myroute -> it will call UO/Newsletter/Controllers/Index/Index.php
If you access www.mysite.com/myroute/my-action -> it will call UO/Newsletter/Controllers/MyAction/Index.php.
And so on...
The Controllers content looks like Rohan's answer.
I hope it helps.
For this route, the controller must be in UO/NewsletterUv/Controllers ...
So if you access www.mysite.com/myroute -> it will call UO/Newsletter/Controllers/Index/Index.php
If you access www.mysite.com/myroute/my-action -> it will call UO/Newsletter/Controllers/MyAction/Index.php.
And so on...
The Controllers content looks like Rohan's answer.
I hope it helps.
edited Jul 18 '18 at 13:52
answered Jul 18 '18 at 13:30
lpFranzlpFranz
362113
362113
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f235006%2fmagento-2-create-frontend-route%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can accept answer. If it will helpful for you :)
– Rohan Hapani
Jul 18 '18 at 13:32