Jump to content

1.6.1.11 Check if user is logged.


Recommended Posts

Good Morning,

 

Currently trying to dig my way around Prestashop, 1.6.1.11. I understand it a little bit but I wouldn't say I'm experienced.

I'm after a way to check if the user is logged in, which I have found examples for this elsewhere using .tpl files. However I need to action a response if the user is not logged in The thread I found is the reverse of which.

 

After considerable digging I was able to find and edit this code here, but I'm unable to get it to fire;

<!-- Check Login -->
<div id="check-log">
  {if $logged}

    <a href=".." id="Logout" />Logout</a>

  {else}

    <a href=".." id="Login" />Login</a>

  {/if}
</div>

I currently have this placed within my 'header.tpl'.

 

As a bit of background as to what it is specifically that I'm trying to achieve is to display a full width / height image with a sign-in element layered over top within the center. I want to essentially give the user only one element to interact with and use to sign in.

 

I hope I have explained myself well enough, any help is appreciated. I'll keep looking and if I find anything useful I'll post it here.

 

:ph34r:

 

Regards,

- B

Edited by Beaniie (see edit history)
Link to comment
Share on other sites

  • 8 months later...
On 2/21/2017 at 0:01 PM, Beaniie said:

Turns out a simple syntax error was the culprit. All works perfectly.

 

:ph34r:

 

Regards,

-B

What was your problem?

Im trying something like that but the text never changes...
Here is what i have.

It always shows create account and login text
 

 {if $logged}
	  <a style="padding-right: 10px; float: right"
        class="logout"
        href="{$logout_url}"
        rel="nofollow"
      >
        {l s='Sign out' d='Shop.Theme.Actions'}
      </a>
      <a 
        class="account"
        href="{$my_account_url}"
        title="{l s='View my customer account' d='Shop.Theme.CustomerAccount'}"
        rel="nofollow"
      >
        {$customerName}
      </a>
    {else}
      <a style="padding-right: 15px; float: right"
        class="login"
        href="inicio-de-sessao"
        title="{l s='' d='Shop.Theme.CustomerAccount'}"
        rel="nofollow"
      >
        {l s='Sign in' d='Shop.Theme.Actions'}
      </a>
        <a style="padding-right: 15px; float: right"
        class="no-account"
        href="inicio-de-sessao?create_account=1"
        title="{l s='' d='Shop.Theme.CustomerAccount'}"
        rel="nofollow"
      >
        {l s='Criar Conta' d='Shop.Theme.Actions'}
      </a>
    {/if}

 

Link to comment
Share on other sites

  • 1 year 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...