Announcement
Collapse
No announcement yet.
Cart popup widget corrupts other info input.
Collapse
X
-
Thanks Norman, that's extremely helpful as always. I've raised a bug for this, ref. SDE-748
-
The problem seem to be in this fragment of code in sdwidget.min.js that is used to send the product form data to the cart via AJAX:
Code:data:i.serialize()
However SellerDeck pages are using iso-8859-1 encoding and this uses a single character encoding scheme. E.g. hex A3 for £.
When encodeURIComponent does it's work it expands single character £ into %C2%A3, passes it to the Shopping Cart via AJAX and our utf-8 pages subsequently display that as £.
The solution is to replace jQuery .serialize() with an iso-8859-1 compatible one. I found such a fix on the jQuery Forum https://forum.jquery.com/topic/non-utf-8-serialization
Edit sdwidget.min.js and add the following at the beginning:
Code:// based on jQuery Forum - https://forum.jquery.com/topic/non-utf-8-serialization $.fn.serializeISO8859 = function(){ var s = []; $.each( this.serializeArray(), function( i, v ){s.push(v.name.replace(/\+/g, '%2B') + "=" + v.value.replace(/\+/g, '%2B'));}); return s.join("&").replace(/%20/g, '+'); }
Code:.serialize()
Code:.serializeISO8859()
- 1 like
Leave a comment:
-
Cart popup widget corrupts other info input.
Tested on Swift 18.0.6 site with the Cart Popup widget installed.
Give a product an Other Info prompt. E.g. Other Info.
Add product to cart with "Test £25 ¬ ¦" as the other info input.
Display cart and Other Info now contains "Test £25 ¬ ¦".
It looks like all characters with the high bit set are being prefixed with an extraneous "Â".Tags: None
Leave a comment: