/**
  * {@inheritdoc}
  */
 public function generateSorting(SortingInterface $sorting, QueryBuilder $query, ShopContextInterface $context)
 {
     if (!$query->hasState(SearchTermConditionHandler::STATE_INCLUDES_RANKING)) {
         return;
     }
     /** @var SearchRankingSorting $sorting */
     $query->addOrderBy('searchTable.ranking', $sorting->getDirection());
     $query->addOrderBy('product.id', $sorting->getDirection());
 }
 /**
  * {@inheritdoc}
  */
 public function generateSorting(SortingInterface $sorting, QueryBuilder $query, ShopContextInterface $context)
 {
     /** @var ProductAttributeSorting $sorting */
     if (!$sorting->getField()) {
         throw new \Exception('ProductAttributeSorting class requires a defined attribute field!');
     }
     $query->addOrderBy('productAttribute.' . $sorting->getField(), $sorting->getDirection());
 }
 /**
  * {@inheritdoc}
  */
 public function generateSorting(SortingInterface $sorting, QueryBuilder $query, ShopContextInterface $context)
 {
     if (!$query->hasState(SalesConditionHandler::STATE_INCLUDES_TOPSELLER_TABLE)) {
         $query->leftJoin('product', 's_articles_top_seller_ro', 'topSeller', 'topSeller.article_id = product.id');
         $query->addState(SalesConditionHandler::STATE_INCLUDES_TOPSELLER_TABLE);
     }
     /** @var PopularitySorting $sorting */
     $query->addOrderBy('topSeller.sales', $sorting->getDirection())->addOrderBy('topSeller.article_id', $sorting->getDirection());
 }
 public function extendQuery($alias, AbstractSortDefinition $definition, RuleVo $rule, QueryBuilder $queryBuilder)
 {
     $sort = $this->getOrderByProvider()->getSort($alias, $definition);
     $order = $this->getOrderByProvider()->getOrder($rule);
     foreach ($this->getDataFilters() as $filter) {
         $filter->setUp($alias, $definition, $rule);
         $sort = $filter->filterSort($sort);
         $order = $filter->filterOrder($order);
     }
     $queryBuilder->addOrderBy($sort, $order);
 }
 /**
  * {@inheritdoc}
  */
 public function generateSorting(SortingInterface $sorting, QueryBuilder $query, ShopContextInterface $context)
 {
     /** @var ReleaseDateSorting $sorting */
     $query->addOrderBy('product.datum', $sorting->getDirection())->addOrderBy('product.changetime', $sorting->getDirection())->addOrderBy('product.id', $sorting->getDirection());
 }
 /**
  * {@inheritdoc}
  */
 public function generateSorting(SortingInterface $sorting, QueryBuilder $query, ShopContextInterface $context)
 {
     /** @var ProductNameSorting $sorting */
     $query->addOrderBy('product.name', $sorting->getDirection())->addOrderBy('product.id', $sorting->getDirection());
 }
 /**
  * {@inheritdoc}
  */
 public function generateSorting(SortingInterface $sorting, QueryBuilder $query, ShopContextInterface $context)
 {
     $query->addOrderBy('variant.instock', $sorting->getDirection())->addOrderBy('product.id', 'DESC');
 }