Jump to content

A curious JSON parsing error after upgrade


Torbz
 Share

Recommended Posts

Hi all,

I've had a right nightmare upgrading from 1.3.6 to 1.4.9 but finally thought I'd done it succesfully until I tried to add something to the cart from any product's page.

 

The following error is thrown up:

 

Impossible to add the product to the cart.
textStatus: 'parsererror'
errorThrown: 'SyntaxError: JSON.parse: unexpected character'
responseText:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
 <title>Banz Blue Swim Nappy</title>
 <meta name="description" content="Swim Nappy - Accidents do happen - but don't let them stop your baby from enjoying the water!" />
 <meta name="keywords" content="baby swim nappy" />
 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
 <meta name="generator" content="PrestaShop" />
 <meta name="robots" content="index,follow" />
 <link rel="icon" type="image/vnd.microsoft.icon" href="http://sunproof.co.uk/dev/img/favicon.ico" />
 <!--<link href="http://www.esunproof.co.uk/store/themes/prestashop/css/global.css" rel="stylesheet" type="text/css" media="all" />-->
	<link rel="shortcut icon" type="image/x-icon" href="http://sunproof.co.uk/dev/img/favicon.ico" />
 <link href="/dev/themes/prestashop/css/global.css" rel="stylesheet" type="text/css" media="all" />
 <link href="/dev/css/jquery.autocomplete.css" rel="stylesheet" type="text/css" media="all" />
 <link href="/dev/themes/prestashop/css/product_list.css" rel="stylesheet" type="text/css" media="all" />
 <link href="/dev/themes/prestashop/css/modules/blocksearch/blocksearch.css" rel="stylesheet" type="text/css" media="all" />
 <link href="/dev/themes/prestashop/css/modules/blockpaymentlogo/blockpaymentlogo.css" rel="stylesheet" type="text/css" media="all" />
 <link href="/dev/themes/prestashop/css/modules/blockpermanentlinks/blockpermanentlinks.css" rel="stylesheet" type="text/css" media="all" />
 <link href="/dev/themes/prestashop/css/modules/blockcart/blockcart.css" rel="stylesheet" type="text/css" media="all" />
 <link href="/dev/themes/prestashop/css/modules/editorial/editorial.css" rel="stylesheet" type="text/css" media="all" />
 <link href="/dev/themes/prestashop/css/modules/blockcategories/blockcategories.css" rel="stylesheet" type="text/css" media="all" />
 <link href="/dev/themes/prestashop/css/modules/blockcurrencies/blockcurrencies.css" rel="stylesheet" type="text/css" media="all" />
 <link href="/dev/themes/prestashop/css/modules/blockcms/blockcms.css" rel="stylesheet" type="text/css" media="all" />
 <link href="/dev/themes/prestashop/css/modules/blocklanguages/blocklanguages.css" rel="stylesheet" type="text/css" media="all" />
 <link href="/dev/themes/prestashop/css/modules/blockmyaccount/blockmyaccount.css" rel="stylesheet" type="text/css" media="all" />
 <link href="/dev/themes/prestashop/css/modules/crossselling/crossselling.css" rel="stylesheet" type="text/css" media="all" />
  <script type="text/javascript" src="http://sunproof.co.uk/dev/js/tools.js"></script>
 <script type="text/javascript">
  var baseDir = 'http://sunproof.co.uk/dev/';
  var static_token = '792086275f66ea1390ff22656319a34c';
  var token = 'df32bfca790888b123d8eded0ab6d86e';
  var priceDisplayPrecision = 2;
 </script>
 <script type="text/javascript" src="http://sunproof.co.uk/dev/js/jquery/jquery-1.2.6.pack.js"></script>
 <script type="text/javascript" src="http://sunproof.co.uk/dev/js/jquery/jquery.easing.1.3.js"></script>
 <script type="text/javascript" src="http://sunproof.co.uk/dev/js/jquery/jquery.hotkeys-0.7.8-packed.js"></script>
 <script type="text/javascript" src="/dev/js/jquery/jquery.min.js"></script>
 <script type="text/javascript" src="/dev/js/jquery/jquery.easing.1.3.js"></script>
 <script type="text/javascript" src="/dev/js/tools.js"></script>
 <script type="text/javascript" src="/dev/js/jquery/jquery.autocomplete.js"></script>
 <script type="text/javascript" src="/dev/modules/blockcart/ajax-cart.js"></script>
 <script type="text/javascript" src="/dev/themes/prestashop/js/tools/treeManagement.js"></script>

<link rel="alternate" type="application/rss+xml" title="Banz Blue Swim Nappy" href="http://sunproof.co.uk/dev/modules/feeder/rss.php?id_category=244&orderby=position&orderway=desc" /><script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-19509471-1']);
// Recommanded value by Google doc and has to before the trackPageView
_gaq.push(['_setSiteSpeedSampleRate', 5]);
_gaq.push(['_trackPageview', 'cart']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

</head>

<body id="index">
  <noscript><ul><li>This shop requires JavaScript to run correctly. Please activate JavaScript in your browser.</li></ul></noscript>
 <div id="page">
	<!-- Header user injection -->
<div id="header_user">
<ul id="header_nav">
 <li id="shopping_cart">
  <a href="http://sunproof.co.uk/dev/order.php" title="Your Shopping Cart">Cart:</a>
  <span class="ajax_cart_quantity hidden">0</span>
  <span class="ajax_cart_product_txt hidden">product</span>
  <span class="ajax_cart_product_txt_s hidden">products</span>
  <span class="ajax_cart_no_product">(empty)</span>
 </li>
 <li id="your_account"><a href="http://sunproof.co.uk/dev/my-account.php" title="Your Account">Your Account</a></li>
<li id="header_user_info">
 Welcome,
 <a href="http://sunproof.co.uk/dev/my-account.php">Log in</a>
  </li>
</ul>
</div><!-- injection end -->
  <!-- Header -->
  <div>
<h1 id="logo"><a href="http://sunproof.co.uk/dev/" title="Sunproof Limited"><img src="http://sunproof.co.uk/dev/img/ps-logo.jpg" alt="Sunproof Limited" /></a></h1>
<div id="header">

<!-- Block languages module -->
<div id="languages_block_top">
<ul id="first-languages">
 <li class="selected_language">
	 <img src="http://sunproof.co.uk/dev/img/l/1.jpg" alt="en" width="16" height="11" />
   </li>
 <li >
				<a href="http://sunproof.co.uk/dev/fi/" title="Finnish">

	 <img src="http://sunproof.co.uk/dev/img/l/9.jpg" alt="fi" width="16" height="11" />
	 </a>
   </li>
  </ul>
</div>
<script type="text/javascript">
$('ul#first-languages li:not(.selected_language)').css('opacity', 0.3);
$('ul#first-languages li:not(.selected_language)').hover(function(){
 $(this).css('opacity', 1);
}, function(){
 $(this).css('opacity', 0.3);
});
</script>
<!-- /Block languages module -->
<!-- Block permanent links module HEADER -->
<ul id="header_links">
<li id="header_link_contact"><a href="http://sunproof.co.uk/dev/en/contact-us" title="contact">contact</a></li>
<li id="header_link_sitemap"><a href="http://sunproof.co.uk/dev/en/sitemap" title="sitemap">sitemap</a></li>
<li id="header_link_bookmark">
 <script type="text/javascript">writeBookmarkLink('http://sunproof.co.uk/dev/', 'Banz Blue Swim Nappy', 'bookmark');</script>
</li>
</ul>
<!-- /Block permanent links module HEADER -->
<!-- Block search module TOP -->
<div id="search_block_top">
<form method="get" action="http://sunproof.co.uk/dev/en/search" id="searchbox">
 <p>
  <label for="search_query_top"><!-- image on background --></label>
  <input type="hidden" name="orderby" value="position" />
  <input type="hidden" name="orderway" value="desc" />
  <input class="search_query" type="text" id="search_query_top" name="search_query" value="" />
  <input type="submit" name="submit_search" value="Search" class="button" />
</p>
</form>
</div>
<script type="text/javascript">
// <![CDATA[

 $('document').ready( function() {
  $("#search_query_top")
.autocomplete(
 'http://sunproof.co.uk/dev/en/search', {
  minChars: 3,
  max: 10,
  width: 500,
  selectFirst: false,
  scroll: false,
  dataType: "json",
  formatItem: function(data, i, max, value, term) {
   return value;
  },
  parse: function(data) {
   var mytab = new Array();
   for (var i = 0; i < data.length; i++)
	mytab[mytab.length] = { data: data[i], value: data[i].cname + ' > ' + data[i].pname };
   return mytab;
  },
  extraParams: {
   ajaxSearch: 1,
   id_lang: 1
  }
 }
)
.result(function(event, data, formatted) {
 $('#search_query_top').val(data.pname);
 document.location.href = data.product_link;
})
 });

// ]]>
</script>
<!-- /Block search module TOP -->
				 <div id="headerContact">Sunproof Limited<br/>
t: 01460 - 258040<br/>
e: <a href="mailto:[email protected]">[email protected]</a></div>
</div>
  </div>


  <div id="center_column">

<!-- Module Editorial -->
<div id="editorial_block_center" class="editorial_block">
<a href="http://www.sunproof.co.uk/dev" title="">  </a>	<div class="rte"><table border="0">
<tbody>
<tr>
<td width="180">
<p><a href="http://www.sunproof.co.uk/store/282-rukka-rainwear"><img title="Rukka Rainwear - Exclusive UK Distributor" src="/psimages/home-rukka.jpg" alt="Exclusive Rukka Rainwear" width="178" height="178" /></a></p>
</td>
<td width="180">
<p><a title="Cosyosko Reversible Buggy Bags - Perfect For Colder Weather!" href="http://www.sunproof.co.uk/store/61-cozyosko-pram-fleeces-warmer"><img title="Cosyosko  Reversible Buggy Bags - Perfect For Colder Weather." src="/psimages/home-cozy.jpg" alt="Cosyosko Reversible Buggy Bags -  Perfect For Winter!" width="178" height="178" /></a></p>
</td>
<td width="180">
<p><a title="Not just for Summer - a great range of Crocs footwear" href="http://www.sunproof.co.uk/store/136-crocs-footwear-shoes"><img title="Our fantastic range of Crocs shoes and footwear for all  seasons..." src="/psimages/home-footwear.jpg" alt="Broad range of footwear for  all seasons" width="178" height="178" /></a></p>
</td>
<td width="180">
<p><a title="Spice up your Crocs with ou

It apears to truncate at this point...

 

I've lloked briefly into firebug, but it really doesn't extend much beyond what the log window tells me.

 

Can anyone shed even a small blob of light on where to look next, things to try etc.?

 

I'm also looking for a working homepage image Carousel (had Nethercott's 1.4.x version, but it fails to function) for 1.4.9.

and also a WORLDPAY module that will function in 1.4.x or 1.5.x (assuming I can ever upgrade to it of course!)

 

Also, how on earth do I get to v1.5 - I've tried manual upgrades, auto-upgrades and nothing seems to succeed. All methods simply threw up either a blank FO, or I couldn't log into the BO with valid credentials.

 

This is worrying me, as my client really needs features that are included in v1.5 and I've never encountered such grand problems upgrading before.

 

Does anyone know of a way to install fresh 1.5 and import the products and combinations, shipping and other vital info from either the current operable version of 1.3.6 or from the semi-working v1.4.9?

 

I'd be looking to get serious help if anyone would like to make an offer to aid the upgrade process.

Edited by Torbz (see edit history)

Share this post


Link to post
Share on other sites

i had the same error after an upgrade from 1.5.0.3 to 1.5.0.17

 

textStatus: 'parsererror'

errorThrown: 'SyntaxError: JSON'

 

my error was coming from a javascript redirection on my home page, my home page is not a prestashop page.

Edited by kia (see edit history)

Share this post


Link to post
Share on other sites

  • 4 weeks later...

Has anybody solved this problem or found the cause of this error ???

 

I have updated from 1.4.9 to 1.5.1 and I only have this problem, which don't allow me to add to the cart.

 

 

 

Impossible to add the product to the cart.textStatus: 'parsererror'errorThrown: 'SyntaxError: JSON.parse: unexpected character'responseText:code HTML......

 

 

 

 

I will thank any help you can give me about it.

 

Regards

Share this post


Link to post
Share on other sites

Hi Harry Potter, please, How did you fix it?. In your web you do not have any problem now. Thanks in advance.

 

To be honest, the problem just disappear. All i do is switch to non-ajax cart and then switch back to Ajax cart. But on thursday or friday last week the problem still there... But today its gone... maybe just my luck.

 

Anyway, someone suggested to backup the product.php of the current template and then copy that file from the default template to the current template.

 

You can have more information in this forum:

http://www.prestashop.com/forums/topic/184354-free-14-theme-responsive-clothes-store-theme/

 

Previously the issue only happen on firefox...

 

Hope the above solution can work for you. Goodluck :)

Edited by harrypotter30022003 (see edit history)

Share this post


Link to post
Share on other sites

  • 1 month later...

i had the same error after an upgrade from 1.5.0.3 to 1.5.0.17

 

textStatus: 'parsererror'

errorThrown: 'SyntaxError: JSON'

 

my error was coming from a javascript redirection on my home page, my home page is not a prestashop page.

 

I have the same error, can you solve it???

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 3 months later...
  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More