Skip to content

Commit 458d45b

Browse files
magento#10045 backwards compatibility round 2
1 parent c4885c9 commit 458d45b

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

app/code/Magento/Sitemap/Model/Sitemap.php

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ protected function _getStream()
277277
* @param DataObject $sitemapItem
278278
* @return $this
279279
* @deprecated
280+
* @see ItemResolverInterface
280281
*/
281282
public function addSitemapItem(DataObject $sitemapItem)
282283
{
@@ -290,10 +291,37 @@ public function addSitemapItem(DataObject $sitemapItem)
290291
*
291292
* @return void
292293
* @deprecated
294+
* @see ItemResolverInterface
293295
*/
294296
public function collectSitemapItems()
295297
{
298+
/** @var $helper \Magento\Sitemap\Helper\Data */
299+
$helper = $this->_sitemapData;
300+
$storeId = $this->getStoreId();
296301

302+
$this->addSitemapItem(new DataObject(
303+
[
304+
'changefreq' => $helper->getCategoryChangefreq($storeId),
305+
'priority' => $helper->getCategoryPriority($storeId),
306+
'collection' => $this->_categoryFactory->create()->getCollection($storeId),
307+
]
308+
));
309+
310+
$this->addSitemapItem(new DataObject(
311+
[
312+
'changefreq' => $helper->getProductChangefreq($storeId),
313+
'priority' => $helper->getProductPriority($storeId),
314+
'collection' => $this->_productFactory->create()->getCollection($storeId),
315+
]
316+
));
317+
318+
$this->addSitemapItem(new DataObject(
319+
[
320+
'changefreq' => $helper->getPageChangefreq($storeId),
321+
'priority' => $helper->getPagePriority($storeId),
322+
'collection' => $this->_cmsFactory->create()->getCollection($storeId),
323+
]
324+
));
297325
}
298326

299327
/**
@@ -304,7 +332,6 @@ public function collectSitemapItems()
304332
protected function _initSitemapItems()
305333
{
306334
$sitemapItems = $this->itemResolver->getItems($this->getStoreId());
307-
$this->collectSitemapItems();
308335
$mappedItems = $this->mapToSitemapItem();
309336
$this->_sitemapItems = array_merge($sitemapItems, $mappedItems);
310337

@@ -791,7 +818,7 @@ private function mapToSitemapItem()
791818
$items = [];
792819

793820
foreach ($this->_sitemapItems as $data) {
794-
foreach($data->getCollection() as $item) {
821+
foreach ($data->getCollection() as $item) {
795822
$items[] = $this->sitemapItemFactory->create([
796823
'url' => $item->getUrl(),
797824
'updatedAt' => $item->getUpdatedAt(),

0 commit comments

Comments
 (0)