@@ -49,7 +49,13 @@ protected function getMinMaxPrices(Product $product, $withTax, $subProducts, $cu
49
49
/** @var Product $subProduct */
50
50
foreach ($ subProducts as $ subProduct ) {
51
51
$ specialPrice = $ this ->getSpecialPrice ($ subProduct , $ currencyCode , $ withTax , $ subProducts );
52
- $ price = $ specialPrice [0 ] ?? $ this ->getTaxPrice ($ product , $ subProduct ->getFinalPrice (), $ withTax );
52
+ $ tierPrice = $ this ->getTierPrice ($ subProduct , $ currencyCode , $ withTax );
53
+ if (!empty ($ tierPrice [0 ]) && $ specialPrice [0 ] > $ tierPrice [0 ]){
54
+ $ minPrice = $ tierPrice [0 ];
55
+ } else {
56
+ $ minPrice = $ specialPrice [0 ];
57
+ }
58
+ $ price = $ minPrice ?? $ this ->getTaxPrice ($ product , $ subProduct ->getFinalPrice (), $ withTax );
53
59
$ basePrice = $ this ->getTaxPrice ($ product , $ subProduct ->getPrice (), $ withTax );
54
60
$ min = min ($ min , $ price );
55
61
$ original = min ($ original , $ basePrice );
@@ -155,11 +161,17 @@ protected function setFinalGroupPrices($field, $currencyCode, $min, $max, $dashe
155
161
/** @var Group $group */
156
162
foreach ($ this ->groups as $ group ) {
157
163
$ groupId = (int ) $ group ->getData ('customer_group_id ' );
164
+ $ minPrice = $ min ;
158
165
foreach ($ subproducts as $ subProduct ) {
159
166
$ subProduct ->setData ('customer_group_id ' , $ groupId );
160
167
$ subProduct ->setData ('website_id ' , $ subProduct ->getStore ()->getWebsiteId ());
168
+ $ specialPrice = $ this ->getSpecialPrice ($ subProduct , $ currencyCode , $ withTax , []);
169
+ $ tierPrice = $ this ->getTierPrice ($ subProduct , $ currencyCode , $ withTax );
161
170
$ price = $ this ->getTaxPrice ($ product , $ subProduct ->getPriceModel ()->getFinalPrice (1 , $ subProduct ), $ withTax );
162
- $ groupPriceList [$ groupId ]['min ' ] = min ($ min , $ price );
171
+ if (!empty ($ tierPrice [$ groupId ]) && $ specialPrice [$ groupId ] > $ tierPrice [$ groupId ]){
172
+ $ minPrice = $ tierPrice [$ groupId ];
173
+ }
174
+ $ groupPriceList [$ groupId ]['min ' ] = min ($ minPrice , $ price );
163
175
$ groupPriceList [$ groupId ]['max ' ] = max ($ max , $ price );
164
176
$ subProduct ->setData ('customer_group_id ' , null );
165
177
}
0 commit comments