summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/cart
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-11-25 04:08:39 -0500
committerJules Laplace <jules@okfoc.us>2015-11-25 04:08:39 -0500
commitf0c551933c5e725b980014b559d757bee99d0536 (patch)
treeba8f090c42934f3ef601eb8d0e42b4398242fc68 /StoneIsland/www/js/lib/cart
parente024c35a2584f5d975b3b4f8fe942bb8e35b6e47 (diff)
fix auth bugs pt 1
Diffstat (limited to 'StoneIsland/www/js/lib/cart')
-rw-r--r--StoneIsland/www/js/lib/cart/CartSummary.js18
-rw-r--r--StoneIsland/www/js/lib/cart/CartView.js14
2 files changed, 24 insertions, 8 deletions
diff --git a/StoneIsland/www/js/lib/cart/CartSummary.js b/StoneIsland/www/js/lib/cart/CartSummary.js
index 209e3102..05842380 100644
--- a/StoneIsland/www/js/lib/cart/CartSummary.js
+++ b/StoneIsland/www/js/lib/cart/CartSummary.js
@@ -110,21 +110,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 +140,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 +156,9 @@ 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
-
+
+ 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,6 +166,7 @@ var CartSummary = ScrollableView.extend({
this.updateTotals()
this.updateCounts()
$el.remove()
+ this.refreshScroller()
if (this.data.Cart.Items.length == 0) {
this.empty()
diff --git a/StoneIsland/www/js/lib/cart/CartView.js b/StoneIsland/www/js/lib/cart/CartView.js
index 8bea43dc..b57caadd 100644
--- a/StoneIsland/www/js/lib/cart/CartView.js
+++ b/StoneIsland/www/js/lib/cart/CartView.js
@@ -15,6 +15,8 @@ var CartView = View.extend({
this.confirm = new CartConfirm ({ parent: this })
this.thanks = new CartThanks ({ parent: this })
+ this.$full_msg = this.$(".full_msg")
+ this.$empty_msg = this.$(".empty_msg")
this.$itemcount = this.$(".itemcount")
},
@@ -47,4 +49,16 @@ var CartView = View.extend({
this.payment.show()
},
+ setHeaderCount: function(n){
+ if (n) {
+ this.$itemcount.html(pluralize(n, "ITEM", "S"))
+ this.$full_msg.show()
+ this.$empty_msg.hide()
+ }
+ else {
+ this.$full_msg.hide()
+ this.$empty_msg.show()
+ }
+ },
+
}) \ No newline at end of file