/** * Prepare posts collection * * @return void */ protected function _preparePostCollection() { $size = $this->getData('number_of_posts'); if (!$size) { $size = (int) $this->_scopeConfig->getValue('mfblog/sidebar/recent_posts/posts_per_page', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } $this->setPageSize($size); parent::_preparePostCollection(); if ($category = $this->getCategory()) { $categories = $category->getChildrenIds(); $categories[] = $category->getId(); $this->_postCollection->addCategoryFilter($categories); } }
/** * Prepare posts collection * * @return void */ protected function _preparePostCollection() { parent::_preparePostCollection(); $this->_postCollection->getSelect()->group('MONTH(main_table.publish_time)', 'DESC'); }
/** * Prepare posts collection * * @return void */ protected function _preparePostCollection() { parent::_preparePostCollection(); $this->_postCollection->addFieldToFilter('post_id', array('in' => $this->getPost()->getRelatedPostIds() ?: array(0)))->addFieldToFilter('post_id', array('neq' => $this->getPost()->getId()))->setPageSize((int) $this->_scopeConfig->getValue('mfblog/post_view/related_posts/number_of_posts', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)); }