Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setCountries example
public
function
load
(
Request
$request
, SalesChannelContext
$salesChannelContext
)
: AccountLoginPage
{
$page
=
$this
->genericLoader->
load
(
$request
,
$salesChannelContext
)
;
$page
= AccountLoginPage::
createFrom
(
$page
)
;
if
(
$page
->
getMetaInformation
(
)
)
{
$page
->
getMetaInformation
(
)
->
setRobots
(
'noindex,follow'
)
;
}
$page
->
setCountries
(
$this
->
getCountries
(
$salesChannelContext
)
)
;
$page
->
setSalutations
(
$this
->
getSalutations
(
$salesChannelContext
)
)
;
$this
->eventDispatcher->
dispatch
(
new
AccountLoginPageLoadedEvent
(
$page
,
$salesChannelContext
,
$request
)
)
;
return
$page
;
}
/** * @throws InconsistentCriteriaIdsException */
$page
=
$this
->genericLoader->
load
(
$request
,
$salesChannelContext
)
;
$page
= AddressDetailPage::
createFrom
(
$page
)
;
if
(
$page
->
getMetaInformation
(
)
)
{
$page
->
getMetaInformation
(
)
->
setRobots
(
'noindex,follow'
)
;
}
$page
->
setSalutations
(
$this
->
getSalutations
(
$salesChannelContext
)
)
;
$page
->
setCountries
(
$this
->
getCountries
(
$salesChannelContext
)
)
;
$page
->
setAddress
(
$this
->
getAddress
(
$request
,
$salesChannelContext
,
$customer
)
)
;
$this
->eventDispatcher->
dispatch
(
new
AddressDetailPageLoadedEvent
(
$page
,
$salesChannelContext
,
$request
)
)
;
return
$page
;
}
/** * @throws InconsistentCriteriaIdsException */
public
function
load
(
Request
$request
, SalesChannelContext
$salesChannelContext
)
: CheckoutCartPage
{
$page
=
$this
->genericLoader->
load
(
$request
,
$salesChannelContext
)
;
$page
= CheckoutCartPage::
createFrom
(
$page
)
;
if
(
$page
->
getMetaInformation
(
)
)
{
$page
->
getMetaInformation
(
)
->
setRobots
(
'noindex,follow'
)
;
}
$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
)
)
;
public
function
load
(
Request
$request
, SalesChannelContext
$salesChannelContext
)
: CheckoutRegisterPage
{
$page
=
$this
->genericLoader->
load
(
$request
,
$salesChannelContext
)
;
$page
= CheckoutRegisterPage::
createFrom
(
$page
)
;
if
(
$page
->
getMetaInformation
(
)
)
{
$page
->
getMetaInformation
(
)
->
setRobots
(
'noindex,follow'
)
;
}
$page
->
setCountries
(
$this
->
getCountries
(
$salesChannelContext
)
)
;
$page
->
setCart
(
$this
->cartService->
getCart
(
$salesChannelContext
->
getToken
(
)
,
$salesChannelContext
)
)
;
$page
->
setSalutations
(
$this
->
getSalutations
(
$salesChannelContext
)
)
;
$addressId
=
$request
->attributes->
get
(
'addressId'
)
;
if
(
$addressId
)
{
$address
=
$this
->
getById
(
(string)
$addressId
,
$salesChannelContext
)
;
$page
->
setAddress
(
$address
)
;
}
$this
->eventDispatcher->
dispatch
(
new
CheckoutRegisterPageLoadedEvent
(
$page
,
$salesChannelContext
,
$request
)
)
;
public
function
load
(
Request
$request
, SalesChannelContext
$salesChannelContext
, CustomerEntity
$customer
)
: AddressListingPage
{
$page
=
$this
->genericLoader->
load
(
$request
,
$salesChannelContext
)
;
$page
= AddressListingPage::
createFrom
(
$page
)
;
$page
->
setSalutations
(
$this
->
getSalutations
(
$salesChannelContext
)
)
;
$page
->
setCountries
(
$this
->
getCountries
(
$salesChannelContext
)
)
;
$criteria
=
(
new
Criteria
(
)
)
->
addSorting
(
new
FieldSorting
(
'firstName', FieldSorting::ASCENDING
)
)
;
$page
->
setAddresses
(
$this
->listAddressRoute->
load
(
$criteria
,
$salesChannelContext
,
$customer
)
->
getAddressCollection
(
)
)
;
$page
->
setCart
(
$this
->cartService->
getCart
(
$salesChannelContext
->
getToken
(
)
,
$salesChannelContext
)
)
;
$page
->
setAddress
(
$page
->
getAddresses
(
)
->
get
(
$request
->
get
(
'addressId'
)
)
)
;