adriano.matos Posted October 22, 2015 Share Posted October 22, 2015 Hello PrestaShop world! We have some items that we want to put in the “outlet” area. I already found out how to put that “area” reserved to registered costumers. But it gives an error and i wanted to edited the message so it can show other information / redirect to the login page. For now, i could only limit the access to the category. But i wanted to redirect to the login page. How to explain: we wanted that when the costumer goes to the “outlet” area, only persons with account can see. So, when someone clicks on “outlet”, they receive a message saying “you need to login to access this category” and shows the login area. There is a screenshot to the "error"/message that shows now. And an image of what i wanted to show when clicking on a "customer only" area. How can we do this? Any thoughts? Best regards! Link to comment Share on other sites More sharing options...
gabdara Posted October 26, 2015 Share Posted October 26, 2015 Through BO settings it's not possible yet, but you could make a redirect to authentication inside the category controller where the access is checked. See this line: https://github.com/PrestaShop/PrestaShop/blob/1.6.1.x/controllers/front/CategoryController.php#L116 You could make an override and inside that if statement add: Tools::redirectLink($this->context->link->getPageLink('authentication')); 1 Link to comment Share on other sites More sharing options...
adriano.matos Posted October 26, 2015 Author Share Posted October 26, 2015 Through BO settings it's not possible yet, but you could make a redirect to authentication inside the category controller where the access is checked. See this line: https://github.com/PrestaShop/PrestaShop/blob/1.6.1.x/controllers/front/CategoryController.php#L116 You could make an override and inside that if statement add: Tools::redirectLink($this->context->link->getPageLink('authentication')); Thank you! I will try that and give a feedback on that solution! Thank you very much! Best regards, Adriano Link to comment Share on other sites More sharing options...
adriano.matos Posted October 26, 2015 Author Share Posted October 26, 2015 Through BO settings it's not possible yet, but you could make a redirect to authentication inside the category controller where the access is checked. See this line: https://github.com/PrestaShop/PrestaShop/blob/1.6.1.x/controllers/front/CategoryController.php#L116 You could make an override and inside that if statement add: Tools::redirectLink($this->context->link->getPageLink('authentication')); Thank you for the tip! It worked just like magic! Thanks a lot. Not wanting to push my luck, is there any way to display a message besides being redirected? Like: "please login to access that category" or something like that? BR, Adriano Link to comment Share on other sites More sharing options...
gabdara Posted October 29, 2015 Share Posted October 29, 2015 To the redirected link you could add the category name. Tools::redirectLink($this->context->link->getPageLink('authentication').'?category_name='. urlencode($this->category->name)); Then in authentication.tpl of your theme under the h1 tag add: {if isset($smarty.get.category_name)} <div class="alert alert-danger">{l s='Please login to access the category: %s' sprintf=$smarty.get.category_name|escape}</div> {/if} 1 Link to comment Share on other sites More sharing options...
adriano.matos Posted October 29, 2015 Author Share Posted October 29, 2015 To the redirected link you could add the category name. Tools::redirectLink($this->context->link->getPageLink('authentication').'?category_name='. urlencode($this->category->name)); Then in authentication.tpl of your theme under the h1 tag add: {if isset($smarty.get.category_name)} <div class="alert alert-danger">{l s='Please login to access the category: %s' sprintf=$smarty.get.category_name|escape}</div> {/if} Thank you very much! It works very nice! Awesome! Best regards! Adriano Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now