loop fixe

This commit is contained in:
Etienne Roudeix
2013-07-24 11:32:32 +02:00
parent 7a069bc83a
commit cf0d8b6f4e
2 changed files with 3 additions and 12 deletions

View File

@@ -46,12 +46,7 @@ use Thelia\Type;
* - current : current id is used if you are on a category page * - current : current id is used if you are on a category page
* - not_empty : if value is 1, category and subcategories must have at least 1 product * - not_empty : if value is 1, category and subcategories must have at least 1 product
* - visible : default 1, if you want category not visible put 0 * - visible : default 1, if you want category not visible put 0
* - order : all value available : * - order : all value available : 'alpha', 'alpha_reverse', 'manual' (default), 'manual-reverse', 'random'
* * alpha : sorting by title alphabetical order
* * alpha_reverse : sorting by title alphabetical reverse order
* * reverse : sorting by position descending
* * by default results are sorting by position ascending
* - random : if 1, random results. Default value is 0
* - exclude : all category id you want to exclude (as for id, an integer or a "string list" can be used) * - exclude : all category id you want to exclude (as for id, an integer or a "string list" can be used)
* *
* example : * example :
@@ -87,7 +82,6 @@ class Category extends BaseLoop
), ),
'manual' 'manual'
), ),
Argument::createBooleanTypeArgument('random', 0),
Argument::createIntListTypeArgument('exclude') Argument::createIntListTypeArgument('exclude')
); );
} }
@@ -190,7 +184,7 @@ class Category extends BaseLoop
$loopResultRow->set("ID", $category->getId()); $loopResultRow->set("ID", $category->getId());
$loopResultRow->set("URL", $category->getUrl()); $loopResultRow->set("URL", $category->getUrl());
$loopResultRow->set("LINK", $category->getLink()); $loopResultRow->set("LINK", $category->getLink());
$loopResultRow->set("NB_CHILD", $category->countChild()); $loopResultRow->set("PRODUCT_COUNT", $category->countChild());
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);
} }

View File

@@ -84,7 +84,7 @@ class Product extends BaseLoop
new Argument( new Argument(
'order', 'order',
new TypeCollection( new TypeCollection(
new Type\EnumListType(array('alpha', 'alpha_reverse', 'reverse', 'min_price', 'max_price', 'manual', 'manual_reverse', 'ref', 'promo', 'new', 'random', 'given_id')) new Type\EnumListType(array('alpha', 'alpha_reverse', 'min_price', 'max_price', 'manual', 'manual_reverse', 'ref', 'promo', 'new', 'random', 'given_id'))
), ),
'manual' 'manual'
), ),
@@ -264,9 +264,6 @@ class Product extends BaseLoop
case "alpha_reverse": case "alpha_reverse":
$search->addDescendingOrderByColumn(\Thelia\Model\Map\ProductI18nTableMap::TITLE); $search->addDescendingOrderByColumn(\Thelia\Model\Map\ProductI18nTableMap::TITLE);
break; break;
case "reverse":
$search->orderByPosition(Criteria::DESC);
break;
case "min_price": case "min_price":
$search->orderBy('real_price', Criteria::ASC); $search->orderBy('real_price', Criteria::ASC);
break; break;