File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
app/code/Magento/CatalogUrlRewrite/Observer Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -47,17 +47,18 @@ public function execute(\Magento\Framework\Event\Observer $observer)
47
47
$ product = $ observer ->getEvent ()->getProduct ();
48
48
49
49
$ isChangedWebsites = $ product ->getIsChangedWebsites ();
50
- if ($ product ->dataHasChangedFor ('url_key ' ) || $ product ->getIsChangedCategories () || $ isChangedWebsites
51
- || $ product ->dataHasChangedFor ('visibility ' )) {
52
- if ($ isChangedWebsites ) {
50
+ if ($ product ->dataHasChangedFor ('url_key ' )
51
+ || $ product ->getIsChangedCategories ()
52
+ || $ isChangedWebsites
53
+ || $ product ->dataHasChangedFor ('visibility ' )
54
+ ) {
53
55
$ this ->urlPersist ->deleteByData ([
54
56
UrlRewrite::ENTITY_ID => $ product ->getId (),
55
57
UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE ,
56
58
]);
57
- }
58
- if (!in_array ($ product ->getOrigData ('visibility ' ), $ product ->getVisibleInSiteVisibilities ())) {
59
- $ this ->urlPersist ->replace ($ this ->productUrlRewriteGenerator ->generate ($ product ));
60
- }
59
+ if (in_array ($ product ->getVisibility (), $ product ->getVisibleInSiteVisibilities ())) {
60
+ $ this ->urlPersist ->replace ($ this ->productUrlRewriteGenerator ->generate ($ product ));
61
+ }
61
62
}
62
63
}
63
64
}
You can’t perform that action at this time.
0 commit comments