File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class Predispatch implements ObserverInterface {
15
15
16
16
public function __construct (
17
17
\Magento \Framework \App \Response \Http $ redirect ,
18
- \Magento \ConfigurableProduct \Model \ResourceModel \ Product \Type \Configurable $ productTypeConfigurable ,
18
+ \Magento \ConfigurableProduct \Model \Product \Type \Configurable $ productTypeConfigurable ,
19
19
\Magento \Catalog \Model \ProductRepository $ productRepository ,
20
20
\Magento \Store \Model \StoreManagerInterface $ storeManager ,
21
21
\Magento \Framework \App \Config \ScopeConfigInterface $ scopeConfig ,
@@ -56,7 +56,13 @@ public function execute(Observer $observer)
56
56
57
57
foreach ($ configProductIds as $ configProductId ) {
58
58
try {
59
- $ configProduct = $ this ->_productRepository ->getById ($ configProductId , false , $ this ->_storeManager ->getStore ()->getId ());
59
+ $ currentWebsiteId = $ this ->_storeManager ->getStore ()->getWebsiteId ();
60
+ $ websiteIds = $ this ->_productRepository ->getById ($ configProductId )->getWebsiteIds ();
61
+ if (in_array ($ currentWebsiteId , $ websiteIds )){
62
+ $ configProduct = $ this ->_productRepository ->getById ($ configProductId );
63
+ } else {
64
+ return ;
65
+ }
60
66
} catch (NoSuchEntityException $ e ) {
61
67
continue ;
62
68
}
You can’t perform that action at this time.
0 commit comments