7
7
8
8
abstract class ProductWithChildren extends ProductWithoutChildren
9
9
{
10
+
11
+ const PRICE_NOT_SET = -1 ;
12
+
10
13
/**
11
14
* @param $product
12
15
* @param $withTax
@@ -158,8 +161,8 @@ protected function setFinalGroupPrices($field, $currencyCode, $min, $max, $dashe
158
161
{
159
162
if (count ($ subproducts ) > 0 ) {
160
163
$ groupPriceList = [];
161
- $ subProductsMin = - 1 ;
162
- $ subProductsMax = 0 ;
164
+ $ subProductsMin = self :: PRICE_NOT_SET ;
165
+ $ subProductsMax = self :: PRICE_NOT_SET ;
163
166
/** @var Group $group */
164
167
foreach ($ this ->groups as $ group ) {
165
168
$ groupId = (int ) $ group ->getData ('customer_group_id ' );
@@ -172,30 +175,25 @@ protected function setFinalGroupPrices($field, $currencyCode, $min, $max, $dashe
172
175
$ tierPrice = $ this ->getTierPrice ($ subProduct , $ currencyCode , $ withTax );
173
176
$ price = $ this ->getTaxPrice ($ product , $ subProduct ->getPriceModel ()->getFinalPrice (1 , $ subProduct ), $ withTax );
174
177
175
- if (!empty ($ tierPrice [$ groupId ]) && $ specialPrice [$ groupId ] > $ tierPrice [$ groupId ]){
176
- $ minPrice = $ tierPrice [$ groupId ];
177
- }
178
-
179
- if (isset ($ tierPrice [$ groupId ]) && $ tierPrice [$ groupId ] !== false ) {
178
+ if (!empty ($ tierPrice [$ groupId ]) && $ specialPrice [$ groupId ] > $ tierPrice [$ groupId ]) {
180
179
$ minPrice = $ tierPrice [$ groupId ];
181
180
}
182
181
183
- if ($ subProductsMin == - 1 || $ price < $ subProductsMin ) {
182
+ if ($ subProductsMin === self :: PRICE_NOT_SET || $ price < $ subProductsMin ) {
184
183
$ subProductsMin = $ price ;
185
184
}
186
185
187
- if ($ price > $ subProductsMax ) {
186
+ if ($ subProductsMax === self :: PRICE_NOT_SET || $ price > $ subProductsMax ) {
188
187
$ subProductsMax = $ price ;
189
188
}
190
189
191
190
$ groupPriceList [$ groupId ]['min ' ] = min ($ minPrice , $ subProductsMin );
192
191
$ groupPriceList [$ groupId ]['max ' ] = $ subProductsMax ;
193
192
$ subProduct ->setData ('customer_group_id ' , null );
194
-
195
193
}
196
194
197
- $ subProductsMin = - 1 ;
198
- $ subProductsMax = 0 ;
195
+ $ subProductsMin = self :: PRICE_NOT_SET ;
196
+ $ subProductsMax = self :: PRICE_NOT_SET ;
199
197
}
200
198
201
199
$ minArray = [];
0 commit comments