Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
enrichFromSearch example
$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
(
)
)
;
}
if
(
$productConfig
->
isMapped
(
)
&&
$resolverContext
instanceof EntityResolverContext
)
{
$products
=
$this
->
resolveEntityValue
(
$resolverContext
->
getEntity
(
)
,
$productConfig
->
getStringValue
(
)
)
;
if
(
$products
=== null
)
{
$this
->
enrichFromSearch
(
$slider
,
$result
, self::PRODUCT_SLIDER_ENTITY_FALLBACK . '_' .
$slot
->
getUniqueIdentifier
(
)
,
$resolverContext
->
getSalesChannelContext
(
)
)
;
}
else
{
$slider
->
setProducts
(
$products
)
;
}
}