Jump to content

Add login form when category is hidden to visitors


Recommended Posts

Hello,

I have unchecked "Visitors" and "Invited" from one category, in order to restrict the access to the product of one category only to logged in users. This is working perfectly.

I get the nice message "you don't have access to this category"...

I would like to add below the login form in order to prompt the user to log in, them display the category page with the parameter "back"...

So turn this (current situation) :

1.png.0510fe47d76257b1efbf8af7a5da7bfc.png

Into this  (objective) :

2.png.96c44e83eb02865e770d70b43d5d01cd.png

How can I do this ?

I tried to attach the hook login on some hook, but it is displaying on all pages 😞

I can modify the template authentication.tpl by hardcoding this one category, but hard to maintain in the future (especially if other categroies are marked hidden)

I tried to used Smarty variable of that page, but I could not found the smarty variable that says "this category is not accessible"  in order to adapt the template.... the only variable I found in smarty was

$notifications 	Array (2)
value => Array (4)
  error => Array (1)
    0 => "vous n'avez pas accès à cette catégorie"

But doing a "if" based on a translated text is bad practice.... I would like to do something as {if $page.is_only_for_logged_users and $user.not_logged_in } insert login block {/if}

Thanks !

Link to comment
Share on other sites

  • 2 weeks later...

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