summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js
diff options
context:
space:
mode:
authorRene Ae <aehtyb@gmail.com>2015-11-30 15:24:27 -0600
committerRene Ae <aehtyb@gmail.com>2015-11-30 15:24:27 -0600
commit9d0e54228c79d151c30c527ea83efa7479793686 (patch)
tree3baf83427cd61cb1994e8551eefba5cd21d1a65b /StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js
parentb208cb0283c23d68e8013c0dd5ddd4e5e6df8950 (diff)
parentd26e72aea3b3127c95c5ba7069c95f73cf52a2fd (diff)
Merge branch 'master' of https://github.com/okfocus/stone-island
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js')
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js24
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")
},
})
},