Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
ProductCrossSellingStreamCriteriaEvent example
$context
->
getContext
(
)
)
;
$criteria
->
addFilter
(
...
$filters
)
->
setOffset
(
0
)
->
setLimit
(
$crossSelling
->
getLimit
(
)
)
->
addSorting
(
$crossSelling
->
getSorting
(
)
)
;
$criteria
=
$this
->
handleAvailableStock
(
$criteria
,
$context
)
;
$this
->eventDispatcher->
dispatch
(
new
ProductCrossSellingStreamCriteriaEvent
(
$crossSelling
,
$criteria
,
$context
)
)
;
$searchResult
=
$this
->listingLoader->
load
(
$criteria
,
$context
)
;
/** @var ProductCollection $products */
$products
=
$searchResult
->
getEntities
(
)
;
$element
=
new
CrossSellingElement
(
)
;
$element
->
setCrossSelling
(
$crossSelling
)
;
$element
->
setProducts
(
$products
)
;
$element
->
setStreamId
(
$crossSelling
->
getProductStreamId
(
)
)
;