diff options
Diffstat (limited to 'StoneIsland/www/js/lib/cart/CartShipping.js')
| -rw-r--r-- | StoneIsland/www/js/lib/cart/CartShipping.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/StoneIsland/www/js/lib/cart/CartShipping.js b/StoneIsland/www/js/lib/cart/CartShipping.js index d1e1a97e..e52eec4c 100644 --- a/StoneIsland/www/js/lib/cart/CartShipping.js +++ b/StoneIsland/www/js/lib/cart/CartShipping.js @@ -15,6 +15,7 @@ var CartShipping = FormView.extend({ initialize: function(opt){ this.parent = opt.parent this.$form = this.$("form") + this.$dropdown_wrapper = this.$(".dropdown-wrapper") this.$address_list = this.$(".address_list") this.$address_form = this.$(".address") this.$msg = this.$(".msg") @@ -37,7 +38,8 @@ var CartShipping = FormView.extend({ this.$(".save_as_default").show() this.$address_list.empty() if (! app.account.addresses.length) { - this.toggle_dropdown(true) + this.toggle_dropdown(false) + return } app.account.addresses.forEach(function(address){ var t = this.template.replace(/{{id}}/g, address.Id) @@ -52,7 +54,11 @@ var CartShipping = FormView.extend({ }, toggle_dropdown: function(state){ + if (! app.account.addresses.length) { + state = false + } this.list_mode = typeof state == "boolean" ? state : ! this.list_mode + this.$dropdown_wrapper.toggle( ! app.account.addresses.length ) this.address.disabled = this.list_mode this.$address_form.toggle(! this.list_mode) this.$address_list.toggle(this.list_mode) @@ -70,6 +76,7 @@ var CartShipping = FormView.extend({ finalize: function(data){ var shipping_info = {}, address_data, address_id var shipping_type = $("[name=ShippingType]").filter(function(){ return $(this).prop("checked") }).val() + sdk.shipping.set_delivery_type({ id: this.shipping_types[shipping_type], success: function(data){ console.log("set shipping type", data) }, |
