@@ -134,22 +134,20 @@ function () use ($productId, $context) {
134134
135135 $ productPrice = $ this ->tiers ->getProductRegularPrice ($ productId ) ?? 0.0 ;
136136 $ tierPrices = $ this ->tiers ->getProductTierPrices ($ productId ) ?? [];
137- return $ this ->formatAndFilterTierPrices ($ productId , $ productPrice , $ tierPrices , $ currencyCode );
137+ return $ this ->formatAndFilterTierPrices ($ productPrice , $ tierPrices , $ currencyCode );
138138 }
139139 );
140140 }
141141
142142 /**
143143 * Format and filter tier prices for output
144144 *
145- * @param int $productId
146145 * @param float $productPrice
147146 * @param ProductTierPriceInterface[] $tierPrices
148147 * @param string $currencyCode
149148 * @return array
150149 */
151150 private function formatAndFilterTierPrices (
152- int $ productId ,
153151 float $ productPrice ,
154152 array $ tierPrices ,
155153 string $ currencyCode
@@ -158,7 +156,7 @@ private function formatAndFilterTierPrices(
158156 foreach ($ tierPrices as $ key => $ tierPrice ) {
159157 $ tierPrice ->setValue ($ this ->priceCurrency ->convertAndRound ($ tierPrice ->getValue ()));
160158 $ this ->formatTierPrices ($ productPrice , $ currencyCode , $ tierPrice );
161- $ this ->filterTierPrices ($ productId , $ tierPrices , $ key , $ tierPrice );
159+ $ this ->filterTierPrices ($ tierPrices , $ key , $ tierPrice );
162160 }
163161 return $ this ->formatAndFilterTierPrices ;
164162 }
@@ -192,28 +190,26 @@ private function formatTierPrices(float $productPrice, string $currencyCode, $ti
192190 /**
193191 * Filter the lowest price for each quantity
194192 *
195- * @param int $productId
196193 * @param array $tierPrices
197194 * @param int $key
198195 * @param ProductTierPriceInterface $tierPriceItem
199196 */
200197 private function filterTierPrices (
201- int $ productId ,
202198 array $ tierPrices ,
203199 int $ key ,
204200 ProductTierPriceInterface $ tierPriceItem
205201 ) {
206202 $ qty = $ tierPriceItem ->getQty ();
207- if (isset ($ this ->tierPricesQty [$ productId ][ $ qty ])) {
208- $ priceQty = $ this ->tierPricesQty [$ productId ][ $ qty ];
203+ if (isset ($ this ->tierPricesQty [$ qty ])) {
204+ $ priceQty = $ this ->tierPricesQty [$ qty ];
209205 if ((float )$ tierPriceItem ->getValue () < (float )$ tierPrices [$ priceQty ]->getValue ()) {
210206 unset($ this ->formatAndFilterTierPrices [$ priceQty ]);
211- $ this ->tierPricesQty [$ productId ][ $ priceQty ] = $ key ;
207+ $ this ->tierPricesQty [$ priceQty ] = $ key ;
212208 } else {
213209 unset($ this ->formatAndFilterTierPrices [$ key ]);
214210 }
215211 } else {
216- $ this ->tierPricesQty [$ productId ][ $ qty ] = $ key ;
212+ $ this ->tierPricesQty [$ qty ] = $ key ;
217213 }
218214 }
219215}
0 commit comments