File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -101,18 +101,23 @@ public function executeRow($id)
101
101
*/
102
102
private function rebuildAffectedProducts ($ storeId )
103
103
{
104
- $ affectedProductsCount = count (self ::$ affectedProductIds );
104
+ $ affectedProducts = self ::$ affectedProductIds ;
105
+ $ affectedProductsCount = count ($ affectedProducts );
106
+
105
107
if ($ affectedProductsCount > 0 && $ this ->configHelper ->indexProductOnCategoryProductsUpdate ($ storeId )) {
106
- /** @uses Data::rebuildStoreProductIndex() */
107
- $ this ->queue ->addToQueue (
108
- Data::class,
109
- 'rebuildStoreProductIndex ' ,
110
- [
111
- 'store_id ' => $ storeId ,
112
- 'product_ids ' => self ::$ affectedProductIds ,
113
- ],
114
- $ affectedProductsCount
115
- );
108
+ $ productsPerPage = $ this ->configHelper ->getNumberOfElementByPage ();
109
+ foreach (array_chunk ($ affectedProducts , $ productsPerPage ) as $ chunk ) {
110
+ /** @uses Data::rebuildStoreProductIndex() */
111
+ $ this ->queue ->addToQueue (
112
+ Data::class,
113
+ 'rebuildStoreProductIndex ' ,
114
+ [
115
+ 'store_id ' => $ storeId ,
116
+ 'product_ids ' => $ chunk ,
117
+ ],
118
+ count ($ chunk )
119
+ );
120
+ }
116
121
}
117
122
}
118
123
You can’t perform that action at this time.
0 commit comments