Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setSalutations example
$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'
)
)
)
;
public
function
load
(
Request
$request
, SalesChannelContext
$salesChannelContext
, CustomerEntity
$customer
)
: AddressDetailPage
{
$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
;
}
throw
CartException::
customerNotLoggedIn
(
)
;
}
$page
=
$this
->genericLoader->
load
(
$request
,
$salesChannelContext
)
;
$page
= AccountProfilePage::
createFrom
(
$page
)
;
if
(
$page
->
getMetaInformation
(
)
)
{
$page
->
getMetaInformation
(
)
->
setRobots
(
'noindex,follow'
)
;
}
$page
->
setSalutations
(
$this
->
getSalutations
(
$salesChannelContext
,
$request
)
)
;
$this
->eventDispatcher->
dispatch
(
new
AccountProfilePageLoadedEvent
(
$page
,
$salesChannelContext
,
$request
)
)
;
return
$page
;
}
private
function
getSalutations
(
SalesChannelContext
$context
, Request
$request
)
: SalutationCollection
{
$event
=
new
SalutationRouteRequestEvent
(
$request
,
new
Request
(
)
,
$context
,
new
Criteria
(
)
)
;
$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 */