Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
convertToLegacyAddressArray example
// Temporarily overwrite billing address
if
(
!
$this
->session->
offsetGet
(
'checkoutBillingAddressId'
)
|| \
strtolower
(
Shopware
(
)
->
Front
(
)
->
Request
(
)
->
getControllerName
(
)
)
!== 'checkout'
)
{
return
$userData
;
}
$addressRepository
=
Shopware
(
)
->
Models
(
)
->
getRepository
(
Address::
class
)
;
$addressId
=
$this
->session->
offsetGet
(
'checkoutBillingAddressId'
)
;
try
{
$legacyAddress
=
$this
->
convertToLegacyAddressArray
(
$addressRepository
->
getOneByUser
(
$addressId
,
$this
->session->
offsetGet
(
'sUserId'
)
)
)
;
$userData
[
'billingaddress'
]
=
array_merge
(
$userData
[
'billingaddress'
]
,
$legacyAddress
)
;
$userData
=
$this
->
completeUserCountryData
(
$userData
)
;
}
catch
(
Exception
$ex
)
{
// No need to overwrite default billing address
$this
->session->
offsetUnset
(
'checkoutBillingAddressId'
)
;
}
return
$userData
;
}