Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isBlog example
$productStream
= null;
if
(
$category
->
getProductStream
(
)
)
{
$productStream
=
$this
->
convertRelatedProductStreamStruct
(
$category
->
getProductStream
(
)
)
;
}
$categoryPath
= '|' .
implode
(
'|',
$category
->
getPath
(
)
)
. '|';
$blogBaseUrl
=
$this
->config->
get
(
'baseFile'
)
. '?sViewport=blog&sCategory=';
$baseUrl
=
$this
->config->
get
(
'baseFile'
)
. '?sViewport=cat&sCategory=';
$detailUrl
=
(
$category
->
isBlog
(
)
?
$blogBaseUrl
:
$baseUrl
)
.
$category
->
getId
(
)
;
$canonicalParams
=
$this
->
getCategoryCanonicalParams
(
$category
)
;
if
(
$media
&& !\
array_key_exists
(
'path',
$media
)
)
{
$media
[
'path'
]
=
$media
[
'source'
]
;
}
$data
=
[
'id' =>
$category
->
getId
(
)
,
'parentId' =>
$category
->
getParentId
(
)
,
'name' =>
$category
->
getName
(
)
,
'position' =>
$category
->
getPosition
(
)
,
public
function
convertCategory
(
Category
$category
,
$childrenCounts
)
{
$childrenCount
= 0;
if
(
isset
(
$childrenCounts
[
$category
->
getId
(
)
]
)
)
{
$childrenCount
=
$childrenCounts
[
$category
->
getId
(
)
]
;
}
$url
=
$category
->
isBlog
(
)
?
$this
->blogBaseUrl :
$this
->baseUrl;
$attribute
=
[
]
;
foreach
(
$category
->
getAttributes
(
)
as
$struct
)
{
$attribute
=
array_merge
(
$attribute
,
$struct
->
toArray
(
)
)
;
}
$media
=
[
]
;
if
(
$category
->
getMedia
(
)
)
{
$media
=
[
'id' =>
$category
->
getMedia
(
)
->
getId
(
)
,
'name' =>
$category
->
getMedia
(
)
->
getName
(
)
,