NemoPS Posted February 11, 2015 Share Posted February 11, 2015 Hey fellows! Just wrote a new tut, seeing this is where many people on the forums have trouble: how to properly hook the layered navigation to the center column (category page, of course) http://nemops.com/prestashop-layered-navigation-block-center-column/#.VNsblPmjOr1 cheers! Link to comment Share on other sites More sharing options...
SirupB Posted October 5, 2015 Share Posted October 5, 2015 (edited) Thats great and acutally helped me to move the layered navigation block to the center. However two things are not working now: I cannot click the x to remove the filters again. Nothing happens (But I think I can fix it, it is a js error) JS Error: cannot read property 'search' of undefined Edited October 6, 2015 by SirupB (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted October 7, 2015 Author Share Posted October 7, 2015 Can you screen the error, expanded with the line that breaks it? Link to comment Share on other sites More sharing options...
SirupB Posted October 9, 2015 Share Posted October 9, 2015 (edited) Thank you for your answer. Sure, I should give better explanation about the error. I followed exactly the instructions from the above link. It worked like a charm. Setting a filter works perfectly. However when I try to click the X to cancel a filter, the error is thrown. Here is a screenshot: The error is thrown in the cancelFilter Code of "blocklayered.js". Error is thrown at: if ($(this).data("rel").search(/_slider$/) > 0). I tried to change the regex /_slider$/ to just / / but the same error happens. I also tried to choose a different variable instead of "rel", for example download. Here is the function: function cancelFilter() { $(document).on('click', '#enabled_filters a', function(e){ if ($(this).data("rel").search(/_slider$/) > 0) { if ($('#'+$(this).data('rel')).length) { $('#'+$(this).data('rel')).slider('values' , 0, $('#'+$(this).data('rel')).slider('option' , 'min' )); $('#'+$(this).data('rel')).slider('values' , 1, $('#'+$(this).data('rel')).slider('option' , 'max' )); $('#'+$(this).data('rel')).slider('option', 'slide')(0,{values:[$('#'+$(this).data('rel')).slider( 'option' , 'min' ), $('#'+$(this).data('rel')).slider( 'option' , 'max' )]}); } else if($('#'+$(this).data('rel').replace(/_slider$/, '_range_min')).length) { $('#'+$(this).data('rel').replace(/_slider$/, '_range_min')).val($('#'+$(this).data('rel').replace(/_slider$/, '_range_min')).attr('limitValue')); $('#'+$(this).data('rel').replace(/_slider$/, '_range_max')).val($('#'+$(this).data('rel').replace(/_slider$/, '_range_max')).attr('limitValue')); } } else { if ($('option#'+$(this).data('rel')).length) $('#'+$(this).data('rel')).parent().val(''); else { $('#'+$(this).data('rel')).attr('checked', false); $('.'+$(this).data('rel')).attr('checked', false); $('#layered_form input[type=hidden][name='+$(this).data('rel')+']').remove(); } } reloadContent(true); e.preventDefault(); }); } I set a breakpoint at that line, and here is my this object before the error is thrown (seems "rel" exists?) Local e: n.Event this: a accessKey: "" attributes: NamedNodeMap baseURI: "http://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/de/21-oolong-tee#/blatttyp-ganzblatt_gerollt" charset: "" childElementCount: 1 childNodes: NodeList[1] children: HTMLCollection[1] classList: DOMTokenList[0] className: "" clientHeight: 18 clientLeft: 0 clientTop: 0 clientWidth: 11 contentEditable: "inherit" coords: "" dataset: DOMStringMap dir: "" download: "" draggable: true firstChild: i.icon-remove firstElementChild: i.icon-remove hash: "" hidden: false host: "XXXXXXXXXXXXXXXXXXXXXXXXX" hostname: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" href: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/de/21-oolong-tee#" hreflang: "" id: "" innerHTML: "<i class="icon-remove"></i>" innerText: "" isContentEditable: false lang: "" lastChild: i.icon-remove lastElementChild: i.icon-remove localName: "a" name: "" namespaceURI: "http://www.w3.org/1999/xhtml" nextElementSibling: null nextSibling: text nodeName: "A" nodeType: 1 nodeValue: null offsetHeight: 18 offsetLeft: 537 offsetParent: div#center_column.center_column.col-xs-12.col-sm-9 offsetTop: 150 offsetWidth: 11 onabort: null onautocomplete: null onautocompleteerror: null onbeforecopy: null onbeforecut: null onbeforepaste: null onblur: null oncancel: null oncanplay: null oncanplaythrough: null onchange: null onclick: null onclose: null oncontextmenu: null oncopy: null oncuechange: null oncut: null ondblclick: null ondrag: null ondragend: null ondragenter: null ondragleave: null ondragover: null ondragstart: null ondrop: null ondurationchange: null onemptied: null onended: null onerror: null onfocus: null oninput: null oninvalid: null onkeydown: null onkeypress: null onkeyup: null onload: null onloadeddata: null onloadedmetadata: null onloadstart: null onmousedown: null onmouseenter: null onmouseleave: null onmousemove: null onmouseout: null onmouseover: null onmouseup: null onmousewheel: null onpaste: null onpause: null onplay: null onplaying: null onprogress: null onratechange: null onreset: null onresize: null onscroll: null onsearch: null onseeked: null onseeking: null onselect: null onselectstart: null onshow: null onstalled: null onsubmit: null onsuspend: null ontimeupdate: null ontoggle: null onvolumechange: null onwaiting: null onwebkitfullscreenchange: null onwebkitfullscreenerror: null onwheel: null origin: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" outerHTML: "<a href="#" rel="layered_id_feature_58" title="Abbrechen"><i class="icon-remove"></i></a>" outerText: "" ownerDocument: document parentElement: li parentNode: li password: "" pathname: "/de/21-oolong-tee" ping: "" port: "" prefix: null previousElementSibling: null previousSibling: text protocol: "http:" rel: "layered_id_feature_58" rev: "" scrollHeight: 18 scrollLeft: 0 scrollTop: 0 scrollWidth: 10 search: "" shadowRoot: null shape: "" spellcheck: true style: CSSStyleDeclaration tabIndex: 0 tagName: "A" target: "" text: "" textContent: "" title: "Abbrechen" translate: true type: "" username: "" webkitdropzone: "" __proto__: HTMLAnchorElement Edited October 9, 2015 by SirupB (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted October 10, 2015 Author Share Posted October 10, 2015 WHat's at line 356 of your blocklayered.js? Link to comment Share on other sites More sharing options...
SirupB Posted October 10, 2015 Share Posted October 10, 2015 Sorry this wasn't clear. It is the following line in the blocklayered.js I posted above: if ($(this).data("rel").search(/_slider$/) > 0) It is the fourth line of the code. Link to comment Share on other sites More sharing options...
NemoPS Posted October 12, 2015 Author Share Posted October 12, 2015 How does the rel element look like in the html? Link to comment Share on other sites More sharing options...
SirupB Posted October 19, 2015 Share Posted October 19, 2015 I sent you a personal message containing the link to my test server. This might be easier. HTML <a href="#" rel="layered_id_feature_58" title="Abbrechen"><i class="icon-remove"></i></a> The rel and the content is actually the <a> element over the X. Link to comment Share on other sites More sharing options...
NemoPS Posted October 21, 2015 Author Share Posted October 21, 2015 Try attr('rel') instead of data Link to comment Share on other sites More sharing options...
SirupB Posted November 11, 2015 Share Posted November 11, 2015 Changed if ($(this).data("rel").search(/_slider$/) > 0) to if ($(this).attr('rel').search(/_slider$/) > 0) Now there is no js error anymore - but the behaviour is not changed. The filter is NOT removed (as shown as in the picture in the first post above). Cheers Link to comment Share on other sites More sharing options...
ajensen27 Posted November 12, 2015 Share Posted November 12, 2015 Having the same issue... following for a fix. Thanks! Link to comment Share on other sites More sharing options...
NemoPS Posted November 13, 2015 Author Share Posted November 13, 2015 try changing .search to.indexOf("_slider") > -1Like if ($(this).attr('rel').indexOf("_slider") > -1) Link to comment Share on other sites More sharing options...
ajensen27 Posted November 13, 2015 Share Posted November 13, 2015 Thanks Nemo but that didn't work for me. Link to comment Share on other sites More sharing options...
NemoPS Posted November 14, 2015 Author Share Posted November 14, 2015 I take it as your products do not have the rel attribute then, can you check your tpl? Link to comment Share on other sites More sharing options...
rohi222 Posted December 24, 2016 Share Posted December 24, 2016 Hi, I followed the guide, but right now its not showing price on layered navigation. Link to comment Share on other sites More sharing options...
NemoPS Posted December 30, 2016 Author Share Posted December 30, 2016 Can you check if there is any ajax error in the debug console? Link to comment Share on other sites More sharing options...
rohi222 Posted December 30, 2016 Share Posted December 30, 2016 No there is no error, but when I tried doing this: /*if ((isset($this->context->controller->display_column_left) && !$this->context->controller->display_column_left)&& (isset($this->context->controller->display_column_right) && !$this->context->controller->display_column_right))return false;*/ it worked. What could be the solution if I don't have to use this. Thank you Link to comment Share on other sites More sharing options...
NemoPS Posted December 30, 2016 Author Share Posted December 30, 2016 That's how you have to do it Link to comment Share on other sites More sharing options...
attila729 Posted June 9, 2017 Share Posted June 9, 2017 Sorry, i have prestashop 1.6.1.14, can you say me how i must to do it? show me step by step thank you Link to comment Share on other sites More sharing options...
attila729 Posted June 9, 2017 Share Posted June 9, 2017 Sorry, i have prestashop 1.6.1.14, can you say me how i must to do it? show me step by step thank you Link to comment Share on other sites More sharing options...
attila729 Posted June 9, 2017 Share Posted June 9, 2017 Hey fellows! Just wrote a new tut, seeing this is where many people on the forums have trouble: how to properly hook the layered navigation to the center column (category page, of course) http://nemops.com/prestashop-layered-navigation-block-center-column/#.VNsblPmjOr1 cheers! Sorry, i have prestashop 1.6.1.14, can you say me how i must to do it? show me step by step thank you Link to comment Share on other sites More sharing options...
NemoPS Posted June 12, 2017 Author Share Posted June 12, 2017 The same way the previous user mentioned, by commenting out those two lines of code in blocklayered.php Link to comment Share on other sites More sharing options...
Kaper Posted August 16, 2018 Share Posted August 16, 2018 (edited) Thank you, it is working fine in 1.6.1.17. I want to make make category page "full width" - without left column , but if i disable left column (category) in my theme editor , the blocklayered is not working. What i have to do now please? Thank you Nemo Edited August 16, 2018 by Kaper (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted August 16, 2018 Author Share Posted August 16, 2018 Hey, there is a condition that checks it in the blocklayered.php file, I forgot the name to be honest, so I can't help you off the top of my head, but it should simply return false if there is no column Link to comment Share on other sites More sharing options...
grubybarti Posted December 23, 2019 Share Posted December 23, 2019 Any idea how could I show my filters on hover ? Just like this ? Link to comment Share on other sites More sharing options...
NemoPS Posted December 30, 2019 Author Share Posted December 30, 2019 Can you share the site's url? Depends on your theme it seems Link to comment Share on other sites More sharing options...
richardx49 Posted December 30, 2019 Share Posted December 30, 2019 thanks for the guide 😃 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now