Skip to content

Commit

Permalink
magento#15588 Fixed incorrect image urls in multistore xml sitemap
Browse files Browse the repository at this point in the history
placed the stop Emulation in a finally. Now it will always be executed.
  • Loading branch information
StevenGuapaBV committed Jun 7, 2018
1 parent 9d256d9 commit b24905c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function execute()
$sitemap->load($id);
// if sitemap record exists
if ($sitemap->getId()) {

try {
//We need to emulate to get the correct frontend URL for the product images
$this->appEmulation->startEnvironmentEmulation(
Expand All @@ -51,7 +52,6 @@ public function execute()
true
);
$sitemap->generateXml();
$this->appEmulation->stopEnvironmentEmulation();

$this->messageManager->addSuccess(
__('The sitemap "%1" has been generated.', $sitemap->getSitemapFilename())
Expand All @@ -60,6 +60,8 @@ public function execute()
$this->messageManager->addError($e->getMessage());
} catch (\Exception $e) {
$this->messageManager->addException($e, __('We can\'t generate the sitemap right now.'));
} finally {
$this->appEmulation->stopEnvironmentEmulation();
}
} else {
$this->messageManager->addError(__('We can\'t find a sitemap to generate.'));
Expand Down

0 comments on commit b24905c

Please sign in to comment.