Commit 1d23b806 by Douglas Hall

Fix JQuery data attribute type conversion bug for shopping cart

parent 81d2c75d
...@@ -372,14 +372,14 @@ from openedx.core.lib.courses import course_image_url ...@@ -372,14 +372,14 @@ from openedx.core.lib.courses import course_image_url
var newQty = parseInt(newQty); var newQty = parseInt(newQty);
var unit_cost = parseFloat(unit_cost); var unit_cost = parseFloat(unit_cost);
return (( newQty - prevQty ) * unit_cost + prevTotal) return (( newQty - prevQty ) * unit_cost + parseFloat(prevTotal));
} }
function update_user_cart(ItemId, newQty, prevQty, unit_cost, wasbusinessType, isbusinessType){ function update_user_cart(ItemId, newQty, prevQty, unit_cost, wasbusinessType, isbusinessType){
var post_url = "${reverse('shoppingcart.views.update_user_cart')}"; var post_url = "${reverse('shoppingcart.views.update_user_cart')}";
var typeChanged = false; var typeChanged = false;
var prevTotal = $('#total-amount').data('amount') var prevTotal = $('#total-amount').data('amount');
var newTotal = getNewTotal(prevQty, newQty, unit_cost, prevTotal); var newTotal = getNewTotal(prevQty, newQty, unit_cost, prevTotal);
$('#total-amount').html('$'+newTotal.toFixed(2)+' USD'); $('#total-amount').html('$'+newTotal.toFixed(2)+' USD');
$('#total-amount').data('amount', newTotal); $('#total-amount').data('amount', newTotal);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment