Skip to content

Commit

Permalink
Always get the lowest price as base price (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbclaudio authored Sep 16, 2021
1 parent 6abaae4 commit 940f852
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Models/Scopes/Product/WithProductChildrenScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function apply(Builder $builder, Model $model)
}

$builder
->selectRaw('IFNULL('.$flat.'.price, MIN(children.price)) as price')
->selectRaw('IFNULL(MIN(children.price), '.$flat.'.price) as price')
->selectRaw('JSON_REMOVE(JSON_OBJECTAGG(IFNULL(children.entity_id, "null__"), JSON_OBJECT(
"price", children.price,
'.$superAttributesSelect.'
Expand Down

0 comments on commit 940f852

Please sign in to comment.