wojodesign/simplecart-js — Issue #189: Ampersand in text fields
Author: glenpike
Created: 2012-01-08 16:12:03+00:00
State: open

There seems to be a problem with submitting carts to Paypal where there are options/custom fields with an ampersand character in the value. SimpleCart does not escape these, so the fields get truncated:

To Fix, in the paypalCheckout function, replace:

for( var field in item ){
if( typeof(item[field]) != "function" && field != "id" && field != "price" && field != "quantity" && field != "name" && field != "shipping") {
optionsString = optionsString + ", " + field + "=" + item[field] ;
}
}

With:

for( var field in item ){
if( typeof(item[field]) != "function" && field != "id" && field != "price" && field != "quantity" && field != "name" && field != "shipping") {
optionsString = optionsString + ", " + field + "=" + escape(item[field]) ;
}
}