Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setBillingAddress example
$addressIds
=
[
]
;
foreach
(
$customers
as
$customer
)
{
$addressIds
[
]
=
$customer
->
getDefaultBillingAddressId
(
)
;
$addressIds
[
]
=
$customer
->
getDefaultShippingAddressId
(
)
;
}
$addresses
=
$this
->addressGateway->
getList
(
$addressIds
)
;
foreach
(
$customers
as
$id
=> &
$customer
)
{
$addressId
=
$customer
->
getDefaultBillingAddressId
(
)
;
if
(
\
array_key_exists
(
$addressId
,
$addresses
)
)
{
$customer
->
setBillingAddress
(
$addresses
[
$addressId
]
)
;
}
$addressId
=
$customer
->
getDefaultShippingAddressId
(
)
;
if
(
\
array_key_exists
(
$addressId
,
$addresses
)
)
{
$customer
->
setShippingAddress
(
$addresses
[
$addressId
]
)
;
}
}
return
$customers
;
}
}