Jump to content

MyLocalSalon Review Script Not working properly

Recommended Posts

Site URL: https://www.hairdresserswellingborough.com/test

Site URL: https://www.hairdresserswellingborough.com/test

Hello, I have a script provided from https://www.mylocalsalon.co.uk/. Which working fine in https://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_lib_google . But in Squarespace, I inserted the script and nothing showing! However, I managed to show the block but it is not changing dynamically as it should do. 

Website link:  https://www.hairdresserswellingborough.com/test 

Script used 

<!--Your plug-in code can be customised to look
like your website using the following styling elements.
.SCMyWebsitePlugin-score
.SCMyWebsitePlugin-score div
.SCMyWebsitePlugin-mlsLink
li#SCMyWebsitePlugin-firstItem
li#SCMyWebsitePlugin-lastItem
#SCMyWebsitePlugin-main
#SCMyWebsitePlugin-reviewListDiv
-->

<div id="SCMyWebsitePlugin-main" data-site_id="43a01004-5146-e911-a9a6-000d3a81ec09" data-number_of_reviews="3" data-no_styles="true" data-change_time="1000" data-character_limit="200" data-total_reviews="20" data-use_microdata="true" />

<script type="text/javascript">
(function() {
     var newScript = document.createElement('script');
     newScript.type = "text/javascript";
     newScript.src = "https://ratings.mylocalsalon.com/widget/mywebsite";
     var firstScript = document.getElementsByTagName('script')[0];
     firstScript.parentNode.appendChild(newScript);
})();
</script>

 

Any Idea about how to solve this? Thanks in advance!

Link to comment

Can you explain what isn't working? This is what I see:

863771150_Screenshot2021-11-09at13_33_55.thumb.png.6a6281295f4dc70783cc48da27c6ea40.png

Improve your online store with our extensions.
About: Squarespace Circle Leader since 2017. I value honesty, transparency, appreciation and great design ♥.
Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™.
Content: Links in my posts may refer to SF Digital products or may be affiliate links.
Catch up on all the release notes and announcements 2023 [for Circle members only] (there's a public version here)

Buy me a coffee

Link to comment
2 hours ago, Shimi said:

@paul2009 I have attached the actual function it should do. 

I can see the root cause, Squarespace added a method to Array object called removeRange, which will be included in the for...in loop inside localsalon script, which break the code to loop to next review item.

Does your provider allow to embed code in a iframe instead?

 

image.png

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio plugin
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

BTW, I made change to your snippet to add it into iframe to get rid of squarespace issue

<iframe id="mylocalsalon-frame" src="javascript:void(0);"></iframe><style> #mylocalsalon-frame { width: 100%; border: none; height: 300px; overflow: hidden; }</style><script> const iframeElement = document.querySelector('#mylocalsalon-frame'); const htmlContent = "<!--Your plug-in code can be customised to look like your website using the following styling elements. .SCMyWebsitePlugin-score .SCMyWebsitePlugin-score div .SCMyWebsitePlugin-mlsLink li#SCMyWebsitePlugin-firstItem li#SCMyWebsitePlugin-lastItem #SCMyWebsitePlugin-main #SCMyWebsitePlugin-reviewListDiv --> <div id='SCMyWebsitePlugin-main' data-site_id='43a01004-5146-e911-a9a6-000d3a81ec09' data-number_of_reviews='3' data-no_styles='true' data-change_time='1000' data-character_limit='200' data-total_reviews='20' data-use_microdata='true'/> <script type='text/javascript'> (function() { var newScript = document.createElement('script'); newScript.type = 'text/javascript'; newScript.src = 'https://ratings.mylocalsalon.com/widget/mywebsite'; var firstScript = document.getElementsByTagName('script')[0]; firstScript.parentNode.appendChild(newScript); })();<\/script>"; iframeElement.contentWindow.document.open(); iframeElement.contentWindow.document.write(htmlContent); iframeElement.contentWindow.document.close();</script>

Paste the snippet to a code block on your site to make MyLocalSalon Review Script working on Squarespace site

 

image.png

Edited by bangank36

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio plugin
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment
2 minutes ago, Shimi said:

@bangank36 It is working absolutely Fine!!!! Thank you so much. Much appreciated.

I suggest you forward my revealation to the provider, they should for...of loop instead to solve it completely

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio plugin
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

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.