filter with contentFolder table for finding next/prev content
This commit is contained in:
@@ -202,6 +202,7 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface
|
|||||||
|
|
||||||
public function parseResults(LoopResult $loopResult)
|
public function parseResults(LoopResult $loopResult)
|
||||||
{
|
{
|
||||||
|
/** @var \Thelia\Model\Content $content */
|
||||||
foreach ($loopResult->getResultDataCollection() as $content) {
|
foreach ($loopResult->getResultDataCollection() as $content) {
|
||||||
$loopResultRow = new LoopResultRow($content);
|
$loopResultRow = new LoopResultRow($content);
|
||||||
|
|
||||||
@@ -224,14 +225,19 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface
|
|||||||
|
|
||||||
|
|
||||||
if ($this->getBackend_context() || $this->getWithPrevNextInfo()) {
|
if ($this->getBackend_context() || $this->getWithPrevNextInfo()) {
|
||||||
|
$defaultFolderId = $content->getDefaultFolderId();
|
||||||
// Find previous and next category
|
// Find previous and next category
|
||||||
$previous = ContentQuery::create()
|
$previous = ContentQuery::create()
|
||||||
|
->joinContentFolder()
|
||||||
|
->where('ContentFolder.folder_id = ?', $defaultFolderId)
|
||||||
->filterByPosition($content->getPosition(), Criteria::LESS_THAN)
|
->filterByPosition($content->getPosition(), Criteria::LESS_THAN)
|
||||||
->orderByPosition(Criteria::DESC)
|
->orderByPosition(Criteria::DESC)
|
||||||
->findOne()
|
->findOne()
|
||||||
;
|
;
|
||||||
|
|
||||||
$next = ContentQuery::create()
|
$next = ContentQuery::create()
|
||||||
|
->joinContentFolder()
|
||||||
|
->where('ContentFolder.folder_id = ?', $defaultFolderId)
|
||||||
->filterByPosition($content->getPosition(), Criteria::GREATER_THAN)
|
->filterByPosition($content->getPosition(), Criteria::GREATER_THAN)
|
||||||
->orderByPosition(Criteria::ASC)
|
->orderByPosition(Criteria::ASC)
|
||||||
->findOne()
|
->findOne()
|
||||||
|
|||||||
Reference in New Issue
Block a user