/**
  * {@inheritdoc}
  */
 public function getRssData()
 {
     $newUrl = $this->rssUrlBuilder->getUrl(['_secure' => true, '_nosecret' => true, 'type' => 'notifystock']);
     $title = __('Low Stock Products');
     $data = ['title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8'];
     foreach ($this->rssModel->getProductsCollection() as $item) {
         /* @var $item \Magento\Catalog\Model\Product */
         $url = $this->getUrl('catalog/product/edit', ['id' => $item->getId(), '_secure' => true, '_nosecret' => true]);
         $qty = 1 * $item->getQty();
         $description = __('%1 has reached a quantity of %2.', $item->getName(), $qty);
         $data['entries'][] = ['title' => $item->getName(), 'link' => $url, 'description' => $description];
     }
     return $data;
 }
 /**
  * @return array
  */
 public function getFeeds()
 {
     $data = [];
     if ($this->isAllowed()) {
         $url = $this->rssUrlBuilder->getUrl(['type' => 'blog_categories']);
         $data = ['label' => __('Posts'), 'link' => $url];
     }
     return $data;
 }
 /**
  * @return array
  */
 public function getFeeds()
 {
     $data = [];
     if ($this->isAllowed()) {
         $url = $this->rssUrlBuilder->getUrl(['type' => 'special_products']);
         $data = ['label' => __('Special Products'), 'link' => $url];
     }
     return $data;
 }
 /**
  * Get RSS feed items
  *
  * @return array
  */
 public function getRssData()
 {
     $passDate = $this->dateTime->formatDate(mktime(0, 0, 0, date('m'), date('d') - 7));
     $newUrl = $this->rssUrlBuilder->getUrl(['_secure' => true, '_nosecret' => true, 'type' => 'new_order']);
     $title = __('New Orders');
     $data = ['title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8'];
     /** @var $order \Magento\Sales\Model\Order */
     $order = $this->orderFactory->create();
     /** @var $collection \Magento\Sales\Model\ResourceModel\Order\Collection */
     $collection = $order->getResourceCollection();
     $collection->addAttributeToFilter('created_at', ['date' => true, 'from' => $passDate])->addAttributeToSort('created_at', 'desc');
     $this->eventManager->dispatch('rss_order_new_collection_select', ['collection' => $collection]);
     $detailBlock = $this->layout->getBlockSingleton('Magento\\Sales\\Block\\Adminhtml\\Order\\Details');
     foreach ($collection as $item) {
         $title = __('Order #%1 created at %2', $item->getIncrementId(), $this->localeDate->formatDate($item->getCreatedAt()));
         $url = $this->urlBuilder->getUrl('sales/order/view', ['_secure' => true, 'order_id' => $item->getId(), '_nosecret' => true]);
         $detailBlock->setOrder($item);
         $data['entries'][] = ['title' => $title, 'link' => $url, 'description' => $detailBlock->toHtml()];
     }
     return $data;
 }
Exemple #5
0
 /**
  * @return array
  */
 public function getFeeds()
 {
     $result = [];
     if ($this->isAllowed()) {
         /** @var $category \Magento\Catalog\Model\Category */
         $category = $this->categoryFactory->create();
         $treeModel = $category->getTreeModel()->loadNode($this->storeManager->getStore()->getRootCategoryId());
         $nodes = $treeModel->loadChildren()->getChildren();
         $nodeIds = [];
         foreach ($nodes as $node) {
             $nodeIds[] = $node->getId();
         }
         /* @var $collection \Magento\Catalog\Model\ResourceModel\Category\Collection */
         $collection = $category->getResourceCollection();
         $collection->addIdFilter($nodeIds)->addAttributeToSelect('url_key')->addAttributeToSelect('name')->addAttributeToSelect('is_anchor')->addAttributeToFilter('is_active', 1)->addAttributeToSort('name')->load();
         $feeds = [];
         foreach ($collection as $category) {
             $feeds[] = ['label' => $category->getName(), 'link' => $this->rssUrlBuilder->getUrl(['type' => 'category', 'cid' => $category->getId()])];
         }
         $result = ['group' => 'Categories', 'feeds' => $feeds];
     }
     return $result;
 }
Exemple #6
0
 /**
  * @return string
  */
 public function getLink()
 {
     return $this->rssUrlBuilder->getUrl($this->getLinkParams());
 }