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":

View File

@@ -49,7 +49,7 @@
{loop name="product" type="product" order="ref"}
<h3>PRODUCT : #REF / #TITLE</h3>
<h4>Accessories</h4>
{loop name="acc" type="accessory" product="#ID" order="max_price"}
{loop name="acc" type="accessory" product="#ID" order="accessory,max_price"}
#REF -
{/loop}
{/loop}