From c99e7a91b93eec96e8a8fb0cd7c8f97536e73138 Mon Sep 17 00:00:00 2001 From: gmorel Date: Tue, 17 Sep 2013 17:43:19 +0200 Subject: [PATCH] Working : Content : fix loop giving no elements --- .../lib/Thelia/Core/Template/Loop/Content.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/core/lib/Thelia/Core/Template/Loop/Content.php b/core/lib/Thelia/Core/Template/Loop/Content.php index 4ac061c3f..a29cb2e60 100755 --- a/core/lib/Thelia/Core/Template/Loop/Content.php +++ b/core/lib/Thelia/Core/Template/Loop/Content.php @@ -102,15 +102,16 @@ class Content extends BaseI18nLoop if (!is_null($folder) || !is_null($folderDefault)) { - $folders = array(); - if (!is_null($folder)) { - $folders = array_merge($folders, FolderQuery::create()->filterById($folder, Criteria::IN)->find()); - } - - if (!is_null($folderDefault)) { - $folders = array_merge(FolderQuery::create()->filterById($folderDefault, Criteria::IN)->find()); + $foldersIds = array(); + if (!is_array($folder)) { + $folder = array(); + } + if (!is_array($folderDefault)) { + $folderDefault = array(); } + $foldersIds = array_merge($foldersIds, $folder, $folderDefault); + $folders =FolderQuery::create()->filterById($foldersIds, Criteria::IN)->find(); $depth = $this->getDepth(); @@ -175,12 +176,12 @@ class Content extends BaseI18nLoop $search->addDescendingOrderByColumn('i18n_TITLE'); break; case "manual": - if(null === $folder || count($folder) != 1) + if(null === $foldersIds || count($foldersIds) != 1) throw new \InvalidArgumentException('Manual order cannot be set without single folder argument'); $search->orderByPosition(Criteria::ASC); break; case "manual_reverse": - if(null === $folder || count($folder) != 1) + if(null === $foldersIds || count($foldersIds) != 1) throw new \InvalidArgumentException('Manual order cannot be set without single folder argument'); $search->orderByPosition(Criteria::DESC); break;