product loop : given id exception
This commit is contained in:
@@ -293,13 +293,13 @@ class Product extends BaseLoop
|
|||||||
$search->orderByNewness(Criteria::DESC);
|
$search->orderByNewness(Criteria::DESC);
|
||||||
break;
|
break;
|
||||||
case "given_id":
|
case "given_id":
|
||||||
if (!is_null($id)) {
|
if(null === $id)
|
||||||
|
throw new \InvalidArgumentException('Given_id order cannot be set without `id` argument');
|
||||||
foreach($id as $singleId) {
|
foreach($id as $singleId) {
|
||||||
$givenIdMatched = 'given_id_matched_' . $singleId;
|
$givenIdMatched = 'given_id_matched_' . $singleId;
|
||||||
$search->withColumn(ProductTableMap::ID . "='$singleId'", $givenIdMatched);
|
$search->withColumn(ProductTableMap::ID . "='$singleId'", $givenIdMatched);
|
||||||
$search->orderBy($givenIdMatched, Criteria::DESC);
|
$search->orderBy($givenIdMatched, Criteria::DESC);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "random":
|
case "random":
|
||||||
$search->clearOrderByColumns();
|
$search->clearOrderByColumns();
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
{loop name="product" type="product" order="ref"}
|
{loop name="product" type="product" order="ref"}
|
||||||
<h3>PRODUCT : #REF / #TITLE</h3>
|
<h3>PRODUCT : #REF / #TITLE</h3>
|
||||||
<h4>Accessories</h4>
|
<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 -
|
#REF -
|
||||||
{/loop}
|
{/loop}
|
||||||
{/loop}
|
{/loop}
|
||||||
Reference in New Issue
Block a user