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;