Jump to content

[Solved] Hide left column unless user is logged in


Noorlander
 Share

Recommended Posts

Dear all,

 

can someone pls assist with the following requirement:

Unless a user is logged in, I would want the left column to be hidden.

 

I have searched the forum and found several pieces of the puzzle involving "lefthook", "grid_5", etc

but i have been unable to get the solution set up...

 

note, i do have a custom theme which actually only has 2 columns (left and middle obviously).

Using the latest prestashop version.

 

thanks

Edited by Noorlander (see edit history)

Share this post


Link to post
Share on other sites

in the header.tpl file, where you've got definition of the left column use this code:

{if $logged}
   <div id="left_column" class="column grid_2 alpha">
 {$HOOK_LEFT_COLUMN}
   </div>
{/if}

 

use the same if condition (with {else}) to define the correct grid value for the center column:

 

<div id="center_column" class="{if $logged}grid_5{else}grid_7{/if}">

Share this post


Link to post
Share on other sites

Hey Vekia,

 

i actually ran into an issue whereby the account-creation page just wont load anymore.

It has something to do with authentification.tpl. where the create account form has to load in the div: #center_column (as specified in line 120), but this div doesnt exist...

 

I got it to work partially by updating the authentication.tpl and adding <div id="center_column"></div> at line 153 (just above the form section) as described in this post: http;//www.prestashop.com/forums/topic/198686-technical-error-unable-to-load-form-details-error-thrown-object-object-text-status-parsererr/page__p__1280266__hl__error thrown object__fromsearch__1#entry1280266

 

Unfortunately, it now shows both the my-account and account-creation forms on the same page. see https://www.ice-cont...ccount-creation

 

Would you have any idea on how to fix this??

 

thanks again!!

Edited by Noorlander (see edit history)

Share this post


Link to post
Share on other sites

This is what i have done to resolve the lasst issue: It has something to do with authentification.tpl. where the create account form has to load in the div: #center_column (as specified in line 120), but this div doesnt exist...

 

Open authentication.tpl

1) Insert "<div id="center_column"></div>" at line 153 (just above the form section).

2) quote out the function to fade in/fade out the account details form: lines 120 - 126 like this:

 

 

// adding a div to display a transition

//$('#center_column').html('<div id="noSlide">'+$('#center_column').html()+'</div>');

//$('#noSlide').fadeOut('slow', function(){

//$('#noSlide').html(jsonData.page);

// update the state (when this file is called from AJAX you still need to update the state)

//bindStateInputAndUpdate();

//$(this).fadeIn('slow', function(){

//document.location = '#account-creation';

 

 

Then it works fine for me (on PrestaShop 1.5.4.1)

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More