From 406d5bf56ca81c9a97d3b801b7c5ae9c6451ecf9 Mon Sep 17 00:00:00 2001 From: Eduardo Iriarte Date: Fri, 28 Sep 2018 16:31:50 +0200 Subject: [PATCH] [ETS-57] avoid usage of customer default addresses in checkout --- Component/Model/ShopwareCustomerWrapper.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Component/Model/ShopwareCustomerWrapper.php b/Component/Model/ShopwareCustomerWrapper.php index 573660f6..df039722 100644 --- a/Component/Model/ShopwareCustomerWrapper.php +++ b/Component/Model/ShopwareCustomerWrapper.php @@ -37,6 +37,11 @@ public function __construct(Customer $customer, $em) */ public function getShipping($property = null) { + $shippingId = Shopware()->Session()->offsetGet('checkoutShippingAddressId'); + if (!empty($shippingId)) { + return Shopware()->Models()->find('Shopware\Models\Customer\Address', $shippingId); + } + if (is_null($property)) { return $this->getShippingChaotic(); } @@ -67,6 +72,11 @@ public function getShipping($property = null) */ public function getBilling($property = null) { + $billingId = Shopware()->Session()->offsetGet('checkoutBillingAddressId'); + if (!empty($billingId)) { + return Shopware()->Models()->find('Shopware\Models\Customer\Address', $billingId); + } + if (is_null($property)) { return $this->getBillingChaotic(); } @@ -74,7 +84,6 @@ public function getBilling($property = null) $getter = 'get' . ucfirst($property); $billingFresh = $this->getBillingFresh(); - if (!is_null($billingFresh)) { if (Util::existsAndNotEmpty($billingFresh, $getter)) { return $billingFresh->$getter();