@@ -81,6 +81,13 @@ class Product extends \Magento\Core\Helper\Url
8181 */
8282 protected $ _catalogSession ;
8383
84+ /**
85+ * Invalidate product category indexer params
86+ *
87+ * @var array
88+ */
89+ protected $ _reindexProductCategoryIndexerData ;
90+
8491 /**
8592 * Invalidate price indexer params
8693 *
@@ -109,6 +116,7 @@ class Product extends \Magento\Core\Helper\Url
109116 * @param \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig
110117 * @param string $typeSwitcherLabel
111118 * @param array $reindexPriceIndexerData
119+ * @param array $reindexProductCategoryIndexerData
112120 * @param ProductRepositoryInterface $productRepository
113121 * @param CategoryRepositoryInterface $categoryRepository
114122 * @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -124,6 +132,7 @@ public function __construct(
124132 \Magento \Framework \App \Config \ScopeConfigInterface $ coreConfig ,
125133 $ typeSwitcherLabel ,
126134 $ reindexPriceIndexerData ,
135+ $ reindexProductCategoryIndexerData ,
127136 ProductRepositoryInterface $ productRepository ,
128137 CategoryRepositoryInterface $ categoryRepository
129138 ) {
@@ -137,6 +146,7 @@ public function __construct(
137146 $ this ->_reindexPriceIndexerData = $ reindexPriceIndexerData ;
138147 $ this ->productRepository = $ productRepository ;
139148 $ this ->categoryRepository = $ categoryRepository ;
149+ $ this ->_reindexProductCategoryIndexerData = $ reindexProductCategoryIndexerData ;
140150 parent ::__construct ($ context , $ storeManager );
141151 }
142152
@@ -169,6 +179,22 @@ public function isDataForPriceIndexerWasChanged($data)
169179 return false ;
170180 }
171181
182+ /**
183+ * Retrieve data for product category indexer update
184+ *
185+ * @param \Magento\Catalog\Model\Product $data
186+ * @return boolean
187+ */
188+ public function isDataForProductCategoryIndexerWasChanged (\Magento \Catalog \Model \Product $ data )
189+ {
190+ foreach ($ this ->_reindexProductCategoryIndexerData ['byDataChange ' ] as $ param ) {
191+ if ($ data ->dataHasChangedFor ($ param )) {
192+ return true ;
193+ }
194+ }
195+ return false ;
196+ }
197+
172198 /**
173199 * Retrieve product view page url
174200 *
0 commit comments