Merge branch 'master' of github.com:thelia/thelia
This commit is contained in:
@@ -67,12 +67,12 @@ class TheliaLoop extends AbstractSmartyPlugin
|
|||||||
*
|
*
|
||||||
* @return \PropelModelPager
|
* @return \PropelModelPager
|
||||||
*/
|
*/
|
||||||
public static function getPagination($loopId)
|
public static function getPagination($loopName)
|
||||||
{
|
{
|
||||||
if (!empty(self::$pagination[$loopId])) {
|
if (array_key_exists($loopName, self::$pagination)) {
|
||||||
return self::$pagination[$loopId];
|
return self::$pagination[$loopName];
|
||||||
} else {
|
} else {
|
||||||
return null;
|
throw new \InvalidArgumentException("Loop $loopName is not defined");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,16 +242,10 @@ class TheliaLoop extends AbstractSmartyPlugin
|
|||||||
if (null == $loopName)
|
if (null == $loopName)
|
||||||
throw new \InvalidArgumentException("Missing 'rel' parameter in page loop");
|
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
|
// Find pagination
|
||||||
$pagination = self::getPagination($loopName);
|
$pagination = self::getPagination($loopName);
|
||||||
if ($pagination === null) {
|
if ($pagination === null) { // loop gas no result
|
||||||
throw new \InvalidArgumentException("Loop $loopName is not defined");
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pagination->getNbResults() == 0) {
|
if ($pagination->getNbResults() == 0) {
|
||||||
|
|||||||
@@ -56,12 +56,14 @@ class RewritingRetriever
|
|||||||
* @param $viewLocale
|
* @param $viewLocale
|
||||||
* @param null $viewId
|
* @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);
|
$this->search = $this->rewritingUrlQuery->getViewUrlQuery($view, $viewLocale, $viewId);
|
||||||
|
|
||||||
$allParametersWithoutView = array();
|
$allParametersWithoutView = array();
|
||||||
$allParametersWithoutView['locale'] = $viewLocale;
|
if(null !== $viewId) {
|
||||||
|
$allParametersWithoutView['locale'] = $viewLocale;
|
||||||
|
}
|
||||||
if(null !== $viewId) {
|
if(null !== $viewId) {
|
||||||
$allParametersWithoutView[$view . '_id'] = $viewId;
|
$allParametersWithoutView[$view . '_id'] = $viewId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,10 +232,10 @@ class URL
|
|||||||
|
|
||||||
$this->retriever->loadSpecificUrl($view, $viewLocale, $viewId, $allOtherParameters);
|
$this->retriever->loadSpecificUrl($view, $viewLocale, $viewId, $allOtherParameters);
|
||||||
} else {
|
} else {
|
||||||
$allParametersWithoutView = $viewOtherParameters;
|
$allParametersWithoutView = $request->query->all();
|
||||||
$allParametersWithoutView['locale'] = $viewLocale;
|
$view = $request->attributes->get('_view');
|
||||||
if (null !== $viewId) {
|
if(isset($allOtherParameters['view'])) {
|
||||||
$allParametersWithoutView[$view . '_id'] = $viewId;
|
unset($allOtherParameters['view']);
|
||||||
}
|
}
|
||||||
$this->retriever->rewrittenUrl = null;
|
$this->retriever->rewrittenUrl = null;
|
||||||
$this->retriever->url = URL::getInstance()->viewUrl($view, $allParametersWithoutView);
|
$this->retriever->url = URL::getInstance()->viewUrl($view, $allParametersWithoutView);
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{*loop type="product" name="fsdq"}
|
<h1>Category page</h1>
|
||||||
{format_date date=$CREATE_DATE}
|
|
||||||
{/loop*}
|
|
||||||
|
|
||||||
::{product attr="createdAt" output="time" format='i'};;<br />
|
{loop type="category" name="categoryloop" id="500"}
|
||||||
|
TOTO
|
||||||
|
{/loop}
|
||||||
|
|
||||||
|
{pageloop rel="categoryloop"}
|
||||||
|
{/pageloop}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
{include file="includes/header.html"}
|
{include file="includes/header.html"}
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
|
Here you are : {navigate to="current"}
|
||||||
|
|
||||||
{loop type="auth" name="auth_test" context="front" roles="CUSTOMER"}
|
{loop type="auth" name="auth_test" context="front" roles="CUSTOMER"}
|
||||||
|
|
||||||
<p>Customer is authentified :-)</p>
|
<p>Customer is authentified :-)</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user