Jump to content

Block Layered Navigation: To change the default layout of to collapse all categories


Recommended Posts

  • 1 month later...

additionaly, if someone want to show for example 3 first filters, and make the rest visible by clicking "show more filters'

in root/themes/YOURTHEME/modules/blocklayered/blocklayered.tpl (if you don't have that file , use root/modules/blocklayered/blocklayered.tpl

about line 85 find <div>

replace with

<div{if $filter@iteration > 3}{$count =  $filter@iteration} class="morethan3"{/if}>

about line 240 find </form>
add under

<a id="allfilters" onclick="$('.morethan3').attr('style', 'display:block !important');$(this).hide();">Więcej filtrów</a>

add in root/themes/YOURTHEME/css/global.css at the end

.morethan3{display:none!important;}
Link to comment
Share on other sites

  • 2 months later...

In latest PS 1.5.6, about line 307 there's a piece of code, maybe it was included by the developers after this topic's feedback? It reads:

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();
	});
}

What do exactly we have to change to make default the collapsed view?

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

  • 10 months later...

 

workin on PS 1.5 (I think in 1.4 should be very similar)

modules/blocklayered/blocklayered.js

about line 30 find:

openCloseFilter();

add under:

$('#layered_form span.layered_close a').trigger('click');

The result is positive, but the Ajax request returns all into place, how to fix it?

Link to comment
Share on other sites

  • 7 months later...
  • 6 months later...
  • 4 weeks later...

Put in footer.tpl in your theme the following:

$(window).load(function() {
					$('#layered_form span.layered_close a').trigger('click');
				});

Explication: when page is fully loaded, it will perform the trigger, which "clicks" on all the minus signs that collapses the blocks.

And then try accessing a category (with "#" at the end). It will work, just like it worked for me! :)

Edited by rraulinio (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 3 months later...
  • 4 weeks later...
  • 1 month later...
  • 3 years later...

Hello,

 

Just solved it without adding anything to the footer.tpl

ok, in blocklayered.tpl i modified the following lines

                        <div class="layered_subtitle_heading">
                            <h2 class="title_block">{$filter.name|escape:'html':'UTF-8'}</h2>
                            <span class="layered_close">
                            	<a href="#" data-rel="ul_layered_{$filter.type}_{$filter.id_key}"></a>
                            </span>
						</div>
						<ul id="ul_layered_{$filter.type}_{$filter.id_key}" class="col-lg-12 layered_filter_ul{if isset($filter.is_color_group) && $filter.is_color_group} color-group{/if}">
						

to

                        <div class="layered_subtitle_heading">
                            <h2 class="title_block">{$filter.name|escape:'html':'UTF-8'}</h2>
                            <span class="layered_close">
                            	<a href="#" data-rel="ul_layered_{$filter.type}_{$filter.id_key}">&lt;</a>
                            </span>
						</div>
						<ul style="display: none" id="ul_layered_{$filter.type}_{$filter.id_key}" class="col-lg-12 layered_filter_ul{if isset($filter.is_color_group) && $filter.is_color_group} color-group{/if}">
						

1. inserted the &lt; into the address, without this the icon remains - and you have to click twice to open up the menu

2. added style="display: none"  - without this you have to click twice to open up the menu

 

 

 

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