示例#1
0
 /**
  * @return \Mirasvit\Blog\Model\Post[]
  */
 public function getCollection()
 {
     $collection = $this->postCollectionFactory->create()->addAttributeToSelect(['name', 'featured_image', 'url_key'])->addVisibilityFilter()->addAttributeToFilter('is_pinned', 1);
     if ($this->getCategory()) {
         $collection->addCategoryFilter($this->getCategory());
     }
     return $collection;
 }
示例#2
0
 /**
  * @return \Mirasvit\Blog\Model\ResourceModel\Post\Collection|\Mirasvit\Blog\Model\Post[]
  */
 public function getCollection()
 {
     $collection = $this->postCollectionFactory->create()->addAttributeToSelect('*')->addVisibilityFilter()->setOrder('created_at', 'desc');
     if ($product = $this->getProduct()) {
         $collection->addRelatedProductFilter($product);
     }
     return $collection;
 }
示例#3
0
 /**
  * @return \Mirasvit\Blog\Model\Post[]
  */
 public function getCollection()
 {
     $collection = $this->postCollectionFactory->create()->addAttributeToSelect('*')->addVisibilityFilter()->setOrder('created_at')->setPageSize(10);
     if ($category = $this->getCategory()) {
         $collection->addCategoryFilter($category);
     }
     return $collection;
 }
示例#4
0
 /**
  * @return \Mirasvit\Blog\Model\ResourceModel\Post\Collection
  */
 public function getPostCollection()
 {
     $toolbar = $this->getToolbarBlock();
     if (empty($this->collection)) {
         $collection = $this->postCollectionFactory->create()->addAttributeToSelect(['name', 'featured_image', 'short_content', 'content', 'url_key'])->addVisibilityFilter();
         if ($category = $this->getCategory()) {
             $collection->addCategoryFilter($category);
         } elseif ($tag = $this->getTag()) {
             $collection->addTagFilter($tag);
         } elseif ($author = $this->getAuthor()) {
             $collection->addAuthorFilter($author);
         } elseif ($q = $this->getRequest()->getParam('q')) {
             $collection->addSearchFilter($q);
         }
         $collection->setCurPage($this->getCurrentPage());
         $limit = (int) $toolbar->getLimit();
         if ($limit) {
             $collection->setPageSize($limit);
         }
         $page = (int) $toolbar->getCurrentPage();
         if ($page) {
             $collection->setCurPage($page);
         }
         if ($order = $toolbar->getCurrentOrder()) {
             $collection->setOrder($order, $toolbar->getCurrentDirection());
         }
         $this->collection = $collection;
     }
     return $this->collection;
 }
示例#5
0
 /**
  * @return \Mirasvit\Blog\Model\Post[]
  */
 public function getCollection()
 {
     return $this->postCollectionFactory->create()->addVisibilityFilter()->addAttributeToSelect(['name', 'featured_image', 'url_key'])->setOrder('created_at', 'desc');
 }
示例#6
0
 /**
  * @return \Mirasvit\Blog\Model\ResourceModel\Post\Collection
  */
 public function getPostCollection()
 {
     $tags = $this->getCurrentPost()->getTagIds();
     $collection = $this->postCollectionFactory->create()->addTagFilter($tags)->addFieldToFilter('entity_id', ['neq' => $this->getCurrentPost()->getId()])->addVisibilityFilter()->addAttributeToSelect('*');
     return $collection;
 }