Created
March 4, 2020 08:21
-
-
Save xxxrazorxxx/ec4542c80d684685bb85bff8a33c054d to your computer and use it in GitHub Desktop.
38d5f449f98f04900ce361210a5d3f4d76f8a921.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/addons/product_variations/src/Bootstrap.php b/app/addons/product_variations/src/Bootstrap.php | |
index ef858946b2..8f806eccec 100644 | |
--- a/app/addons/product_variations/src/Bootstrap.php | |
+++ b/app/addons/product_variations/src/Bootstrap.php | |
@@ -174,6 +174,12 @@ public function getHookHandlerMap() | |
'onGetRoute', | |
1900 | |
], | |
+ 'google_sitemap_generate_link_post' => [ | |
+ 'addons.product_variations.hook_handlers.seo', | |
+ 'onGoogleSiteMapGenerateLinkPost', | |
+ null, | |
+ 'google_sitemap' | |
+ ], | |
// Discussion | |
'get_discussion_pre' => [ | |
diff --git a/app/addons/product_variations/src/HookHandlers/SeoHookHandler.php b/app/addons/product_variations/src/HookHandlers/SeoHookHandler.php | |
index c431793df2..6538b14c7c 100644 | |
--- a/app/addons/product_variations/src/HookHandlers/SeoHookHandler.php | |
+++ b/app/addons/product_variations/src/HookHandlers/SeoHookHandler.php | |
@@ -175,4 +175,25 @@ public function onVariationGroupMarkProductAsMainPost($service, $group, GroupPro | |
$query->multipleInsert($on_insert_list); | |
} | |
} | |
+ | |
+ /** | |
+ * The "google_sitemap_generate_link_post" hook handler. | |
+ * | |
+ * Actions performed: | |
+ * - Unlink the variation products to hide it from sitemap. | |
+ * | |
+ * @see fn_google_sitemap_generate_link | |
+ */ | |
+ public function onGoogleSiteMapGenerateLinkPost($type, $id, $languages, $extra, $storefront_id, &$links) | |
+ { | |
+ if ($type != 'product') { | |
+ return; | |
+ } | |
+ | |
+ $product_id_map = ServiceProvider::getProductIdMap(); | |
+ | |
+ if ($product_id_map->isChildProduct($id)) { | |
+ $links = []; | |
+ } | |
+ } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment