Skip to content

Commit

Permalink
Fix for 454 Previous and Next Post renders wrong articles
Browse files Browse the repository at this point in the history
  • Loading branch information
ihorvansach committed Nov 30, 2022
1 parent 3476305 commit a4cee81
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Block/Post/View/NextPrev.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function getPrevPost()
$collection = $this->_getFrontendCollection()->addFieldToFilter(
'publish_time',
['gt' => $this->getPost()->getPublishTime()]
);
)->setOrder('publish_time', 'ASC');
$post = $collection->getFirstItem();
}
}
Expand Down Expand Up @@ -168,7 +168,7 @@ public function getNextPost()
$collection = $this->_getFrontendCollection()->addFieldToFilter(
'publish_time',
['lt' => $this->getPost()->getPublishTime()]
);
)->setOrder('publish_time', 'DESC');
$post = $collection->getFirstItem();
}
}
Expand All @@ -190,7 +190,6 @@ protected function _getFrontendCollection()
$collection->addActiveFilter()
->addFieldToFilter('post_id', ['neq' => $this->getPost()->getId()])
->addStoreFilter($this->_storeManager->getStore()->getId())
//->setOrder('publish_time', 'DESC')
->setPageSize(1);
return $collection;
}
Expand Down

0 comments on commit a4cee81

Please sign in to comment.