Add in loop ProductSaleElements the order argument

add order arguments 'min_quantity' and 'max_quantity'
This commit is contained in:
zzuutt
2014-07-10 17:21:01 +02:00
parent f8ad3e34ae
commit a6a6269742

View File

@@ -60,7 +60,7 @@ class ProductSaleElements extends BaseLoop implements PropelSearchLoopInterface
new Argument( new Argument(
'order', 'order',
new TypeCollection( new TypeCollection(
new Type\EnumListType(array('min_price', 'max_price', 'promo', 'new', 'random')) new Type\EnumListType(array('min_quantity','max_quantity','min_price', 'max_price', 'promo', 'new', 'random'))
), ),
'random' 'random'
) )
@@ -79,6 +79,12 @@ class ProductSaleElements extends BaseLoop implements PropelSearchLoopInterface
foreach ($orders as $order) { foreach ($orders as $order) {
switch ($order) { switch ($order) {
case "min_quantity":
$search->orderByQuantity(Criteria::ASC);
break;
case "max_quantity":
$search->orderByQuantity(Criteria::DESC);
break;
case "min_price": case "min_price":
$search->addAscendingOrderByColumn('price_FINAL_PRICE', Criteria::ASC); $search->addAscendingOrderByColumn('price_FINAL_PRICE', Criteria::ASC);
break; break;