refactor content loop splitting parseResults method
This commit is contained in:
@@ -205,7 +205,7 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
/** @var \Thelia\Model\Content $content */
|
||||
foreach ($loopResult->getResultDataCollection() as $content) {
|
||||
$loopResultRow = new LoopResultRow($content);
|
||||
|
||||
$defaultFolderId = $content->getDefaultFolderId();
|
||||
$loopResultRow->set("ID" , $content->getId())
|
||||
->set("IS_TRANSLATED" , $content->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE" , $this->locale)
|
||||
@@ -218,14 +218,31 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
->set("META_DESCRIPTION" , $content->getVirtualColumn('i18n_META_DESCRIPTION'))
|
||||
->set("META_KEYWORDS" , $content->getVirtualColumn('i18n_META_KEYWORDS'))
|
||||
->set("POSITION" , $content->getPosition())
|
||||
->set("DEFAULT_FOLDER" , $content->getDefaultFolderId())
|
||||
->set("DEFAULT_FOLDER" , $defaultFolderId)
|
||||
|
||||
->set("VISIBLE" , $content->getVisible())
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
$loopResult->addRow($this->findNextPrev($loopResultRow, $content, $defaultFolderId));
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LoopResultRow $loopResultRow
|
||||
* @param \Thelia\Model\Content $content
|
||||
* @param $defaultFolderId
|
||||
* @return LoopResultRow
|
||||
*/
|
||||
private function findNextPrev(LoopResultRow $loopResultRow, \Thelia\Model\Content $content, $defaultFolderId)
|
||||
{
|
||||
if ($this->getBackend_context() || $this->getWithPrevNextInfo()) {
|
||||
$defaultFolderId = $content->getDefaultFolderId();
|
||||
|
||||
// Find previous and next category
|
||||
$previous = ContentQuery::create()
|
||||
->joinContentFolder()
|
||||
@@ -251,11 +268,7 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
;
|
||||
}
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
|
||||
return $loopResultRow;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user