/** * {@inheritdoc} */ public function getRssData() { $categoryId = $this->getRequest()->getParam('category_id'); $storeModel = $this->storeManager->getStore($this->getStoreId()); $newUrl = $this->rssUrlBuilder->getUrl(['store_id' => $this->getStoreId(), 'type' => 'blog_categories', 'category_id' => $categoryId]); $title = __('List Posts from %1', $storeModel->getFrontendName()); $lang = $this->_scopeConfig->getValue('general/locale/code', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeModel); $data = ['title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8', 'language' => $lang]; $limit = 10; $count = 0; $category = $this->rssModel->create()->load($categoryId); $posts = $category->getSelectedPostsCollection(); $posts->addFieldToFilter('enabled', 1)->setOrder('post_id', 'DESC'); foreach ($posts as $item) { $count++; if ($count > $limit) { break; } /** @var $item \Magento\Catalog\Model\Product */ $item->setAllowedInRss(true); $item->setAllowedPriceInRss(true); if (!$item->getAllowedInRss()) { continue; } $description = ' <table><tr> <td style="text-decoration:none;"> %s</td> </tr></table> '; $description = sprintf($description, $item->getShortDescription()); $data['entries'][] = ['title' => $item->getName(), 'link' => $this->helper->getUrlByPost($item), 'description' => $description]; } return $data; }