From 8e426fe9a0b4e5dcaba084224d0b0a98c82e5e07 Mon Sep 17 00:00:00 2001
From: RomanKis <romaikiss@gmail.com>
Date: Thu, 30 Nov 2017 14:24:59 +0200
Subject: [PATCH] 12482: Sitemap image links in MultiStore

---
 app/code/Magento/Sitemap/Model/Sitemap.php               | 1 +
 app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php
index f6a5f029eaf..cad8023bd27 100644
--- a/app/code/Magento/Sitemap/Model/Sitemap.php
+++ b/app/code/Magento/Sitemap/Model/Sitemap.php
@@ -273,6 +273,7 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel implements \Magento
         /** @var $helper \Magento\Sitemap\Helper\Data */
         $helper = $this->_sitemapData;
         $storeId = $this->getStoreId();
+        $this->_storeManager->setCurrentStore($storeId);
 
         $this->addSitemapItem(new DataObject(
             [
diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php
index 83210c57897..4f55653fad3 100644
--- a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php
+++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php
@@ -253,6 +253,8 @@ class SitemapTest extends \PHPUnit\Framework\TestCase
             $expectedWrites,
             null
         );
+        $this->storeManagerMock->expects($this->once())->method('setCurrentStore')->with(1);
+
         $model->generateXml();
 
         $this->assertCount(count($expectedFile), $actualData, 'Number of generated files is incorrect');
@@ -360,6 +362,8 @@ class SitemapTest extends \PHPUnit\Framework\TestCase
             $expectedWrites,
             $robotsInfo
         );
+        $this->storeManagerMock->expects($this->once())->method('setCurrentStore')->with(1);
+
         $model->generateXml();
     }
 
-- 
GitLab