In Prestashop, if category is only assigned to customers (loggedin users) then you will see an error message on that category Page that state:
'You do not have access to this category.'
To Force your users to redirect at login page, you have to modify your
CategoryController.php
file.Copy file from
controllers/front/CategoryController.php
and paste intooverride/controllers/front/CategoryController.php
Now, inside init function find
if (!$this->category->checkAccess($this->context->customer->id)) {Remove all code inside this condition and write below code to redirect it to myaccount page:
Tools::redirect('index.php?controller=authentication?back=my-account'); if (!$this->category->checkAccess($this->context->customer->id)) { Tools::redirect('index.php?controller=authentication?back=my-account'); }
0 Comments