Liquid, JavaScript, themes, sales channels
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
Solved! Go to the solution
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.
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.
@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.
Thanks A lot, Its works on "load more" and "infinite scrolling"
Much appreciated; this worked for me. I was looking at how to load SPR dynamically as my pages are loading through Turbo-Links.
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024