Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getArticleRelated example
protected
function
getArticle
(
$id
)
{
$data
=
$this
->
getArticleData
(
$id
)
;
$tax
=
$data
[
0
]
[
'tax'
]
;
$data
[
0
]
[
'categories'
]
=
$this
->
getArticleCategories
(
$id
)
;
$data
[
0
]
[
'seoCategories'
]
=
$this
->
getArticleSeoCategories
(
$id
)
;
$data
[
0
]
[
'similar'
]
=
$this
->
getArticleSimilars
(
$id
)
;
$data
[
0
]
[
'streams'
]
=
$this
->
getArticleRelatedProductStreams
(
$id
)
;
$data
[
0
]
[
'related'
]
=
$this
->
getArticleRelated
(
$id
)
;
$data
[
0
]
[
'images'
]
=
$this
->
getArticleImages
(
$id
)
;
$data
[
0
]
[
'links'
]
=
$this
->
getArticleLinks
(
$id
)
;
$data
[
0
]
[
'downloads'
]
=
$this
->
getArticleDownloads
(
$id
)
;
$data
[
0
]
[
'customerGroups'
]
=
$this
->
getArticleCustomerGroups
(
$id
)
;
$data
[
0
]
[
'mainPrices'
]
=
$this
->
getPrices
(
$data
[
0
]
[
'mainDetail'
]
[
'id'
]
,
$tax
)
;
$data
[
0
]
[
'configuratorSet'
]
=
$this
->
getArticleConfiguratorSet
(
$id
)
;
$data
[
0
]
[
'dependencies'
]
=
[
]
;
if
(
!
empty
(
$data
[
0
]
[
'configuratorSetId'
]
)
)
{
if
(
$product
=== null
)
{
throw
new
NotFoundException
(
sprintf
(
'Product by id "%d" not found',
$id
)
)
;
}
if
(
$this
->
getResultMode
(
)
=== self::HYDRATE_ARRAY
)
{
$product
[
'images'
]
=
$this
->
getArticleImages
(
$id
)
;
$product
[
'configuratorSet'
]
=
$this
->
getArticleConfiguratorSet
(
$id
)
;
$product
[
'links'
]
=
$this
->
getArticleLinks
(
$id
)
;
$product
[
'downloads'
]
=
$this
->
getArticleDownloads
(
$id
)
;
$product
[
'categories'
]
=
$this
->
getArticleCategories
(
$id
)
;
$product
[
'similar'
]
=
$this
->
getArticleSimilar
(
$id
)
;
$product
[
'related'
]
=
$this
->
getArticleRelated
(
$id
)
;
$product
[
'details'
]
=
$this
->
getArticleVariants
(
$id
)
;
$product
[
'seoCategories'
]
=
$this
->
getArticleSeoCategories
(
$id
)
;
if
(
isset
(
$options
[
'considerTaxInput'
]
)
&&
$options
[
'considerTaxInput'
]
)
{
$product
[
'mainDetail'
]
[
'prices'
]
=
$this
->
getTaxPrices
(
$product
[
'mainDetail'
]
[
'prices'
]
,
$product
[
'tax'
]
[
'tax'
]
)
;
foreach
(
$product
[
'details'
]
as
&
$detail
)
{
$detail
[
'prices'
]
=
$this
->
getTaxPrices
(