Ascending order on dinner menu

Phoca Restaurant Menu - restaurant menu manager
jodancer
Phoca Member
Phoca Member
Posts: 10
Joined: 16 Sep 2011, 18:49

Ascending order on dinner menu

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Ascending order on dinner menu

Post by Jan »

Hi, then you need to modify the sql query in model in frontend.

Jan
If you find Phoca extensions useful, please support the project
jodancer
Phoca Member
Phoca Member
Posts: 10
Joined: 16 Sep 2011, 18:49

Re: Ascending order on dinner menu

Post by jodancer »

Thanks,

I try!!
jodancer
Phoca Member
Phoca Member
Posts: 10
Joined: 16 Sep 2011, 18:49

Re: Ascending order on dinner menu

Post 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.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Ascending order on dinner menu

Post by Jan »

Do you get some error message?
If you find Phoca extensions useful, please support the project
jodancer
Phoca Member
Phoca Member
Posts: 10
Joined: 16 Sep 2011, 18:49

Re: Ascending order on dinner menu

Post by jodancer »

Hi,
No I d0n't get an error message but the sort order doesn't change
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Ascending order on dinner menu

Post by Jan »

Hi, then seems the changes were not successfull, but no specific advices there as not made such customization yet :-(
If you find Phoca extensions useful, please support the project
jodancer
Phoca Member
Phoca Member
Posts: 10
Joined: 16 Sep 2011, 18:49

Re: Ascending order on dinner menu

Post 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:
Post Reply