Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
Cms example
public
function
indexAction
(
)
{
if
(
$this
->
Request
(
)
->
getParam
(
'isXHR'
)
)
{
$this
->
View
(
)
->
loadTemplate
(
'frontend/custom/ajax.tpl'
)
;
}
$shopId
=
$this
->container->
get
(
ContextServiceInterface::
class
)
->
getShopContext
(
)
->
getShop
(
)
->
getId
(
)
;
$staticPage
=
Shopware
(
)
->
Modules
(
)
->
Cms
(
)
->
sGetStaticPage
(
$this
->
Request
(
)
->
get
(
'sCustom'
)
,
$shopId
)
;
if
(
!\
is_array
(
$staticPage
)
)
{
throw
new
ResourceNotFoundException
(
'Custom page not found',
$this
->
Request
(
)
)
;
}
if
(
!
empty
(
$staticPage
[
'link'
]
)
)
{
$link
=
Shopware
(
)
->
Modules
(
)
->
Core
(
)
->
sRewriteLink
(
$staticPage
[
'link'
]
,
$staticPage
[
'description'
]
)
;
$this
->
redirect
(
$link
,
[
'code' => Response::HTTP_MOVED_PERMANENTLY
]
)
;
return
;
}