diff --git a/core/lib/Thelia/Core/Template/Element/BaseLoop.php b/core/lib/Thelia/Core/Template/Element/BaseLoop.php
index 59747eec1..72c59290d 100755
--- a/core/lib/Thelia/Core/Template/Element/BaseLoop.php
+++ b/core/lib/Thelia/Core/Template/Element/BaseLoop.php
@@ -143,8 +143,6 @@ abstract class BaseLoop
$argument->setValue($value);
}
-
- $this->args->next();
}
if (!empty($faultActor)) {
diff --git a/core/lib/Thelia/Core/Template/Loop/Product.php b/core/lib/Thelia/Core/Template/Loop/Product.php
index 52e1ce9b5..bab71085d 100755
--- a/core/lib/Thelia/Core/Template/Loop/Product.php
+++ b/core/lib/Thelia/Core/Template/Loop/Product.php
@@ -79,21 +79,20 @@ class Product extends BaseLoop
Argument::createFloatTypeArgument('max_weight'),
Argument::createBooleanTypeArgument('current'),
Argument::createBooleanTypeArgument('current_category'),
- Argument::createIntTypeArgument('depth'),
+ Argument::createIntTypeArgument('depth', 1),
Argument::createBooleanTypeArgument('visible', 1),
new Argument(
'order',
new TypeCollection(
- new Type\EnumListType(array('alpha', 'alpha_reverse', 'reverse', 'min_price', 'max_price', 'manual', 'manual_reverse', 'ref', 'promo', 'new'))
+ new Type\EnumListType(array('alpha', 'alpha_reverse', 'reverse', 'min_price', 'max_price', 'manual', 'manual_reverse', 'ref', 'promo', 'new', 'random'))
)
),
- Argument::createBooleanTypeArgument('random', 0),
Argument::createIntListTypeArgument('exclude'),
Argument::createIntListTypeArgument('exclude_category'),
new Argument(
'feature_available',
new TypeCollection(
- new Type\IntToCombinedIntsListType(array('alpha', 'alpha_reverse', 'reverse', 'min_price', 'max_price', 'manual', 'manual_reverse', 'ref', 'promo', 'new'))
+ new Type\IntToCombinedIntsListType()
)
)
);
@@ -243,7 +242,9 @@ class Product extends BaseLoop
);
}
- $search->filterByVisible($this->getVisible());
+ $visible = $this->getVisible();
+
+ $search->filterByVisible($visible);
$orders = $this->getOrder();
@@ -287,6 +288,10 @@ class Product extends BaseLoop
case "new":
$search->addDescendingOrderByColumn(ProductTableMap::NEWNESS);
break;
+ case "random":
+ $search->clearOrderByColumns();
+ $search->addAscendingOrderByColumn('RAND()');
+ break(2);
default:
$search->orderByPosition();
break;
@@ -294,13 +299,6 @@ class Product extends BaseLoop
}
}
- $random = $this->getRandom();
-
- if ($random === true) {
- $search->clearOrderByColumns();
- $search->addAscendingOrderByColumn('RAND()');
- }
-
$exclude = $this->getExclude();
if (!is_null($exclude)) {
diff --git a/templates/smarty-sample/category.html b/templates/smarty-sample/category.html
index 55927abbd..275197848 100755
--- a/templates/smarty-sample/category.html
+++ b/templates/smarty-sample/category.html
@@ -28,7 +28,7 @@
weight : #WEIGHT
{/loop*}
-{loop name="product" type="product" order="ref" feature_available="1:*"}
+{loop name="product" type="product" order="ref" feature_available="1: (1 | 2) , 2: 4, 3: 433"}