1

i'm looking to solve a problem for few days now ! I have a website in some pages the javascript is loaded properly but in some of them not i'm getting some errors in console ! I will post an example with a good page and one with a bad one ! Good Page

http://www.abcsports.co.uk/index.php/mens/2015-under-armour-boys-heatgear-tech-big-logo-short-sleeve-training-t-shirt.html

Bad page : http://www.abcsports.co.uk/index.php/mens/bottoms/golf-shorts/under-armour-2016-ua-heatgear-match-play-paterned-flat-front-mens-golf-shorts.html

On the good page sliders and tabs are displayed properly but in the bad ones the slider , tabs , all javascript cant be executed !

I really appreciate if somebody can help me with this ! Thank you

0

Problem in a double-quote (") at an option name (label):

json parse problem in console

Get rid of this symbol and your problem will be solved. Or you can escape you string using the \ symbol, like: \"

Usually double-quotes are used for definition of the beginning and the end of a string-type value in the JSON format.

You can read more on the stackoverflow:

  1. jQuery.parseJSON single quote vs double quote
  2. How to escape double quotes in JSON .

Update:

I can reproduce this error on my local test-shop (option label is XS 1"):

error reproduction

After change double-quotes to the single-quotes i get next error:

Uncaught SyntaxError: missing ) after argument list

another error

Then I escape a labels, and almost all works fine (no errors, but...):

with escape

And finally I have found solution - using html-entities (" for double-quotes) not breaks anything and looks good:

backend

frontend without errors

But after resaving attributes in backend the html-entity is converted to the double-quote and error comes back :(

attribute lable after resave

error comes back

  • Thank you Siarhey , but what is curios on the good page for example why i don't have the same issue ? Is the same Jquery (jquery-1.7.2.min.js) , why the problem is only in few pages? Only few of them , the rest of the website content is displayed well ! – Cantemir Alex Dec 3 '16 at 15:27
  • @CantemirAlex That is becouse on the good page your options labels not contains a double-quotes. The JSON-string on them is parsed normally and doesn't cause errors in JS (at the subsequent execution of the program) – Siarhey Uchukhlebau Dec 3 '16 at 15:32
  • @CantemirAlex you can change the one double-quote in the option label to the two single-quotes: '' (in admin pannel). Visually they are equal, but doesn't cause errors – Siarhey Uchukhlebau Dec 3 '16 at 15:35
  • that's very help full but please can you tell where in admin panel can i do the changes ! I would really appreciate it ! Thank you again – Cantemir Alex Dec 3 '16 at 20:26
  • @CantemirAlex Go to the Catalog > Attributes > Manage Attributes, search the Size attribute: gyazo.com/b393d7a708e65f28801e7f1b905cf552 , click on it (edit), open the labels tab gyazo.com/5ca72c875ad3fb7bd7c25b32b239c2a5 and change the label Waist 30" (remove double-quote, add two single-quotes), save, refresh cache. – Siarhey Uchukhlebau Dec 4 '16 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.