Fix ship_address_same_as_billing checkbox value with string

This commit is contained in:
Bing Xie
2016-08-18 15:29:16 +10:00
parent d59db1cd97
commit a6cfa061e4
6 changed files with 10 additions and 9 deletions

View File

@@ -9,9 +9,10 @@ Darkswarm.controller "CheckoutCtrl", ($scope, storage, Checkout, CurrentUser, Cu
for field in $scope.fieldsToBind
storage.bind $scope, "Checkout.order.#{field}",
storeName: "#{prefix}_#{field}"
storage.bind $scope, "Checkout.ship_address_same_as_billing",
storeName: "#{prefix}_sameasbilling"
defaultValue: true
defaultValue: 'YES'
$scope.order = Checkout.order # Ordering is important
$scope.secrets = Checkout.secrets

View File

@@ -3,7 +3,7 @@ Darkswarm.factory 'Checkout', (CurrentOrder, ShippingMethods, PaymentMethods, $h
errors: {}
secrets: {}
order: CurrentOrder.order
ship_address_same_as_billing: true
ship_address_same_as_billing: 'YES'
submit: ->
Loading.message = t 'submitting_order'
@@ -33,7 +33,7 @@ Darkswarm.factory 'Checkout', (CurrentOrder, ShippingMethods, PaymentMethods, $h
else
# Ignore everything else
if @ship_address_same_as_billing
if @ship_address_same_as_billing == 'YES'
munged_order.ship_address_attributes = munged_order.bill_address_attributes
# If the order already has a ship and bill address (as with logged in users with
# past orders), and we don't remove id here, then this will set the wrong id for