File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -85,10 +85,24 @@ public function execute($id = null)
85
85
$ ids = [$ id ];
86
86
$ linkField = $ this ->metadataPool ->getMetadata (ProductInterface::class)->getLinkField ();
87
87
88
+ $ select = $ this ->_connection ->select ();
89
+ $ select ->from (['e ' => $ this ->_productIndexerHelper ->getTable ('store ' )], ['e.store_id ' ])
90
+ ->where ('c.product_id = ' . $ id )
91
+ ->joinLeft (
92
+ ['c ' => $ this ->_productIndexerHelper ->getTable ('catalog_product_website ' )],
93
+ 'e.website_id = c.website_id ' ,
94
+ []
95
+ );
96
+ $ storeIds = $ this ->_connection ->fetchCol ($ select );
97
+
88
98
$ stores = $ this ->_storeManager ->getStores ();
89
99
foreach ($ stores as $ store ) {
90
100
$ tableExists = $ this ->_isFlatTableExists ($ store ->getId ());
91
101
if ($ tableExists ) {
102
+ if (!in_array ($ store ->getId (), $ storeIds )) {
103
+ $ this ->flatItemEraser ->deleteProductsFromStore ($ id , $ store ->getId ());
104
+ continue ;
105
+ }
92
106
$ this ->flatItemEraser ->removeDeletedProducts ($ ids , $ store ->getId ());
93
107
$ this ->flatItemEraser ->removeDisabledProducts ($ ids , $ store ->getId ());
94
108
}
You can’t perform that action at this time.
0 commit comments