Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
CheckoutCartPageLoadedEvent example
$page
->
setCountries
(
$this
->
getCountries
(
$salesChannelContext
)
)
;
$page
->
setPaymentMethods
(
$this
->
getPaymentMethods
(
$salesChannelContext
)
)
;
$page
->
setShippingMethods
(
$this
->
getShippingMethods
(
$salesChannelContext
)
)
;
$page
->
setCart
(
$this
->cartService->
get
(
$salesChannelContext
->
getToken
(
)
,
$salesChannelContext
)
)
;
$this
->eventDispatcher->
dispatch
(
new
CheckoutCartPageLoadedEvent
(
$page
,
$salesChannelContext
,
$request
)
)
;
return
$page
;
}
private
function
getPaymentMethods
(
SalesChannelContext
$context
)
: PaymentMethodCollection
{
$request
=
new
Request
(
)
;
$request
->query->
set
(
'onlyAvailable', '1'
)
;
return
$this
->paymentMethodRoute->
load
(
$request
,
$context
,
new
Criteria
(
)
)
->
getPaymentMethods
(
)
;
}