Jump to content

customizable field using carriage return


Recommended Posts

When I use a customizable field, with carriage return, I get the following error message when 

putting article in cart:

 

Impossible to add the product to the cart. textStatus:parsererror errorThrown:SyntaxError: Unexpected token responseText: { "products": [ { "id": 9, "link": "http://www.uwboeket.nl/bestellen/9-citrus-burst-bouquet.html#/formaat-normaal/kleur-gelijk_afbeelding/vaas-geen/luxe_kaartje-ja_125_/gratis_kaartje-nee", "quantity": 1, "id_image": "http://www.uwboeket.nl/25-medium_default/citrus-burst-bouquet.jpg", "priceByLine": "40,05€", "name": "Explosief Ci...", "price": "40,05€", "price_float": "40.05", "idCombination": 2144, "idAddressDelivery": 0, "is_gift" : 0, "hasAttributes": true, "attributes": "Normaal, Nee, Gelijk Afbeelding, Ja + 1,25 €, Geen", "hasCustomizedDatas": true, "customizedDatas":[ { "customizationId": 6, "quantity": "1", "datas": [ { "type": "1", "datas": [ { "index": 0, "value": "regel 1 regel 2 regel 3 regel 4", "truncatedValue": "regel 1 regel 2 regel 3..." } ] } ] } ] }], "discounts": [ ], "shippingCost": "0,00€", "shippingCostFloat": "0", "wrappingCost": "0,00€", "nbTotalProducts": "1", "total": "40,05€", "productTotal": "40,05€", "hasError" : false } - See more at: http://www.uwboeket.nl/bestellen/9-citrus-burst-bouquet.html#sthash.EfsqQDyF.dpuf

 

Any idea?

It looks like a bug....

Link to comment
Share on other sites

seems like a bug to mee also.

 

Nice catch, however I can remember this used to work in my presta installations.

 

The issue is a javascript one and you can try to fix it like:

 

open modules/blockcart/blockcart-json.tpl and modify the two line bellow:

"index": {$index},

to be like:

"value": "{Tools::nl2br($data.value|addslashes|replace: '\\\'':'\'')}",
"truncatedValue": "{Tools::nl2br($data.value|truncate:28:'...'|addslashes|replace: '\\\'':'\'')}"

notice nl2br that fixes the problem

Please note in 1.5.6 it's already fixed so your js:

 - may be older

 - a theme may be overriding it so check your theme folder as well

Link to comment
Share on other sites

×
×
  • Create New...