Skip to content

Commit e75bc33

Browse files
fixed price sort
1 parent c888dc0 commit e75bc33

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/components/ShopComponent.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -1388,11 +1388,11 @@ static public function getAgregateCategoryData(ActiveQuery $q, $model, $filtersD
13881388
$baseTypePrice = \Yii::$app->shop->baseTypePrice;
13891389

13901390
$q1 = clone $q;
1391-
$q1->innerJoin(['prices' => 'shop_product_price'], [
1392-
'prices.product_id' => new Expression('shopProduct.id'),
1393-
'prices.type_price_id' => $baseTypePrice->id,
1391+
$q1->innerJoin(['prices_for_calc' => 'shop_product_price'], [
1392+
'prices_for_calc.product_id' => new Expression('shopProduct.id'),
1393+
'prices_for_calc.type_price_id' => $baseTypePrice->id,
13941394
]);
1395-
$q1->select(['price' => new Expression("max(prices.price)")]);
1395+
$q1->select(['price' => new Expression("max(prices_for_calc.price)")]);
13961396
$q1->groupBy(false);
13971397
$q1->orderBy(false);
13981398

@@ -1405,12 +1405,12 @@ static public function getAgregateCategoryData(ActiveQuery $q, $model, $filtersD
14051405

14061406

14071407
$q2 = clone $q;
1408-
$q2->select(['price' => new Expression("min(prices.price)")]);
1409-
$q2->innerJoin(['prices' => 'shop_product_price'], [
1410-
'prices.product_id' => new Expression('shopProduct.id'),
1411-
'prices.type_price_id' => $baseTypePrice->id,
1408+
$q2->select(['price' => new Expression("min(prices_for_calc.price)")]);
1409+
$q2->innerJoin(['prices_for_calc' => 'shop_product_price'], [
1410+
'prices_for_calc.product_id' => new Expression('shopProduct.id'),
1411+
'prices_for_calc.type_price_id' => $baseTypePrice->id,
14121412
]);
1413-
$q2->andWhere(['>', 'prices.price', 0]);
1413+
$q2->andWhere(['>', 'prices_for_calc.price', 0]);
14141414
$q2->orderBy(false);
14151415
$q2->groupBy(false);
14161416

0 commit comments

Comments
 (0)