Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
ProductCrossSellingIdsCriteriaEvent example
if
(
!\
count
(
$ids
)
)
{
return
$element
;
}
$criteria
->
setIds
(
$ids
)
;
$criteria
->
addFilter
(
$filter
)
;
$criteria
->
addAssociation
(
'options.group'
)
;
$criteria
=
$this
->
handleAvailableStock
(
$criteria
,
$context
)
;
$this
->eventDispatcher->
dispatch
(
new
ProductCrossSellingIdsCriteriaEvent
(
$crossSelling
,
$criteria
,
$context
)
)
;
$result
=
$this
->productRepository
->
search
(
$criteria
,
$context
)
;
/** @var ProductCollection $products */
$products
=
$result
->
getEntities
(
)
;
$products
->
sortByIdArray
(
$ids
)
;
$element
->
setProducts
(
$products
)
;