Vote for v1.5 Fixes

PrestaShop Forum: Build a free online shop. Count on the Community!

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum: Build a free online shop. Count on the Community!

Jump to content

 
Photo

error message - Impossible to add products to cart


  • Please log in to reply
4 replies to this topic
benofino

    PrestaShop Newbie

  • Members
  • Pip
  • 17 posts

Posted 28 September 2009 - 05:44 PM

My online store had been working fine until 2 weeks ago.
I have install 1.2.4.0
and impossible to add products to cart
TECHNICAL ERROR: unable to add the product.

Details:
Error thrown: [object XMLHttpRequest]
Text status: error

What can be done?

ben

codegrunt

    PrestaShop Apprentice

  • Members
  • PipPip
  • 157 posts

Posted 29 September 2009 - 07:53 PM

The error means that the Javascript retrieving cart information from Prestashop ran into issues parsing the response that came back from the server. This could be for any number of reasons - your browser is doing something funny, there is product data with unescaped characters causing problems, something messed up with the JSON generation code on the server, extra text getting prepended or appended to the output, etc.

The first thing I would suggest is that you disable Javascript in your browser temporarily and see if you can add products normally. If that works fine, then the issue has got to be related to Javascript either on your machine or in the output coming back from the server.

You can manually inspect what is being sent by calling the cart directly by calling the cart directly. If you view the source to your product page you will find a section like this:

<input type="hidden" name="token" value="00757d49336c884062383c23" /><input type="hidden" name="id_product" value="1" id="product_page_product_id" /><input type="hidden" name="add" value="1" /><input type="hidden" name="id_product_attribute" id="idCombination" value="" />


Plug your token and id_product values in to the following URL:

http://www.prestasho...36c884062383c23

You would replace everything up to "cart.php" with the URL to your shop, your product id instead of "1" and your token value instead of "00757d49336c884062383c23". If you access this URL in your browser, you should be given some text representing a JSON object (Javascript representing your cart contents) which should look something like this:

{'products': [    {        'id':            2,        'link':          'http://www.prestashop.com/demo/music-ipods/2-ipod-shuffle.html',        'quantity':      2,        'priceByLine':   '158,00 €',        'name':          'iPod shuffle',        'price':         '158,00 €',        'idCombination': 8,        'hasAttributes': true,        'attributes':    'Green',        'hasCustomizedDatas': false,        'customizedDatas':[                ]    },    {        'id':            1,        'link':          'http://www.prestashop.com/demo/music-ipods/1-ipod-nano.html',        'quantity':      4,        'priceByLine':   '756,20 €',        'name':          'iPod Nano',        'price':         '756,20 €',        'idCombination': 31,        'hasAttributes': true,        'attributes':    'Black, 16Go',        'hasCustomizedDatas': false,        'customizedDatas':[                ]    },],'discounts': [],'shippingCost': '0,00 €','wrappingCost': '0,00 €','nbTotalProducts': '6','total': '914,20 €','productTotal': '914,20 €','hasError' : false}


My guesses here are:

1. there will be an error message or extraneous HTML embedded in the array returned making it unparseable (track down the source of the error)

2. a product has text in it that is breaking the array due to lack of proper escaping (change the product details)

3. your browser has a taskbar or something similar installed that is messing with its Javascript behaviour

Cheers
CODEgrunt Consulting - total geek trash, coder / troubleshooter for hire

andyr73

    PrestaShop Newbie

  • Members
  • Pip
  • 16 posts

Posted 04 October 2009 - 04:37 PM

There is also a problem in which i found that if you don't have a default carrier setup in presta back end you will also get that problem with parse error and when you click view cart you get a hack attempt error. maybe this will help?
cheers

anafor

    PrestaShop Newbie

  • Members
  • Pip
  • 18 posts

Posted 01 December 2009 - 10:25 PM

I've found the solution!)) Thanks you very much, codegrunt!
I've tried to enter url in browser as you told: "cart.php?add&ajax=true&qty=1&id_product=1&token=c111e173641a40c51b739ca280ac2fe7". And I've found the reason: there was a mysql warning (my "display_errors" in config.inc.php had been turned to "on") like
Warning: Unknown: 1 result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query() in Unknown on line 0

in the end of json response cart.php returned.
I've just turned display_errors to "off" and everything works fine!

Does anybody know how to remove this warning at all, even if display_errors turned on?

pletchermdg

    PrestaShop Newbie

  • Members
  • Pip
  • 1 posts

Posted 08 February 2014 - 08:43 PM

the very first idea is actually a plastic animal mug that will come in a variety of themes elephant

Halloween fun over time could involve pranks such as strewing toilet paper around tree divisions, painting graffiti in items together with aerosol shaving cream, doll tricks that pop up once the tricker shakes fingers with the treater, for example buzzers or coils. The pranks or techniques were relatively harmless, however in many places abroad, many Halloween things to do are totally banned. Enjoyable for Hallow's eve also includes haunted houses, parties having games and also refreshments which sport trick or treat costumes and either an autumn or haunted theme..

You can find plus-sized dresses for female in a wide variety online unlike the past in which the clothes began in limited quantity not to mention that these people were very costly without necessarily trendy. Therefore, i thought this was a major problem in which plus sized females who were in a position to become modern experienced. Now, all these issues have been fixed and plus sized women can certainly dress fashionably like any body else.


http://www.lokalaw.c...t_Costumes.html
http://w2w-business....t_Costumes.html
http://hahoplay.com/...ll_jerseys.html
http://www.nazaret.c...on_jersey1.html
http://aoshidianka.n...ks_jersey1.html
http://twspd.com/htm...ks_jersey1.html
http://www.wipwar.co...ker_jersey.html
http://vabenesh.com/...r_jerseys2.html
http://www.erleinsba...d_Costumes.html




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users