Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
OffcanvasCartPageLoadedEvent example
$page
= OffcanvasCartPage::
createFrom
(
$page
)
;
if
(
$page
->
getMetaInformation
(
)
)
{
$page
->
getMetaInformation
(
)
->
assign
(
[
'robots' => 'noindex,follow'
]
)
;
}
$page
->
setCart
(
$this
->cartService->
get
(
$salesChannelContext
->
getToken
(
)
,
$salesChannelContext
)
)
;
$page
->
setShippingMethods
(
$this
->
getShippingMethods
(
$salesChannelContext
)
)
;
$this
->eventDispatcher->
dispatch
(
new
OffcanvasCartPageLoadedEvent
(
$page
,
$salesChannelContext
,
$request
)
)
;
return
$page
;
}
private
function
getShippingMethods
(
SalesChannelContext
$context
)
: ShippingMethodCollection
{
$request
=
new
Request
(
)
;
$request
->query->
set
(
'onlyAvailable', '1'
)
;
return
$this
->shippingMethodRoute->
load
(
$request
,
$context
,
new
Criteria
(
)
)
->
getShippingMethods
(
)
;
}