diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php index 6ed09fe2b..37801f4c8 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php @@ -67,12 +67,12 @@ class TheliaLoop extends AbstractSmartyPlugin * * @return \PropelModelPager */ - public static function getPagination($loopId) + public static function getPagination($loopName) { - if (!empty(self::$pagination[$loopId])) { - return self::$pagination[$loopId]; + if (array_key_exists($loopName, self::$pagination)) { + return self::$pagination[$loopName]; } else { - return null; + throw new \InvalidArgumentException("Loop $loopName is not defined"); } } @@ -242,16 +242,10 @@ class TheliaLoop extends AbstractSmartyPlugin if (null == $loopName) throw new \InvalidArgumentException("Missing 'rel' parameter in page loop"); - // Find loop results in the current template vars - /* $loopResults = $template->getTemplateVars($loopName); - if (empty($loopResults)) { - throw new \InvalidArgumentException("Loop $loopName is not defined."); - }*/ - // Find pagination $pagination = self::getPagination($loopName); - if ($pagination === null) { - throw new \InvalidArgumentException("Loop $loopName is not defined"); + if ($pagination === null) { // loop gas no result + return ''; } if ($pagination->getNbResults() == 0) { diff --git a/core/lib/Thelia/Rewriting/RewritingRetriever.php b/core/lib/Thelia/Rewriting/RewritingRetriever.php index 8289942f2..dfdbab05c 100755 --- a/core/lib/Thelia/Rewriting/RewritingRetriever.php +++ b/core/lib/Thelia/Rewriting/RewritingRetriever.php @@ -56,12 +56,14 @@ class RewritingRetriever * @param $viewLocale * @param null $viewId */ - public function loadViewUrl($view, $viewLocale, $viewId = null) + public function loadViewUrl($view, $viewLocale = null, $viewId = null) { $this->search = $this->rewritingUrlQuery->getViewUrlQuery($view, $viewLocale, $viewId); $allParametersWithoutView = array(); - $allParametersWithoutView['locale'] = $viewLocale; + if(null !== $viewId) { + $allParametersWithoutView['locale'] = $viewLocale; + } if(null !== $viewId) { $allParametersWithoutView[$view . '_id'] = $viewId; } diff --git a/core/lib/Thelia/Tools/URL.php b/core/lib/Thelia/Tools/URL.php index 05084c0c1..b415844cd 100755 --- a/core/lib/Thelia/Tools/URL.php +++ b/core/lib/Thelia/Tools/URL.php @@ -232,10 +232,10 @@ class URL $this->retriever->loadSpecificUrl($view, $viewLocale, $viewId, $allOtherParameters); } else { - $allParametersWithoutView = $viewOtherParameters; - $allParametersWithoutView['locale'] = $viewLocale; - if (null !== $viewId) { - $allParametersWithoutView[$view . '_id'] = $viewId; + $allParametersWithoutView = $request->query->all(); + $view = $request->attributes->get('_view'); + if(isset($allOtherParameters['view'])) { + unset($allOtherParameters['view']); } $this->retriever->rewrittenUrl = null; $this->retriever->url = URL::getInstance()->viewUrl($view, $allParametersWithoutView); diff --git a/templates/default_save/debug.html b/templates/default_save/debug.html index 5f2d2965d..a00acf9d3 100755 --- a/templates/default_save/debug.html +++ b/templates/default_save/debug.html @@ -1,5 +1,8 @@ -{*loop type="product" name="fsdq"} - {format_date date=$CREATE_DATE} -{/loop*} +

Category page

-::{product attr="createdAt" output="time" format='i'};;
\ No newline at end of file +{loop type="category" name="categoryloop" id="500"} + TOTO +{/loop} + +{pageloop rel="categoryloop"} +{/pageloop} \ No newline at end of file diff --git a/templates/default_save/index.html b/templates/default_save/index.html index 53834febf..7ca21bccb 100755 --- a/templates/default_save/index.html +++ b/templates/default_save/index.html @@ -1,6 +1,8 @@ {include file="includes/header.html"}
+ Here you are : {navigate to="current"} + {loop type="auth" name="auth_test" context="front" roles="CUSTOMER"}

Customer is authentified :-)