Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setNavigationId example
$navigationId
=
$request
->
get
(
'navigationId',
$context
->
getSalesChannel
(
)
->
getNavigationCategoryId
(
)
)
;
$category
=
$this
->cmsPageRoute
->
load
(
$navigationId
,
$request
,
$context
)
->
getCategory
(
)
;
if
(
!
$category
->
getActive
(
)
)
{
throw
new
CategoryNotFoundException
(
$category
->
getId
(
)
)
;
}
$this
->
loadMetaData
(
$category
,
$page
,
$context
->
getSalesChannel
(
)
)
;
$page
->
setNavigationId
(
$category
->
getId
(
)
)
;
if
(
$category
->
getCmsPage
(
)
)
{
$page
->
setCmsPage
(
$category
->
getCmsPage
(
)
)
;
}
$this
->eventDispatcher->
dispatch
(
new
NavigationPageLoadedEvent
(
$page
,
$context
,
$request
)
)
;
if
(
$page
->
getMetaInformation
(
)
)
{
$canonical
=
(
$navigationId
===
$context
->
getSalesChannel
(
)
->
getNavigationCategoryId
(
)
)
?
if
(
$category
=
$product
->
getSeoCategory
(
)
)
{
$request
->request->
set
(
'navigationId',
$category
->
getId
(
)
)
;
}
$page
=
$this
->genericLoader->
load
(
$request
,
$context
)
;
$page
= ProductPage::
createFrom
(
$page
)
;
$page
->
setProduct
(
$product
)
;
$page
->
setConfiguratorSettings
(
$result
->
getConfigurator
(
)
??
new
PropertyGroupCollection
(
)
)
;
$page
->
setNavigationId
(
$product
->
getId
(
)
)
;
if
(
!Feature::
isActive
(
'v6.6.0.0'
)
)
{
$this
->
loadDefaultAdditions
(
$product
,
$page
,
$request
,
$context
)
;
}
elseif
(
$cmsPage
=
$product
->
getCmsPage
(
)
)
{
$page
->
setCmsPage
(
$cmsPage
)
;
}
$this
->
loadOptions
(
$page
)
;
$this
->
loadMetaData
(
$page
)
;
$this
->eventDispatcher->
dispatch
(