Solved

How can I refresh SPR for endless scroll on Ajaxinate?

marquinhos
Shopify Partner
21 1 5

I am using Ajaxinate to have endless scroll in my colletion template. Shopify product review badge only appears for the first products of the pagination. I've noticed that SPR need to be reinit/refreshed everytime that a http request is made. So how can i access SPR element in my js file? 

i've got this error when try to access the object

- Uncaught ReferenceError: SPR is not defined

Accepted Solution (1)

marquinhos
Shopify Partner
21 1 5

This is an accepted solution.

i solved this issue simulating another http request. 

var request = new XMLHttpRequest();
        request.open("GET", "");
        request.onload = function() {
                SPR.registerCallbacks();
                SPR.initRatingHandler();
                SPR.initDomEls();
                SPR.loadProducts();
                SPR.loadBadges();
        };
        request.send();

but it is not a good solution. Waiting for new solutions or ideas/advices.

 

 

View solution in original post

Replies 4 (4)

marquinhos
Shopify Partner
21 1 5

This is an accepted solution.

i solved this issue simulating another http request. 

var request = new XMLHttpRequest();
        request.open("GET", "");
        request.onload = function() {
                SPR.registerCallbacks();
                SPR.initRatingHandler();
                SPR.initDomEls();
                SPR.loadProducts();
                SPR.loadBadges();
        };
        request.send();

but it is not a good solution. Waiting for new solutions or ideas/advices.

 

 

Akshay_V
Shopify Partner
438 16 58

@marquinhos 

You need to contact app support and tell them you are using infinite scrolling on the collection page so they will change code. After that, your issue will be fixed.

Akshay Vaghasiya | Email: hello@lavitastic.com | Skype: akshayvaghasiya84
Want to modify theme or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Buy me a coffee PayPal
wizebrains
Shopify Partner
1 0 0

Thanks A lot, Its works on "load more" and "infinite scrolling"

MrL22
Shopify Partner
18 0 12

Much appreciated; this worked for me. I was looking at how to load SPR dynamically as my pages are loading through Turbo-Links.