/**
* {@inheritdoc}
*/
public function prepare(PrepareDataCollection
$collection, Element
$element, ShopContextInterface
$context) { $type =
$element->
getConfig()->
get(self::SLIDER_TYPE_KEY, self::TYPE_STATIC_PRODUCT
);
$key = ComponentHandlerInterface::CRITERIA_KEY .
$element->
getId();
switch ($type) { case self::TYPE_PRODUCT_STREAM:
$criteria =
$this->
generateCriteria($element,
$context);
$productStreamId =
$element->
getConfig()->
get('article_slider_stream'
);
$this->productStreamRepository->
prepareCriteria($criteria,
$productStreamId);
// request multiple products by criteria
$collection->
getBatchRequest()->
setCriteria($key,
$criteria);
break;
case self::TYPE_TOPSELLER:
case self::TYPE_NEWCOMER:
case self::TYPE_RANDOM: