diff options
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js')
| -rw-r--r-- | StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js b/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js index 209e3102..9a24afa5 100644 --- a/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js +++ b/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js @@ -27,6 +27,7 @@ var CartSummary = ScrollableView.extend({ show: function(){ document.body.className = "cart" app.cart.el.className = "summary" + window.location.hash = "#/cart/summary" if (auth.has_cart()) { this.load() } @@ -110,21 +111,21 @@ var CartSummary = ScrollableView.extend({ .replace(/{{price}}/, as_cash(details.Item.Price.DiscountedPrice)) $el.data("price", details.Item.Price.DiscountedPrice) $el.html(t) - this.deferScrollToTop() + this.refreshScroller() }.bind(this)) }.bind(this)) this.updateTotals() this.el.className = "full" - this.deferScrollToTop() + this.refreshScroller() }, updateCounts: function(){ - app.header.set_cart_count(this.data.Cart.Items.length) - this.parent.$itemcount.html(pluralize(this.data.Cart.Items.length, "ITEM", "S")) + app.header.set_cart_count( this.data.Cart.Items.length ) + this.parent.setHeaderCount( this.data.Cart.Items.length ) }, - + updateTotals: function(){ var subtotal = this.data.Cart.Totals.TotalWithoutPromotions var shipping_cost = this.data.Cart.DeliveryMethod.Selected.Amount.Total @@ -140,6 +141,7 @@ var CartSummary = ScrollableView.extend({ empty: function(){ app.footer.hide() app.header.set_cart_count(0) + this.parent.setHeaderCount( 0 ) this.parent.$itemcount.html("0 ITEMS") this.el.className = "empty" }, @@ -155,9 +157,11 @@ var CartSummary = ScrollableView.extend({ remove_item: function(e){ var $el = $( e.currentTarget ).closest(".cart_item_row") var data = $el.data() - data.Cart.Totals.TotalWithoutPromotions -= data.price - data.Cart.Totals.TotalToPay -= data.price - + + console.log(this.data.Cart) + + this.data.Cart.Totals.TotalWithoutPromotions -= data.price + this.data.Cart.Totals.TotalToPay -= data.price this.data.Cart.Items = this.data.Cart.Items.filter(function(item){ return ( item['Code10'] !== data.code || item['Size'] !== data.size) }) @@ -165,18 +169,20 @@ var CartSummary = ScrollableView.extend({ this.updateTotals() this.updateCounts() $el.remove() + this.refreshScroller() if (this.data.Cart.Items.length == 0) { this.empty() } + app.curtain.show("loading") sdk.cart.delete_item({ data: { Code10: data.code, Size: data.size, }, success: function(){ - console.log("damn") + app.curtain.hide("loading") }, }) }, |
