Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setOrders example
if
(
!
$salesChannelContext
->
getCustomer
(
)
&&
$request
->
get
(
'deepLinkCode', false
)
=== false
)
{
throw
CartException::
customerNotLoggedIn
(
)
;
}
$page
=
$this
->genericLoader->
load
(
$request
,
$salesChannelContext
)
;
$page
= AccountOrderPage::
createFrom
(
$page
)
;
$page
->
getMetaInformation
(
)
?->
setRobots
(
'noindex,follow'
)
;
$page
->
setOrders
(
StorefrontSearchResult::
createFrom
(
$this
->
getOrders
(
$request
,
$salesChannelContext
)
)
)
;
$page
->
setDeepLinkCode
(
$request
->
get
(
'deepLinkCode'
)
)
;
$firstOrder
=
$page
->
getOrders
(
)
->
getEntities
(
)
->
first
(
)
;
$orderCustomerId
=
$firstOrder
?->
getOrderCustomer
(
)
?->
getCustomer
(
)
?->
getId
(
)
;
if
(
$request
->
get
(
'deepLinkCode'
)
&&
$orderCustomerId
!== null
)
{
$this
->accountService->
loginById
(
$orderCustomerId
,
$salesChannelContext
)
;
}