AJaxinate + SPR

Solved
marquinhos
Shopify Partner
20 1 4

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

0 Likes
marquinhos
Shopify Partner
20 1 4

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
433 16 56

@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 | Shopify Expert
Skype: akshayvaghasiya84
 - Like and Mark as an Accepted Solution if reply helpful
 - Feel free to contact me on info@lavitastic.com regarding any help
0 Likes
wizebrains
New Member
1 0 0

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

0 Likes