Jump to content

Multistore Force redirect to login page for only one store


Buaha

Recommended Posts

Hi,

i have multistore and i want one of this shop to be private shop. I found this code and its force user to login before view shop, and its work but for both shops. How i can do this.

classes\controller\FrontController.php

Find the function
public function init()

Past the below mentioned code after
parent::init();


if (!$this->context->customer->isLogged() && $this->php_self != 'authentication' && $this->php_self != 'password')
Tools::redirect('index.php?controller=authentication?back=my-account'); 

 

Thanks

Link to comment
Share on other sites

you would need to add something like this (note: not tested)

if (int)$this->context->shop->getContextShopID(); == 'shop number'
do this
else
do that

or you could splurge on a module that is multiishop compliant module, here is one but there are others

http://www.prestashop.com/forums/topic/149628-module-hide-prices-private-shop-authorized-client-shopping-only/

Link to comment
Share on other sites

  • 4 weeks later...

Hi

thanks for your replay.

Could you tell me how this code should be?

can i just delate else parametr do do nothing?

something like this?

if (int)$this->context->shop->getContextShopID(); == '2'
{
if (!$this->context->customer->isLogged() && $this->php_self != 'authentication' && $this->php_self != 'password')
Tools::redirect('index.php?controller=authentication?back=my-account');
 }
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...