$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:
case self::TYPE_LOWEST_PRICE:
case self::TYPE_HIGHEST_PRICE:
$criteria =
$this->
generateCriteria($element,
$context);
// request multiple products by criteria
$collection->
getBatchRequest()->
setCriteria($key,
$criteria);