@@ -292,25 +292,30 @@ protected function doReindexByIds($ids)
292
292
293
293
/** @var Rule[] $activeRules */
294
294
$ activeRules = $ this ->getActiveRules ()->getItems ();
295
- foreach ($ ids as $ productId ) {
296
- foreach ( $ activeRules as $ activeRule) {
297
- $ rule = clone $ activeRule ;
298
- $ rule ->setProductsFilter ( $ ids );
299
- $ matchedProductIds = $ rule -> getMatchingProductIds ();
300
- $ matchedProductIds = array_intersect_key ( $ matchedProductIds , array_flip ( $ ids )) ;
301
- foreach ( $ matchedProductIds as $ matchedProductId => $ validationByWebsite ) {
302
- $ websiteIds = array_keys ( array_filter ( $ validationByWebsite ));
303
- if ( empty ( $ websiteIds )) {
304
- continue ;
305
- }
306
-
307
- $ this -> assignProductToRule ( $ rule , $ matchedProductId , $ websiteIds ) ;
295
+ foreach ($ activeRules as $ activeRule ) {
296
+ $ rule = clone $ activeRule;
297
+ $ rule-> setProductsFilter ( $ ids ) ;
298
+ $ matchedProductIds = $ rule ->getMatchingProductIds ( );
299
+ if ( empty ( $ matchedProductIds)) {
300
+ continue ;
301
+ }
302
+
303
+ $ matchedProductIds = array_intersect_key ( $ matchedProductIds , array_flip ( $ ids ));
304
+ foreach ( $ matchedProductIds as $ matchedProductId => $ validationByWebsite ) {
305
+ $ websiteIds = array_keys ( array_filter ( $ validationByWebsite ));
306
+ if ( empty ( $ websiteIds )) {
307
+ continue ;
308
308
}
309
+
310
+ $ this ->assignProductToRule ($ rule , $ matchedProductId , $ websiteIds );
309
311
}
312
+ }
310
313
314
+ foreach ($ ids as $ productId ) {
311
315
$ this ->cleanProductPriceIndex ([$ productId ]);
312
316
$ this ->reindexRuleProductPrice ->execute ($ this ->batchCount , $ productId );
313
317
}
318
+
314
319
$ this ->reindexRuleGroupWebsite ->execute ();
315
320
}
316
321
0 commit comments