From 09bdbefbf35ddfa6a6008d284ecd92264969c507 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov <sidolov@ebay.com> Date: Thu, 25 Jun 2015 16:24:05 +0300 Subject: [PATCH] MAGETWO-39060: "Save in address book" is presented on shipping form for customers without addresses --- .../Checkout/view/frontend/web/js/view/billing-address.js | 6 ++++++ .../view/frontend/web/template/billing-address/form.html | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js index f8f4f68a09e..d83bb9ed58e 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js @@ -60,6 +60,8 @@ define( addressOptions: addressOptions, + customerHasAddresses: addressOptions.length > 1, + addressOptionsText: function(address) { return address.getAddressInline(); }, @@ -82,6 +84,10 @@ define( this.source.trigger(this.dataScopePrefix + '.data.validate'); if (!this.source.get('params.invalid')) { var addressData = this.source.get(this.dataScopePrefix); + + if (this.isCustomerLoggedIn && !this.customerHasAddresses) { + this.saveInAddressBook = true; + } addressData.save_in_address_book = this.saveInAddressBook; // New address must be selected as a billing address diff --git a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html index ec88cbef634..4174aa194d6 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html @@ -13,7 +13,7 @@ <!-- ko foreach: getRegion('additional-fieldsets') --> <!-- ko template: getTemplate() --><!-- /ko --> <!--/ko--> - <!-- ko if: (isCustomerLoggedIn) --> + <!-- ko if: (isCustomerLoggedIn && customerHasAddresses) --> <div class="choice field"> <input type="checkbox" class="checkbox" id="billing-save-in-address-book" data-bind="checked: saveInAddressBook" /> <label class="label" for="billing-save-in-address-book"> -- GitLab