Jump to content

How To Change Layered Navigation


All22
 Share

Recommended Posts

Hi,

 

I want to start block layered navigation with all filter tabs closed, not open as it is default.

 

Can someone advise me how to change the code? (I was trying but it's pretty large...)

 

Thank you :)

Share this post


Link to post
Share on other sites

Hi

 

I have the same request. Can anybody help? I think the code that controls the function is this:

 

 

function openCloseFilter()

{

$('#layered_form span.layered_close a').live('click', function(e)

{

if ($(this).html() == '<')

{

$('#'+$(this).attr('rel')).show();

$(this).html('v');

$(this).parent().removeClass('closed');

}

else

{

$('#'+$(this).attr('rel')).hide();

$(this).html('<');

$(this).parent().addClass('closed');

}

 

e.preventDefault();

});

}

Share this post


Link to post
Share on other sites

<p>Yes, that is the function.</p>

<p> </p>

<p>I tried this:</p>

<p> </p>

<p> </p>

<div>function setClosed()</div>

<div>{</div>

<div>$('#'+'#layered_form span.layered_close a'.attr('rel')).hide();</div>

<div>$('#layered_form span.layered_close a').html('&lt;');</div>

<div>$('#layered_form span.layered_close').addClass('closed');</div>

<div>}</div>

<div> </div>

<div>but doesn't work properly. First statement is wrong, if commented out, the rest works.</div>

<p> </p>

<p> </p>

<p>I tried this:</p>

<p> </p>

<p> </p>

<div>function setClosed()</div>

<div>{</div>

<div>$('#'+'#layered_form span.layered_close a'.attr('rel')).hide();</div>

<div>$('#layered_form span.layered_close a').html('&lt;');</div>

<div>$('#layered_form span.layered_close').addClass('closed');</div>

<div>}</div>

<div> </div>

<div>Function is called</div>

<div>setClosed();</div>

<div> </div>

<div>inserted before</div>

<div>cancelFilter();</div>

<div>openCloseFilter();</div>

<div> </div>

<div>but it doesn't work properly. First statement is wrong, if commented out, the rest works.</div>

<div> </div>

<div>If I change that wrong first line with:</div>

<div> </div>

<div>$('#layered_block_left ul').hide();</div>

<div> </div>

<div>it works with all filters closed, but after choosing one everything opens... :-(</div>

<div> </div>

<div>Anybody to help?</div>

 

Share this post


Link to post
Share on other sites

<p>Yes, that is the function.</p>

<p> </p>

<p>I tried this:</p>

<p> </p>

<p> </p>

<div>function setClosed()</div>

<div>{</div>

<div>$('#'+'#layered_form span.layered_close a'.attr('rel')).hide();</div>

<div>$('#layered_form span.layered_close a').html('&lt;');</div>

<div>$('#layered_form span.layered_close').addClass('closed');</div>

<div>}</div>

<div> </div>

<div>but doesn't work properly. First statement is wrong, if commented out, the rest works.</div>

<p> </p>

<p> </p>

<p>I tried this:</p>

<p> </p>

<p> </p>

<div>function setClosed()</div>

<div>{</div>

<div>$('#'+'#layered_form span.layered_close a'.attr('rel')).hide();</div>

<div>$('#layered_form span.layered_close a').html('&lt;');</div>

<div>$('#layered_form span.layered_close').addClass('closed');</div>

<div>}</div>

<div> </div>

<div>Function is called</div>

<div>setClosed();</div>

<div> </div>

<div>inserted before</div>

<div>cancelFilter();</div>

<div>openCloseFilter();</div>

<div> </div>

<div>but it doesn't work properly. First statement is wrong, if commented out, the rest works.</div>

<div> </div>

<div>If I change that wrong first line with:</div>

<div> </div>

<div>$('#layered_block_left ul').hide();</div>

<div> </div>

<div>it works with all filters closed, but after choosing one everything opens... :-(</div>

<div> </div>

<div>Anybody to help?</div>

 

Hi

 

did you manage to find a fix for this? I have looked on google and nobody seems to know how to achieve this.

Share this post


Link to post
Share on other sites

  • 1 month later...

No, not yet... :-(

 

I just tried to post here, something went bad with formatting... I managed to have it closed, but after opening one item, everything was open again...

 

This weekend I should have some time for it, so i will try again...

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 2 months later...

Hi all!

 

I managed to fix this by changing the original function by this (in blocklayered.js):

 

 

function openCloseFilter()

{

$('#layered_block_left ul').hide();//NEW

$('#layered_form span.layered_close a').html('<');//NEW

$('#layered_form span.layered_close').addClass('closed');//NEW

$('#layered_form span.layered_close a').live('click', function(e)

{

if ($(this).html() == '<')

{

$('#'+$(this).attr('rel')).show();

$(this).html('v');

$(this).parent().removeClass('closed');

}

else

{

$('#'+$(this).attr('rel')).hide();

$(this).html('<');

$(this).parent().addClass('closed');

}

 

e.preventDefault();

});

}

 

Where the 3 "NEW" lines are the same as All22.

 

No more than this. So thx All22 for your 3 lines codes which I just placed to the correct area (at least it works on my prestashop version 1.5.4.1 and his latest layered module).

 

Cheers everyone :-D

 

Netgadget

 

Edit: Nope sorry it didn't work...as soon as we apply a filter or even move to another category, the layered will open completely...If someone would have an idea to fix this..it would be amazing!!

Edited by Netgadget (see edit history)

Share this post


Link to post
Share on other sites

  • 3 months 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
 Share

×
×
  • Create New...

Important Information

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