$categoryId =
(int) $element->
getConfig()->
get('article_slider_category'
);
if ($type === self::TYPE_PRODUCT_STREAM
) { $categoryId =
$context->
getShop()->
getCategory()->
getId();
} $criteria =
$this->criteriaFactory->
createBaseCriteria([$categoryId],
$context);
$criteria->
limit($limit);
switch ($type) { case self::TYPE_LOWEST_PRICE:
$criteria->
addSorting(new PriceSorting(SortingInterface::SORT_ASC
));
break;
case self::TYPE_HIGHEST_PRICE:
$criteria->
addSorting(new PriceSorting(SortingInterface::SORT_DESC
));
break;
case self::TYPE_TOPSELLER:
$criteria->
addSorting(new PopularitySorting(SortingInterface::SORT_DESC
));
break;
case self::TYPE_NEWCOMER:
$criteria->
addSorting(new ReleaseDateSorting(SortingInterface::SORT_DESC
));
break;
case self::TYPE_RANDOM: