Jump to content

Make product categories act like filters without loading the page again and again

Recommended Posts

Site URL: https://www.elgalgorestaurante.com/es/para-llevar

Hello,

I would like to make my website more user friendly but the product page is a big headache.

To help my customers find the best meal I use the category option as a filter but when using it, it loads the age again and again.

https://elgalgorestaurante.squarespace.com/es/para-llevar

The filter works but every time you choose a type of meal, you have to scroll down.

How can I change that?

I suppose that I have to use anchors links but I don't know where to put then and make then work.

Someone has an idea ?

 

Thanks

Link to comment
  • 4 weeks later...

@Yoline, I am having the same problem.
I agree, it's annoying to have the page reload to the top each time a category is chosen. 
I want my customers to easily switch between categories without having to scroll down from the top of the page each time. 

Have you found an answer by contacting Squarespace support? Or have you privately emailed/messaged any of the community developers? 
I'm surprised this question hasn't been asked and answered before.

I will contact Squarespace support when they are available. But I will directly ask some of the community developers... 
@tuanphan @rwp @paul2009

777692029_ScreenShot2020-07-30at9_34_02PM.thumb.png.7d1c26fd997cadf047208b1aeb42a82b.png

I agree with you that anchor links are part of the solution. 
I know how to add an anchor link using a code block right above the categories, but I don't know how to change where the categories link to. 

408146107_ScreenShot2020-07-30at9_41_00PM.thumb.png.021c42593dd8ada22c8ede68e9740620.png

 

I've even tried looking at the Inspector, but I don't have any experience coding.


541211328_ScreenShot2020-07-30at9_49_39PM.thumb.png.a2064afadaa3d368fcc9a372a8e1f7d1.png
 

Here's my website: www.BrendanAlexPhoenix.com
Version 7.0– York family (Jones template)
And here's the product page with categories: www.BrendanAlexPhoenix.com/prints
(I have three product pages: Cards/Prints/Free)

I wonder if this has to be done via the 'Code Injection' under 'Advance' for each product page. 

Hopefully we can get this solved sooner than later this time. 🙂
 

Solving this problem would greatly help my customers. 

 

Edited by CptFeeny
Link to comment

It should work. Is the site 7.1?

Click the link in my signature. Click the codepen link on my page.

There should be a pen called Scroll to products on cat change.

See if that works.

Don't forget to follow the instructions in my signature for setting up jQuery.

Edited by rwp
Link to comment
  • 3 weeks later...

Hi @rwp,

I'm trying to do the same thing but failed.

I'm on 7.1 and used the following code on Code Injection / Header:

 

<script
              src="https://code.jquery.com/jquery-3.5.1.min.js"
              integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
              crossorigin="anonymous"></script>

$(document).ready(function() {
  var catLink = $('a.category-filter-link.category-filter-link-all');
  var _href = $(catLink).attr("href");
  $(catLink).attr("href", _href + '?');

  var urlCat = window.location.href.split("?")[1];
  if (urlCat !== undefined) {
    var prodTop = $('section:nth-of-type(2)')
    $('html,body').animate({
      scrollTop: $(prodTop).offset().top
    }, 0);
  }
});
</script>

 

I'm not familiar with coding. Could you help me?

Thanks!

Link to comment
  • 1 year later...
On 11/1/2021 at 9:03 PM, Cozen said:

Hello, I am having similar issue i tried this code on this page but didn't work for me. can somebody help please. i am on 7.1. @rwp @tuanphan

Can you share link to your site? We can check easier

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.