Jump to content

Edit History

wilebaldo

wilebaldo

I have to do this also to my store with only one CMS page, and this was the solution for me.

In prestashop 1.6 modify the file CmsController.php just above this line:

parent::initContent();

I add this code

if (!$this->context->customer->isLogged() && $this->cms->id == 6) {
        Tools::redirect('index.php?controller=authentication');
        }

the first line is a conditional to check if the customer is not logged and if the page CMS is they required is the one I need to protect for only customer registered in my case is the page 6.

in cas the conditions is true, will be redirected to the login page.

Comparing with the code made more above for other was not working because is missing the double "&&" and the "$this->cms->" and also the open and close { } for the if conditional, with this everything is working fine.

wilebaldo

wilebaldo

I have to do this also to my store with only one CMS page, and this was the solution for me.

In prestashop 1.6 modify the file CmsController.php just above this line:

parent::initContent();

I add this code

if (!$this->context->customer->isLogged() && $this->cms->id == 6) {
        Tools::redirect('index.php?controller=authentication');
        }

the first line is a conditional to check if the customer is not logged and if the page CMS is they required is the one I need to protect for only customer registered in my case is the page 6.

in cas the conditions is true, will be redirected to the login page.

Comparing with the code made more above for other was not working because is missing the double "&&" and the "$this->cms->" from the code, with this everything is working fine.

wilebaldo

wilebaldo

I have to do this also to my store with only one CMS page, and this was the solution for me.

In prestashop 1.6 modify the file CmsController.php just above this line:

parent::initContent();

I add this code

if (!$this->context->customer->isLogged() && $this->cms->id == 6) {
        Tools::redirect('index.php?controller=authentication');
        }

the first line is a conditional to check if the customer is not logged and if the page CMS is they required is the one I need to protect for only customer registered in my case is the page 6.

in cas the conditions is true, will be redirected to the login page.

Comparing with the code made more above for other was not working because is missing the double "&&" and the "$this->cms->" from the code, with this everything is working fine.

×
×
  • Create New...