Teapot Creative Posted May 8, 2014 Share Posted May 8, 2014 (edited) Hi We are getting this error on one of our multistores, (3 x english language and 1 x french), the error is on the French store but not on all other stores when you try to add a product to the cart. The Cart is set to "Ajax mode" Any help would be appreciated. ERROR: ************ Impossible to add the product to the cart. textStatus: 'parsererror' errorThrown: 'SyntaxError: JSON.parse: bad control character in string literal' responseText: { "products": [ { "id": 566, "link": "http://website.fr/maquettes-historiques/hms-victory-bicentennial-ship-model-superior-range#/couleur_de_la_coque-bois_vernis/voiles-voile_cargu/lumiere_interne-non/canons-peint/plaque_nominative-plaque_standard_nominative/dimension_en_cm_po-victory_moyen_longueur_75_cms_hauteur_68_cms_largeur_26_cms_longueur_30_po_hauteur_27_po_largeur_10_po/couleur_du_pont-couleur_claire/nom_sur_le_bateau-non", "quantity": 1, "priceByLine": "487€ ", "name": "HMS Victory ...", "price": "487€ ", "price_float": "487.37", "imageLink": "https://website.fr/1272-small_default/hms-victory-bicentennial-ship-model-superior-range.jpg", "idCombination": 17244, "idAddressDelivery": 0, "is_gift" : 0, "hasAttributes": true, "attributes": "Peint, Bois vernis, Couleur Claire, Victory (Moyen) - Longueur 75 cms Hauteur 68 cms Largeur 26 cms / Longueur 30 po Hauteur 27 po Largeur 10 po, Non, Non, Plaque Standard Nominative, Voile Cargu", "hasCustomizedDatas": false, "customizedDatas":[ ] }], "discounts": [ ], "shippingCost": "64€ ", "shippingCostFloat": "46.66620177", "taxCost": "0€ ", "wrappingCost": "0€ ", "nbTotalProducts": "1", "total": "552€ ", "productTotal": "487€ ", "hasError" : false } ******************** Edited May 8, 2014 by Teapot Creative (see edit history) Link to comment Share on other sites More sharing options...
Teapot Creative Posted May 9, 2014 Author Share Posted May 9, 2014 bump... Link to comment Share on other sites More sharing options...
vekia Posted May 9, 2014 Share Posted May 9, 2014 without possibility to inspect website is little hard to say what's going on there i tried to open links that you posted but im redirected to some SEO parking? Link to comment Share on other sites More sharing options...
Teapot Creative Posted May 9, 2014 Author Share Posted May 9, 2014 Hi Vekia The site is here: http://maquettedebateau.fr/ Its in DEV (Maintenance) mode, can I please have your IP address to add to the BO. Nick Link to comment Share on other sites More sharing options...
vekia Posted May 9, 2014 Share Posted May 9, 2014 i sent you Pm with my IP Link to comment Share on other sites More sharing options...
Teapot Creative Posted May 9, 2014 Author Share Posted May 9, 2014 Brilliant , thanks... IP now added to the BO Nick Link to comment Share on other sites More sharing options...
vekia Posted May 9, 2014 Share Posted May 9, 2014 in add to cart ajax request prestashop by default returns escaped datas in your shop datas aren't escaped maybe it's worth to check this. return from demo store: {"products":[{"id":2,"link":"http:\/\/prestashop16.mypresta.eu\/blouses\/2-blouse.html#\/size-s\/color-black","quantity":1,"image":"http:\/\/prestashop16.mypresta.eu\/7-home_default\/blouse.jpg","image_cart":"http:\/\/prestashop16.mypresta.eu\/7-cart_default\/blouse.jpg","priceByLine":"\u00a3 32.40","name":"Blouse","price":"\u00a3 32.40","price_float":27,"idCombination":7,"idAddressDelivery":0,"is_gift":false,"hasAttributes":true,"attributes":"Black, S","hasCustomizedDatas":false,"customizedDatas":[]}],"discounts":[{"id":0,"name":"","description":null,"nameDescription":":","code":"","link":"http:\/\/prestashop16.mypresta.eu\/order?deleteDiscount=","price":"\u00a3 0.00","price_float":0}],"shippingCost":"\u00a3 0.00","shippingCostFloat":0,"wrappingCost":"\u00a3 0.00","nbTotalProducts":1,"total":"\u00a3 32.40","productTotal":"\u00a3 32.40","freeShipping":"\u00a3 0.00","freeShippingFloat":0,"hasError":false,"crossSelling":""} return from official demo store {"products":[{"id":1,"link":"http:\/\/demo-store.prestashop.com\/en\/tshirts\/1-faded-short-sleeve-tshirts.html#\/size-s\/color-orange","quantity":1,"image":"http:\/\/demo-store.prestashop.com\/1-home_default\/faded-short-sleeve-tshirts.jpg","image_cart":"http:\/\/demo-store.prestashop.com\/1-cart_default\/faded-short-sleeve-tshirts.jpg","priceByLine":"$16.51","name":"Faded Short ...","price":"$16.51","price_float":16.51,"idCombination":1,"idAddressDelivery":0,"is_gift":false,"hasAttributes":true,"attributes":"Orange, S","hasCustomizedDatas":false,"customizedDatas":[]}],"discounts":[],"shippingCost":"$7.00","shippingCostFloat":7,"wrappingCost":"$0.00","nbTotalProducts":1,"total":"$23.51","productTotal":"$16.51","freeShipping":"$0.00","freeShippingFloat":0,"hasError":false,"crossSelling":""} return from your website { "products": [ { "id": 1402, "link": "http://maXXXu.fr/kits-d-outils/piece-boat-building-and-craft-tool-set", "quantity": 2, "priceByLine": "69€ ", "image": "http://maXXXu.fr/2908-home_default/piece-boat-building-and-craft-tool-set.jpg", "name": "12 Piece Boa...", "price": "69€ ", "price_float": "58.04", "idCombination": 0, "idAddressDelivery": 0, "is_gift" : 0, "hasAttributes": false, "hasCustomizedDatas": false, "customizedDatas":[ ] }], "discounts": [ ], "shippingCost": "25€ ", "shippingCostFloat": "18.01711098", "taxCost": "11€ ", "wrappingCost": "0€ ", "nbTotalProducts": "2", "total": "94€ ", "productTotal": "69€ ", "freeShipping": "", "freeShippingFloat": "", "hasError" : false } Link to comment Share on other sites More sharing options...
Teapot Creative Posted May 9, 2014 Author Share Posted May 9, 2014 Hi Just to be clear this is a 1.5.6 Prestashop Build. Nick Link to comment Share on other sites More sharing options...
Teapot Creative Posted May 9, 2014 Author Share Posted May 9, 2014 Hi We don't understand why it would work correctly on all the other associated multistores on this site, i.e premiershipmodels.us / premiershipmodels.co.uk / premiershipmodels.com.au ... these are all using the same blockcart module and work correctly (these are all live sites, so you can see/test that they are working correctly) .. Would this still be an escaping error? Nick Link to comment Share on other sites More sharing options...
vekia Posted May 9, 2014 Share Posted May 9, 2014 try to copy blockcart module files located in theme UK to theme FR (i see that you use the same theme for each shop, but theme is located in different directories for each of them) Link to comment Share on other sites More sharing options...
Teapot Creative Posted May 10, 2014 Author Share Posted May 10, 2014 (edited) Hi Tried adding files from UK theme to French theme, but no change. We are wondering if Prestashop cart module or other relaited files are not escaping some of the French characters... Could this be the case? This is maybe why its working on all the English/US sites. NB: I have check all files against working sites files within the Cart Module and updated to latest version on the github for 1.5.6. Any advice would be appreciated. Nick PS. If its not escaping some of the French, where would we look to check this and what should we look for? Edited May 10, 2014 by Teapot Creative (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 10, 2014 Share Posted May 10, 2014 blockcart-json.tpl you can add there escaping as a smarty variable modifier Link to comment Share on other sites More sharing options...
Teapot Creative Posted May 12, 2014 Author Share Posted May 12, 2014 Can't see any obvious fix for this.? Really struggling to correct this issue.. cant see a work around or where the error is coming from.. think this is possible Forge issue.. and a Prestashop bug in the core... If anyone else has ideas happy to try... Nick Link to comment Share on other sites More sharing options...
Teapot Creative Posted May 12, 2014 Author Share Posted May 12, 2014 We have got the error result from firefox... seems its line 7 column 24.? Does anyone know what this is referring to? Looks like it could be down to the currency "Euro" character? Any ideas? See code error below: Impossible to add the product to the cart. textStatus: 'parsererror' errorThrown: 'SyntaxError: JSON.parse: bad control character in string literal at line 7 column 24 of the JSON data' responseText: { "products": [ { "id": 1402, "link": "http://maquettedebateau.fr/kits-d-outils/piece-boat-building-and-craft-tool-set#/number_tools-12_pieces", "quantity": 1, "priceByLine": "35€ ", "name": "12 Piece Boa...", "price": "35€ ", "price_float": "29.02", "imageLink": "http://maquettedebateau.fr/2908-small_default/piece-boat-building-and-craft-tool-set.jpg", "idCombination": 20282, "idAddressDelivery": 0, "is_gift" : 0, "hasAttributes": true, "attributes": "12 Pieces", "hasCustomizedDatas": false, "customizedDatas":[ ] }], "discounts": [ ], "shippingCost": "22€ ", "shippingCostFloat": "15.63995394", "taxCost": "6€ ", "wrappingCost": "0€ ", "nbTotalProducts": "1", "total": "56€ ", "productTotal": "35€ ", "hasError" : false } Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now