Magento 2 The page isn’t redirecting properly in custom moduleHow can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlI created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?main.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?MagentoFrameworkObjectManagerObjectManager givenMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 Can't view module's front end page output?Deleted ShipperHQ module causing error in “All Customers” section of Magento 2
What does the behaviour of water on the skin of an aircraft in flight tell us?
Future enhancements for the finite element method
Mother abusing my finances
Why to use water tanks from Space shuttle in museum?
My player wants to cast multiple charges of magic missile from a wand
Smart people send dumb people to a new planet on a space craft that crashes into a body of water
How can I prevent interns from being expendable?
Get LaTeX form from step by step solution
What does "tea juice" mean in this context?
chmod would set file permission to 000 no matter what permission i try to set
Draw a checker pattern with a black X in the center
Infinitely many hats
Preserving culinary oils
Is the world in Game of Thrones spherical or flat?
Did airlines fly their aircraft slower in response to oil prices in the 1970s?
If I create magical darkness with the Silent Image spell, can I see through it if I have the Devil's Sight warlock invocation?
Is there a rule that prohibits us from using 2 possessives in a row?
Are UK pensions taxed twice?
Team member doesn't give me the minimum time to complete a talk
What is the difference between nullifying your vote and not going to vote at all?
When a current flow in an inductor is interrupted, what limits the voltage rise?
How should I push back against my job assigning "homework"?
Can an old DSLR be upgraded to match modern smartphone image quality
How can I grammatically understand "Wir über uns"?
Magento 2 The page isn’t redirecting properly in custom module
How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlI created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?main.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?MagentoFrameworkObjectManagerObjectManager givenMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 Can't view module's front end page output?Deleted ShipperHQ module causing error in “All Customers” section of Magento 2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have created the custom module for custom login. But when I open the below link it's not redirecting properly.
http://localhost/magento/custommodule/
below is my route file code and path:
appcodeVendorCustommoduleetcfrontendroutes.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="custommodule" frontName="custommodule">
<module name="Vendor_Custommodule" />
</route>
</router>
</config>
layout file path:
appcodeVendorCustommoduleviewfrontendlayoutpressroom_index_index.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd" layout="2columns-left">
<body>
<referenceBlock name="page.main.title">
<action method="setPageTitle">
<argument translate="true" name="title" xsi:type="string">pressroom</argument>
</action>
</referenceBlock>
<referenceContainer name="content">
<container name="customer.login.container" label="Customer Login Container" htmlTag="div" htmlClass="login-container">
<block class="MagentoCustomerBlockFormLogin" name="customer_form_login" template="form/mycusromlogin.phtml">
<container name="form.additional.info" as="form_additional_info"/>
</block>
</container>
</referenceContainer>
</body>
</page>
appcodeVendorCustommoduleControllerIndexIndex.php
<?php
namespace VendorCustommoduleControllerIndex;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkUrlInterface;
use MagentoFrameworkAppActionAction;
class Index extends MagentoFrameworkAppActionAction
protected $_resultPageFactory;
protected $urlInterface;
public function __construct(Context $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
UrlInterface $urlInterface,
MagentoCustomerModelSession $session)
$this->_resultPageFactory = $resultPageFactory;
$this->urlInterface = $urlInterface;
$this->_session = $session;
parent::__construct($context);
public function execute()
$url = $this->urlInterface->getUrl('custommodule/index/index');
// Create login URL
$login_url = $this->urlInterface->getUrl('custommodule/index/index', array('referer' => base64_encode($url))
);
// Redirect to login URL
/** @var MagentoBackendModelViewResultRedirect $resultRedirect */
if(!$this->_session->isLoggedIn())
//echo $login_url.'<br /> here'; die;
$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setUrl($login_url);
return $resultRedirect;
else
//echo $login_url; die;
$resultPage = $this->_resultPageFactory->create();
return $resultPage;
magento2 customer-account redirection
|
show 3 more comments
I have created the custom module for custom login. But when I open the below link it's not redirecting properly.
http://localhost/magento/custommodule/
below is my route file code and path:
appcodeVendorCustommoduleetcfrontendroutes.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="custommodule" frontName="custommodule">
<module name="Vendor_Custommodule" />
</route>
</router>
</config>
layout file path:
appcodeVendorCustommoduleviewfrontendlayoutpressroom_index_index.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd" layout="2columns-left">
<body>
<referenceBlock name="page.main.title">
<action method="setPageTitle">
<argument translate="true" name="title" xsi:type="string">pressroom</argument>
</action>
</referenceBlock>
<referenceContainer name="content">
<container name="customer.login.container" label="Customer Login Container" htmlTag="div" htmlClass="login-container">
<block class="MagentoCustomerBlockFormLogin" name="customer_form_login" template="form/mycusromlogin.phtml">
<container name="form.additional.info" as="form_additional_info"/>
</block>
</container>
</referenceContainer>
</body>
</page>
appcodeVendorCustommoduleControllerIndexIndex.php
<?php
namespace VendorCustommoduleControllerIndex;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkUrlInterface;
use MagentoFrameworkAppActionAction;
class Index extends MagentoFrameworkAppActionAction
protected $_resultPageFactory;
protected $urlInterface;
public function __construct(Context $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
UrlInterface $urlInterface,
MagentoCustomerModelSession $session)
$this->_resultPageFactory = $resultPageFactory;
$this->urlInterface = $urlInterface;
$this->_session = $session;
parent::__construct($context);
public function execute()
$url = $this->urlInterface->getUrl('custommodule/index/index');
// Create login URL
$login_url = $this->urlInterface->getUrl('custommodule/index/index', array('referer' => base64_encode($url))
);
// Redirect to login URL
/** @var MagentoBackendModelViewResultRedirect $resultRedirect */
if(!$this->_session->isLoggedIn())
//echo $login_url.'<br /> here'; die;
$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setUrl($login_url);
return $resultRedirect;
else
//echo $login_url; die;
$resultPage = $this->_resultPageFactory->create();
return $resultPage;
magento2 customer-account redirection
What do you mean by not properly rendered? Not at all or is an exception being generated?
– ooxi
Jun 15 '17 at 7:58
It's not redirecting properly. it's showing theThe page isn’t redirecting properly
error.
– mageDev0688
Jun 15 '17 at 8:38
Sorry I have misread your title as rendered not redirected, shame on me
– ooxi
Jun 15 '17 at 8:41
Ok, please see my code what I am doing. I want to addreferer key
with route URL, so that when user will login they will redirect on same page after the login.
– mageDev0688
Jun 15 '17 at 8:43
Is the login URL really custommodule/index/index? It seams like you are redirecting to yourself? Maybe change the secondcustommodule/index/index
tocustomer/account/login
– ooxi
Jun 15 '17 at 8:43
|
show 3 more comments
I have created the custom module for custom login. But when I open the below link it's not redirecting properly.
http://localhost/magento/custommodule/
below is my route file code and path:
appcodeVendorCustommoduleetcfrontendroutes.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="custommodule" frontName="custommodule">
<module name="Vendor_Custommodule" />
</route>
</router>
</config>
layout file path:
appcodeVendorCustommoduleviewfrontendlayoutpressroom_index_index.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd" layout="2columns-left">
<body>
<referenceBlock name="page.main.title">
<action method="setPageTitle">
<argument translate="true" name="title" xsi:type="string">pressroom</argument>
</action>
</referenceBlock>
<referenceContainer name="content">
<container name="customer.login.container" label="Customer Login Container" htmlTag="div" htmlClass="login-container">
<block class="MagentoCustomerBlockFormLogin" name="customer_form_login" template="form/mycusromlogin.phtml">
<container name="form.additional.info" as="form_additional_info"/>
</block>
</container>
</referenceContainer>
</body>
</page>
appcodeVendorCustommoduleControllerIndexIndex.php
<?php
namespace VendorCustommoduleControllerIndex;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkUrlInterface;
use MagentoFrameworkAppActionAction;
class Index extends MagentoFrameworkAppActionAction
protected $_resultPageFactory;
protected $urlInterface;
public function __construct(Context $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
UrlInterface $urlInterface,
MagentoCustomerModelSession $session)
$this->_resultPageFactory = $resultPageFactory;
$this->urlInterface = $urlInterface;
$this->_session = $session;
parent::__construct($context);
public function execute()
$url = $this->urlInterface->getUrl('custommodule/index/index');
// Create login URL
$login_url = $this->urlInterface->getUrl('custommodule/index/index', array('referer' => base64_encode($url))
);
// Redirect to login URL
/** @var MagentoBackendModelViewResultRedirect $resultRedirect */
if(!$this->_session->isLoggedIn())
//echo $login_url.'<br /> here'; die;
$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setUrl($login_url);
return $resultRedirect;
else
//echo $login_url; die;
$resultPage = $this->_resultPageFactory->create();
return $resultPage;
magento2 customer-account redirection
I have created the custom module for custom login. But when I open the below link it's not redirecting properly.
http://localhost/magento/custommodule/
below is my route file code and path:
appcodeVendorCustommoduleetcfrontendroutes.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="custommodule" frontName="custommodule">
<module name="Vendor_Custommodule" />
</route>
</router>
</config>
layout file path:
appcodeVendorCustommoduleviewfrontendlayoutpressroom_index_index.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd" layout="2columns-left">
<body>
<referenceBlock name="page.main.title">
<action method="setPageTitle">
<argument translate="true" name="title" xsi:type="string">pressroom</argument>
</action>
</referenceBlock>
<referenceContainer name="content">
<container name="customer.login.container" label="Customer Login Container" htmlTag="div" htmlClass="login-container">
<block class="MagentoCustomerBlockFormLogin" name="customer_form_login" template="form/mycusromlogin.phtml">
<container name="form.additional.info" as="form_additional_info"/>
</block>
</container>
</referenceContainer>
</body>
</page>
appcodeVendorCustommoduleControllerIndexIndex.php
<?php
namespace VendorCustommoduleControllerIndex;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkUrlInterface;
use MagentoFrameworkAppActionAction;
class Index extends MagentoFrameworkAppActionAction
protected $_resultPageFactory;
protected $urlInterface;
public function __construct(Context $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
UrlInterface $urlInterface,
MagentoCustomerModelSession $session)
$this->_resultPageFactory = $resultPageFactory;
$this->urlInterface = $urlInterface;
$this->_session = $session;
parent::__construct($context);
public function execute()
$url = $this->urlInterface->getUrl('custommodule/index/index');
// Create login URL
$login_url = $this->urlInterface->getUrl('custommodule/index/index', array('referer' => base64_encode($url))
);
// Redirect to login URL
/** @var MagentoBackendModelViewResultRedirect $resultRedirect */
if(!$this->_session->isLoggedIn())
//echo $login_url.'<br /> here'; die;
$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setUrl($login_url);
return $resultRedirect;
else
//echo $login_url; die;
$resultPage = $this->_resultPageFactory->create();
return $resultPage;
magento2 customer-account redirection
magento2 customer-account redirection
asked Jun 15 '17 at 7:27
mageDev0688mageDev0688
370728
370728
What do you mean by not properly rendered? Not at all or is an exception being generated?
– ooxi
Jun 15 '17 at 7:58
It's not redirecting properly. it's showing theThe page isn’t redirecting properly
error.
– mageDev0688
Jun 15 '17 at 8:38
Sorry I have misread your title as rendered not redirected, shame on me
– ooxi
Jun 15 '17 at 8:41
Ok, please see my code what I am doing. I want to addreferer key
with route URL, so that when user will login they will redirect on same page after the login.
– mageDev0688
Jun 15 '17 at 8:43
Is the login URL really custommodule/index/index? It seams like you are redirecting to yourself? Maybe change the secondcustommodule/index/index
tocustomer/account/login
– ooxi
Jun 15 '17 at 8:43
|
show 3 more comments
What do you mean by not properly rendered? Not at all or is an exception being generated?
– ooxi
Jun 15 '17 at 7:58
It's not redirecting properly. it's showing theThe page isn’t redirecting properly
error.
– mageDev0688
Jun 15 '17 at 8:38
Sorry I have misread your title as rendered not redirected, shame on me
– ooxi
Jun 15 '17 at 8:41
Ok, please see my code what I am doing. I want to addreferer key
with route URL, so that when user will login they will redirect on same page after the login.
– mageDev0688
Jun 15 '17 at 8:43
Is the login URL really custommodule/index/index? It seams like you are redirecting to yourself? Maybe change the secondcustommodule/index/index
tocustomer/account/login
– ooxi
Jun 15 '17 at 8:43
What do you mean by not properly rendered? Not at all or is an exception being generated?
– ooxi
Jun 15 '17 at 7:58
What do you mean by not properly rendered? Not at all or is an exception being generated?
– ooxi
Jun 15 '17 at 7:58
It's not redirecting properly. it's showing the
The page isn’t redirecting properly
error.– mageDev0688
Jun 15 '17 at 8:38
It's not redirecting properly. it's showing the
The page isn’t redirecting properly
error.– mageDev0688
Jun 15 '17 at 8:38
Sorry I have misread your title as rendered not redirected, shame on me
– ooxi
Jun 15 '17 at 8:41
Sorry I have misread your title as rendered not redirected, shame on me
– ooxi
Jun 15 '17 at 8:41
Ok, please see my code what I am doing. I want to add
referer key
with route URL, so that when user will login they will redirect on same page after the login.– mageDev0688
Jun 15 '17 at 8:43
Ok, please see my code what I am doing. I want to add
referer key
with route URL, so that when user will login they will redirect on same page after the login.– mageDev0688
Jun 15 '17 at 8:43
Is the login URL really custommodule/index/index? It seams like you are redirecting to yourself? Maybe change the second
custommodule/index/index
to customer/account/login
– ooxi
Jun 15 '17 at 8:43
Is the login URL really custommodule/index/index? It seams like you are redirecting to yourself? Maybe change the second
custommodule/index/index
to customer/account/login
– ooxi
Jun 15 '17 at 8:43
|
show 3 more comments
1 Answer
1
active
oldest
votes
You should change layout name pressroom_index_index
to custommodule_index_index
Not test you but you should try redirect like below
public function execute()
--- concat ---
$resultRedirect->setUrl('custommodule/index/index');
--- concat ---
Thanks for your answer, I had solved this issue at my end.
– mageDev0688
Jun 19 '17 at 5:08
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%2f179142%2fmagento-2-the-page-isn-t-redirecting-properly-in-custom-module%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You should change layout name pressroom_index_index
to custommodule_index_index
Not test you but you should try redirect like below
public function execute()
--- concat ---
$resultRedirect->setUrl('custommodule/index/index');
--- concat ---
Thanks for your answer, I had solved this issue at my end.
– mageDev0688
Jun 19 '17 at 5:08
add a comment |
You should change layout name pressroom_index_index
to custommodule_index_index
Not test you but you should try redirect like below
public function execute()
--- concat ---
$resultRedirect->setUrl('custommodule/index/index');
--- concat ---
Thanks for your answer, I had solved this issue at my end.
– mageDev0688
Jun 19 '17 at 5:08
add a comment |
You should change layout name pressroom_index_index
to custommodule_index_index
Not test you but you should try redirect like below
public function execute()
--- concat ---
$resultRedirect->setUrl('custommodule/index/index');
--- concat ---
You should change layout name pressroom_index_index
to custommodule_index_index
Not test you but you should try redirect like below
public function execute()
--- concat ---
$resultRedirect->setUrl('custommodule/index/index');
--- concat ---
answered Jun 19 '17 at 2:04
mrtuvnmrtuvn
1,91411830
1,91411830
Thanks for your answer, I had solved this issue at my end.
– mageDev0688
Jun 19 '17 at 5:08
add a comment |
Thanks for your answer, I had solved this issue at my end.
– mageDev0688
Jun 19 '17 at 5:08
Thanks for your answer, I had solved this issue at my end.
– mageDev0688
Jun 19 '17 at 5:08
Thanks for your answer, I had solved this issue at my end.
– mageDev0688
Jun 19 '17 at 5:08
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%2f179142%2fmagento-2-the-page-isn-t-redirecting-properly-in-custom-module%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
What do you mean by not properly rendered? Not at all or is an exception being generated?
– ooxi
Jun 15 '17 at 7:58
It's not redirecting properly. it's showing the
The page isn’t redirecting properly
error.– mageDev0688
Jun 15 '17 at 8:38
Sorry I have misread your title as rendered not redirected, shame on me
– ooxi
Jun 15 '17 at 8:41
Ok, please see my code what I am doing. I want to add
referer key
with route URL, so that when user will login they will redirect on same page after the login.– mageDev0688
Jun 15 '17 at 8:43
Is the login URL really custommodule/index/index? It seams like you are redirecting to yourself? Maybe change the second
custommodule/index/index
tocustomer/account/login
– ooxi
Jun 15 '17 at 8:43