Jump to content

Private category redirection to login for not logged users


Recommended Posts

I need to add a direct link from the main website (worpress) to the main category of my shop.
This main category and all subcategories are available only to registred users.

If I'm not logged in and access one of those "protected" categories i have an error message saying i cant access this category.

Could it be possible to be redirected automatically to the login/register page ? (index.php?controller=authentication&back=my-account ) ???

Thanks

Link to comment
Share on other sites

I found this solution : http://www.prestashop.com/forums/topic/220431-solved-force-redirect-to-login-page/ perfect for 1.6

 

I founded also this version for 1.4 http://blog.manit4c.com/2014/02/17/rediriger-vers-la-page-de-connexion-sur-les-categorie-privee-prestashop/ 

 

In this page i found this code that will add a message to the user arriving on the login page...but it doesnt work on 1.6.. 
Any idea to make it work?


<?php

class AuthController extends AuthControllerCore
{
	public function preProcess()
	{
		$path = pathinfo(Tools::getValue("back"));
		if($path['filename']=="category")
			$this->errors[] = Tools::displayError('Vous devez vous identifier pour accéder à cette catégorie');
		parent::preProcess();
	}

}

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...