Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setDeepLinkCode example
/** @var OrderEntity $order */
$order
=
$orderRouteResponse
->
getOrders
(
)
->
first
(
)
;
if
(
$this
->
isOrderPaid
(
$order
)
)
{
throw
OrderException::
orderAlreadyPaid
(
$order
->
getId
(
)
)
;
}
$page
->
setOrder
(
$order
)
;
$page
->
setPaymentChangeable
(
$this
->
isPaymentChangeable
(
$orderRouteResponse
,
$page
)
)
;
$page
->
setPaymentMethods
(
$this
->
getPaymentMethods
(
$salesChannelContext
,
$request
,
$order
)
)
;
$page
->
setDeepLinkCode
(
$request
->
get
(
'deepLinkCode'
)
)
;
$this
->eventDispatcher->
dispatch
(
new
AccountEditOrderPageLoadedEvent
(
$page
,
$salesChannelContext
,
$request
)
)
;
return
$page
;
}
private
function
getOrder
(
Request
$request
, SalesChannelContext
$context
)
: OrderRouteResponse
{
$criteria
=
$this
->
createCriteria
(
$request
,
$context
)
;
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
)
;
}
$this
->eventDispatcher->
dispatch
(