Page 1 of 1

Ascending order on dinner menu

Posted: 27 Oct 2011, 19:17
by jodancer
Hi,
This component has endless oportunities!!
I am using the dinner menu as a "Specials" list and was wanting to have the new specials first by default. At the moment the menu has descending order. Is it possible to change this in the code somewhere to ascending just for the dinner menu? I can't find an option in the views/dinnermenu folder without having to change the number order each time in the backend?

Thanks

Re: Ascending order on dinner menu

Posted: 27 Oct 2011, 22:21
by Jan
Hi, then you need to modify the sql query in model in frontend.

Jan

Re: Ascending order on dinner menu

Posted: 28 Oct 2011, 21:07
by jodancer
Thanks,

I try!!

Re: Ascending order on dinner menu

Posted: 02 Nov 2011, 19:42
by jodancer
Hi,
My post seems to have disappeared!
I can’t seem to get it to work (I must be doing something very wrong doh!)
In components/models/menu.php
I added
if ($type == 8) {
$wheres = array();
$wheres[] = 'a.published = 1';
$wheres[] = 'a.type = '.(int)$type;
$query = ' SELECT a.*'
. ' FROM #__phocamenu_items AS a'
. ' WHERE ' . implode(' AND ', $wheres)
. ' ORDER BY ordering DESC';
$this->_db->setQuery($query);
$this->_data['items'] = $this->_db->loadObjectList();

}

Just above
//ITEM
$wheres = array();
$wheres[] = 'a.published = 1';
$wheres[] = 'a.type = '.(int)$type;

But is not working..
I would be very grateful if you could have a look and let me know what I am doing wrong.

Re: Ascending order on dinner menu

Posted: 17 Nov 2011, 20:37
by Jan
Do you get some error message?

Re: Ascending order on dinner menu

Posted: 17 Nov 2011, 22:05
by jodancer
Hi,
No I d0n't get an error message but the sort order doesn't change

Re: Ascending order on dinner menu

Posted: 18 Nov 2011, 00:09
by Jan
Hi, then seems the changes were not successfull, but no specific advices there as not made such customization yet :-(

Re: Ascending order on dinner menu

Posted: 18 Nov 2011, 13:41
by jodancer
Thanks Jan,
I'm not very good with php but I gave it a go!
I'll keep trying to see if I can get it to work
:idea: