Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getVotes example
if
(
empty
(
$data
[
'images'
]
)
)
{
if
(
$product
->
getCover
(
)
)
{
$data
[
'image'
]
=
$this
->
convertMediaStruct
(
$product
->
getCover
(
)
)
;
}
}
else
{
$data
[
'image'
]
=
array_shift
(
$data
[
'images'
]
)
;
}
// Convert product voting
foreach
(
$product
->
getVotes
(
)
as
$vote
)
{
$data
[
'sVoteComments'
]
[
]
=
$this
->
convertVoteStruct
(
$vote
)
;
}
$data
[
'sVoteAverage'
]
=
[
'average' => 0, 'count' => 0
]
;
if
(
$product
->
getVoteAverage
(
)
)
{
$data
[
'sVoteAverage'
]
=
$this
->
convertVoteAverageStruct
(
$product
->
getVoteAverage
(
)
)
;
}
if
(
$product
->
getPropertySet
(
)
)
{
$data
[
'filtergroupID'
]
=
$product
->
getPropertySet
(
)
->
getId
(
)
;