product loop : given id exception

This commit is contained in:
Etienne Roudeix
2013-07-22 09:36:06 +02:00
parent 87dd416a1e
commit 0e9d918b84
2 changed files with 7 additions and 7 deletions

View File

@@ -293,12 +293,12 @@ class Product extends BaseLoop
$search->orderByNewness(Criteria::DESC);
break;
case "given_id":
if (!is_null($id)) {
foreach($id as $singleId) {
$givenIdMatched = 'given_id_matched_' . $singleId;
$search->withColumn(ProductTableMap::ID . "='$singleId'", $givenIdMatched);
$search->orderBy($givenIdMatched, Criteria::DESC);
}
if(null === $id)
throw new \InvalidArgumentException('Given_id order cannot be set without `id` argument');
foreach($id as $singleId) {
$givenIdMatched = 'given_id_matched_' . $singleId;
$search->withColumn(ProductTableMap::ID . "='$singleId'", $givenIdMatched);
$search->orderBy($givenIdMatched, Criteria::DESC);
}
break;
case "random":