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

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Link to comment

@paul2009 Thanks for the reply. It should dynamically populate  new reviews to slide up. Please run the code in https://www.w3schools.com/html/tryit.asp?filename=tryhtml_default_default to get the exact idea. For example, a 4th hidden review block should take place of the 3rd review after a certain time period.

Edited by Shimi
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

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, 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

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, 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

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, 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.