Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
$10
How to sort Ascending/Descending based on query parameter?
$c->addAscendingOrderByColumn('COALESCE(' . self::BRAND_NAME. ', '. self::NR_BRAND_NAME .')');which works fine. But I need to change the order from Ascending to Descending based on the query parameter.
What I do here is:
if ($order == 'D')
$orderclause = 'addDescendingOrderByColum'
else
$orderclause = 'addAscendingOrderByColum';and then add the criteria as:
$c->{$orderclause}('COALESCE(' . self::BRAND_NAME. ', '. self::NR_BRAND_NAME .')' );In which case I get the following error.
Fatal error: Call to undefined method Criteria::addDescendingOrderByColum() in /home/marshall/lib/model/CartSunroofLog2Peer.php on line 194
This question has been answered.
marshall | 06/17/10 at 11:39am
Edit
(3) Possible Answers Submitted...
See a chronological view of answers?
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
-

Last edited:
06/17/10
12:41pmClément JOBEILi says:You mispelled addDescendingOrderByColum => addDescendingOrderByColumn
if ($order == 'D')
$orderclause = 'addDescendingOrderByColumn'
else
$orderclause = 'addAscendingOrderByColumn';
Previous versions of this answer: 06/17/10 at 12:12pm | 06/17/10 at 12:12pm
-

Last edited:
06/17/10
11:44amArturo Linares says:Weird. And do you get an error using this?
$c->addDescendingOrderByColumn(COALESCE(' . self::BRAND_NAME. ', '. self::NR_BRAND_NAME .')');
-

Last edited:
06/17/10
12:41pmGlobalOrangeLab says:1) you misspelled
addDescendingOrderByColum => addDescendingOrderByColumn
2) if ($order == 'D')
$orderclause = 'addDescendingOrderByColumn'
else
$orderclause = 'addAscendingOrderByColumn';
you can use
$c->{$orderclause} ('COALESCE(' . self::BRAND_NAME. ', '. self::NR_BRAND_NAME .')' );
either
$c->$orderclause('COALESCE(' . self::BRAND_NAME. ', '. self::NR_BRAND_NAME .')' );
Hope this helps.Previous versions of this answer: 06/17/10 at 12:06pm
This question has expired.
Current status of this question: Completed
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
