--- /var/www/html/lisem/vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductRepository.php.BAK	2017-06-06 11:03:56.264805554 +0200
+++ /var/www/html/lisem/vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductRepository.php	2017-06-28 14:10:38.563372710 +0200
@@ -74,7 +74,6 @@
             ->andWhere('productTaxon.taxon = :taxon')
             ->andWhere(':channel MEMBER OF o.channels')
             ->andWhere('o.enabled = true')
-            ->addGroupBy('o.id')
             ->setParameter('locale', $locale)
             ->setParameter('taxon', $taxon)
             ->setParameter('channel', $channel)
@@ -82,10 +81,23 @@
 
         // Grid hack, we do not need to join these if we don't sort by price
         if (isset($sorting['price'])) {
+            // Another hack, the subquery to get the first position variant
+             $subQuery = $this->createQueryBuilder('m')
+                 ->select('min(v.position)')
+                 ->innerJoin('m.variants', 'v')
+                 ->andWhere('m.id = :product_id')
+             ;
+            
             $queryBuilder
                 ->innerJoin('o.variants', 'variant')
                 ->innerJoin('variant.channelPricings', 'channelPricing')
                 ->andWhere('channelPricing.channelCode = :channelCode')
+                ->andwhere(
+                    $queryBuilder->expr()->in(
+                        'variant.position',
+                        str_replace(':product_id', 'o.id', $subQuery->getDQL())
+                    )
+                )
                 ->setParameter('channelCode', $channel->getCode())
             ;
         }
