Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
ProductSliderStruct example
if
(
$products
->
isProductStream
(
)
&&
$products
->
getValue
(
)
)
{
$criteria
=
$this
->
collectByProductStream
(
$resolverContext
,
$products
,
$config
)
;
$collection
->
add
(
self::PRODUCT_SLIDER_ENTITY_FALLBACK . '_' .
$slot
->
getUniqueIdentifier
(
)
, ProductDefinition::
class
,
$criteria
)
;
}
return
$collection
->
all
(
)
?
$collection
: null;
}
public
function
enrich
(
CmsSlotEntity
$slot
, ResolverContext
$resolverContext
, ElementDataCollection
$result
)
: void
{
$config
=
$slot
->
getFieldConfig
(
)
;
$slider
=
new
ProductSliderStruct
(
)
;
$slot
->
setData
(
$slider
)
;
$productConfig
=
$config
->
get
(
'products'
)
;
if
(
$productConfig
=== null
)
{
return
;
}
if
(
$productConfig
->
isStatic
(
)
)
{
$this
->
enrichFromSearch
(
$slider
,
$result
, self::STATIC_SEARCH_KEY . '_' .
$slot
->
getUniqueIdentifier
(
)
,
$resolverContext
->
getSalesChannelContext
(
)
)
;
}