Skip to content

Commit

Permalink
Merge branch 'bugfix/ETS-57_avoid-usage-of-customer-default-addresses…
Browse files Browse the repository at this point in the history
…' into release/5.2.6
  • Loading branch information
eiriarte-mendez committed Oct 1, 2018
2 parents fefebf4 + 406d5bf commit a7a5e38
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Component/Model/ShopwareCustomerWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -67,14 +72,18 @@ 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();
}

$getter = 'get' . ucfirst($property);

$billingFresh = $this->getBillingFresh();

if (!is_null($billingFresh)) {
if (Util::existsAndNotEmpty($billingFresh, $getter)) {
return $billingFresh->$getter();
Expand Down

0 comments on commit a7a5e38

Please sign in to comment.