Magento 2, force login on product and catalog pages Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Force login to access catalog and product pagesMagento 2, force login on specific product and specific catalog pagesIs there a way to create a login portal to access a specific store (set as a subdomain)?Force login to access catalog and product pagesHow can I use a custom URL for an Admin Menu Item?Pull custom customer attribute and send in email? Magento 2.2Force customer to log in when visiting a specific category Magento 2Magento 2, force login on specific product and specific catalog pagesForce login to catalog and product pages in magento 2 custom themeProduct Final Price returns 0 instead a real valueMagento 2 - I need to create simple custom report with date range and other column filter (filter should be outside of grid)Magento 2: Product List Not Showing in Catalog and Search
Is it OK if I do not take the receipt in Germany?
How was Lagrange appointed professor of mathematics so early?
Does the Pact of the Blade warlock feature allow me to customize the properties of the pact weapon I create?
What came first? Venom as the movie or as the song?
What's the difference between using dependency injection with a container and using a service locator?
Providing direct feedback to a product salesperson
Why does BitLocker not use RSA?
Married in secret, can marital status in passport be changed at a later date?
Does traveling In The United States require a passport or can I use my green card if not a US citizen?
Why isn't everyone flabbergasted about Bran's "gift"?
How to mute a string and play another at the same time
Raising a bilingual kid. When should we introduce the majority language?
Coin Game with infinite paradox
Why are two-digit numbers in Jonathan Swift's "Gulliver's Travels" (1726) written in "German style"?
false 'Security alert' from Google - every login generates mails from 'no-reply@accounts.google.com'
Why did Israel vote against lifting the American embargo on Cuba?
Is "ein Herz wie das meine" an antiquated or colloquial use of the possesive pronoun?
Weaponising the Grasp-at-a-Distance spell
What were wait-states, and why was it only an issue for PCs?
Why did Bronn offer to be Tyrion Lannister's champion in trial by combat?
“Since the train was delayed for more than an hour, passengers were given a full refund.” – Why is there no article before “passengers”?
Can I ask an author to send me his ebook?
What is the definining line between a helicopter and a drone a person can ride in?
How to keep bees out of canned beverages?
Magento 2, force login on product and catalog pages
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Force login to access catalog and product pagesMagento 2, force login on specific product and specific catalog pagesIs there a way to create a login portal to access a specific store (set as a subdomain)?Force login to access catalog and product pagesHow can I use a custom URL for an Admin Menu Item?Pull custom customer attribute and send in email? Magento 2.2Force customer to log in when visiting a specific category Magento 2Magento 2, force login on specific product and specific catalog pagesForce login to catalog and product pages in magento 2 custom themeProduct Final Price returns 0 instead a real valueMagento 2 - I need to create simple custom report with date range and other column filter (filter should be outside of grid)Magento 2: Product List Not Showing in Catalog and Search
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have found this module :
https://github.com/bitExpert/magento2-force-login
and this topic :
Force login to access catalog and product pages
but I still think there must be a simpler solution, to just limit access to product and catalog pages.
What would be the optimal point of departure for such a module?
Thanks guys!
magento2 login
add a comment |
I have found this module :
https://github.com/bitExpert/magento2-force-login
and this topic :
Force login to access catalog and product pages
but I still think there must be a simpler solution, to just limit access to product and catalog pages.
What would be the optimal point of departure for such a module?
Thanks guys!
magento2 login
are you mentionedproduct details page
andcatalog category page
– Rajkumar .E
Aug 7 '17 at 13:19
yes, siple solution, without any Admin functionality in the backend.
– Supersonic
Aug 7 '17 at 13:24
add a comment |
I have found this module :
https://github.com/bitExpert/magento2-force-login
and this topic :
Force login to access catalog and product pages
but I still think there must be a simpler solution, to just limit access to product and catalog pages.
What would be the optimal point of departure for such a module?
Thanks guys!
magento2 login
I have found this module :
https://github.com/bitExpert/magento2-force-login
and this topic :
Force login to access catalog and product pages
but I still think there must be a simpler solution, to just limit access to product and catalog pages.
What would be the optimal point of departure for such a module?
Thanks guys!
magento2 login
magento2 login
asked Aug 7 '17 at 13:11
SupersonicSupersonic
4721627
4721627
are you mentionedproduct details page
andcatalog category page
– Rajkumar .E
Aug 7 '17 at 13:19
yes, siple solution, without any Admin functionality in the backend.
– Supersonic
Aug 7 '17 at 13:24
add a comment |
are you mentionedproduct details page
andcatalog category page
– Rajkumar .E
Aug 7 '17 at 13:19
yes, siple solution, without any Admin functionality in the backend.
– Supersonic
Aug 7 '17 at 13:24
are you mentioned
product details page
and catalog category page
– Rajkumar .E
Aug 7 '17 at 13:19
are you mentioned
product details page
and catalog category page
– Rajkumar .E
Aug 7 '17 at 13:19
yes, siple solution, without any Admin functionality in the backend.
– Supersonic
Aug 7 '17 at 13:24
yes, siple solution, without any Admin functionality in the backend.
– Supersonic
Aug 7 '17 at 13:24
add a comment |
1 Answer
1
active
oldest
votes
If you want to force customer to login:
Product Details Page:
You need to overwrite Controller in module-catalog/Controller/Product/View.php
to force customer to login in product details page.
Catalog Category Page:
You need to overwrite Controller in module-catalog/Controller/Category/View.php
to force customer to login in catalog category page.
Then, add customSession to Dependency injection check if customer is logged in or not. if logged in then redirect to product details page or catalog category page. Otherwise its redirect to customer login page.
Create a di.xml in vendor/module/etc/di.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCatalogControllerProductView" type="VendorModuleControllerRewriteProductView" />
</config>
Use Product Details Page: Create View.php file VendorModuleControllerRewriteProduct
in this path.
<?php
namespace VendorModuleControllerRewriteProduct;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkViewResultPageFactory;
class View extends MagentoCatalogControllerProductView
/**
* @return MagentoFrameworkControllerResultRedirect
Same as overwrite catalog category page. Let me know if you have issue.
i updated my answer for product details page same as change catalog category page.
– Rajkumar .E
Aug 7 '17 at 14:01
Do I need to create a moodule.xml file?
– Supersonic
Aug 7 '17 at 14:40
If you want to do this via custom module, you need module.xml , other wise you use any other existing module, not core module.
– Rajkumar .E
Aug 8 '17 at 5:24
Hi Rajkumar! So far I have no issues. I have managed to make the same for Category pages. Thanks a lot!
– Supersonic
Aug 8 '17 at 9:09
but how to verify that your solution is just for a specific Category?? thanks in advance
– Developper Magento
Aug 28 '18 at 9:39
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%2f188202%2fmagento-2-force-login-on-product-and-catalog-pages%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
If you want to force customer to login:
Product Details Page:
You need to overwrite Controller in module-catalog/Controller/Product/View.php
to force customer to login in product details page.
Catalog Category Page:
You need to overwrite Controller in module-catalog/Controller/Category/View.php
to force customer to login in catalog category page.
Then, add customSession to Dependency injection check if customer is logged in or not. if logged in then redirect to product details page or catalog category page. Otherwise its redirect to customer login page.
Create a di.xml in vendor/module/etc/di.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCatalogControllerProductView" type="VendorModuleControllerRewriteProductView" />
</config>
Use Product Details Page: Create View.php file VendorModuleControllerRewriteProduct
in this path.
<?php
namespace VendorModuleControllerRewriteProduct;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkViewResultPageFactory;
class View extends MagentoCatalogControllerProductView
/**
* @return MagentoFrameworkControllerResultRedirect
Same as overwrite catalog category page. Let me know if you have issue.
i updated my answer for product details page same as change catalog category page.
– Rajkumar .E
Aug 7 '17 at 14:01
Do I need to create a moodule.xml file?
– Supersonic
Aug 7 '17 at 14:40
If you want to do this via custom module, you need module.xml , other wise you use any other existing module, not core module.
– Rajkumar .E
Aug 8 '17 at 5:24
Hi Rajkumar! So far I have no issues. I have managed to make the same for Category pages. Thanks a lot!
– Supersonic
Aug 8 '17 at 9:09
but how to verify that your solution is just for a specific Category?? thanks in advance
– Developper Magento
Aug 28 '18 at 9:39
add a comment |
If you want to force customer to login:
Product Details Page:
You need to overwrite Controller in module-catalog/Controller/Product/View.php
to force customer to login in product details page.
Catalog Category Page:
You need to overwrite Controller in module-catalog/Controller/Category/View.php
to force customer to login in catalog category page.
Then, add customSession to Dependency injection check if customer is logged in or not. if logged in then redirect to product details page or catalog category page. Otherwise its redirect to customer login page.
Create a di.xml in vendor/module/etc/di.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCatalogControllerProductView" type="VendorModuleControllerRewriteProductView" />
</config>
Use Product Details Page: Create View.php file VendorModuleControllerRewriteProduct
in this path.
<?php
namespace VendorModuleControllerRewriteProduct;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkViewResultPageFactory;
class View extends MagentoCatalogControllerProductView
/**
* @return MagentoFrameworkControllerResultRedirect
Same as overwrite catalog category page. Let me know if you have issue.
i updated my answer for product details page same as change catalog category page.
– Rajkumar .E
Aug 7 '17 at 14:01
Do I need to create a moodule.xml file?
– Supersonic
Aug 7 '17 at 14:40
If you want to do this via custom module, you need module.xml , other wise you use any other existing module, not core module.
– Rajkumar .E
Aug 8 '17 at 5:24
Hi Rajkumar! So far I have no issues. I have managed to make the same for Category pages. Thanks a lot!
– Supersonic
Aug 8 '17 at 9:09
but how to verify that your solution is just for a specific Category?? thanks in advance
– Developper Magento
Aug 28 '18 at 9:39
add a comment |
If you want to force customer to login:
Product Details Page:
You need to overwrite Controller in module-catalog/Controller/Product/View.php
to force customer to login in product details page.
Catalog Category Page:
You need to overwrite Controller in module-catalog/Controller/Category/View.php
to force customer to login in catalog category page.
Then, add customSession to Dependency injection check if customer is logged in or not. if logged in then redirect to product details page or catalog category page. Otherwise its redirect to customer login page.
Create a di.xml in vendor/module/etc/di.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCatalogControllerProductView" type="VendorModuleControllerRewriteProductView" />
</config>
Use Product Details Page: Create View.php file VendorModuleControllerRewriteProduct
in this path.
<?php
namespace VendorModuleControllerRewriteProduct;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkViewResultPageFactory;
class View extends MagentoCatalogControllerProductView
/**
* @return MagentoFrameworkControllerResultRedirect
Same as overwrite catalog category page. Let me know if you have issue.
If you want to force customer to login:
Product Details Page:
You need to overwrite Controller in module-catalog/Controller/Product/View.php
to force customer to login in product details page.
Catalog Category Page:
You need to overwrite Controller in module-catalog/Controller/Category/View.php
to force customer to login in catalog category page.
Then, add customSession to Dependency injection check if customer is logged in or not. if logged in then redirect to product details page or catalog category page. Otherwise its redirect to customer login page.
Create a di.xml in vendor/module/etc/di.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCatalogControllerProductView" type="VendorModuleControllerRewriteProductView" />
</config>
Use Product Details Page: Create View.php file VendorModuleControllerRewriteProduct
in this path.
<?php
namespace VendorModuleControllerRewriteProduct;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkViewResultPageFactory;
class View extends MagentoCatalogControllerProductView
/**
* @return MagentoFrameworkControllerResultRedirect
Same as overwrite catalog category page. Let me know if you have issue.
edited May 8 '18 at 14:32
diazwatson
1,59411425
1,59411425
answered Aug 7 '17 at 13:48
Rajkumar .ERajkumar .E
1,75051645
1,75051645
i updated my answer for product details page same as change catalog category page.
– Rajkumar .E
Aug 7 '17 at 14:01
Do I need to create a moodule.xml file?
– Supersonic
Aug 7 '17 at 14:40
If you want to do this via custom module, you need module.xml , other wise you use any other existing module, not core module.
– Rajkumar .E
Aug 8 '17 at 5:24
Hi Rajkumar! So far I have no issues. I have managed to make the same for Category pages. Thanks a lot!
– Supersonic
Aug 8 '17 at 9:09
but how to verify that your solution is just for a specific Category?? thanks in advance
– Developper Magento
Aug 28 '18 at 9:39
add a comment |
i updated my answer for product details page same as change catalog category page.
– Rajkumar .E
Aug 7 '17 at 14:01
Do I need to create a moodule.xml file?
– Supersonic
Aug 7 '17 at 14:40
If you want to do this via custom module, you need module.xml , other wise you use any other existing module, not core module.
– Rajkumar .E
Aug 8 '17 at 5:24
Hi Rajkumar! So far I have no issues. I have managed to make the same for Category pages. Thanks a lot!
– Supersonic
Aug 8 '17 at 9:09
but how to verify that your solution is just for a specific Category?? thanks in advance
– Developper Magento
Aug 28 '18 at 9:39
i updated my answer for product details page same as change catalog category page.
– Rajkumar .E
Aug 7 '17 at 14:01
i updated my answer for product details page same as change catalog category page.
– Rajkumar .E
Aug 7 '17 at 14:01
Do I need to create a moodule.xml file?
– Supersonic
Aug 7 '17 at 14:40
Do I need to create a moodule.xml file?
– Supersonic
Aug 7 '17 at 14:40
If you want to do this via custom module, you need module.xml , other wise you use any other existing module, not core module.
– Rajkumar .E
Aug 8 '17 at 5:24
If you want to do this via custom module, you need module.xml , other wise you use any other existing module, not core module.
– Rajkumar .E
Aug 8 '17 at 5:24
Hi Rajkumar! So far I have no issues. I have managed to make the same for Category pages. Thanks a lot!
– Supersonic
Aug 8 '17 at 9:09
Hi Rajkumar! So far I have no issues. I have managed to make the same for Category pages. Thanks a lot!
– Supersonic
Aug 8 '17 at 9:09
but how to verify that your solution is just for a specific Category?? thanks in advance
– Developper Magento
Aug 28 '18 at 9:39
but how to verify that your solution is just for a specific Category?? thanks in advance
– Developper Magento
Aug 28 '18 at 9:39
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%2f188202%2fmagento-2-force-login-on-product-and-catalog-pages%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
are you mentioned
product details page
andcatalog category page
– Rajkumar .E
Aug 7 '17 at 13:19
yes, siple solution, without any Admin functionality in the backend.
– Supersonic
Aug 7 '17 at 13:24