Can't override options_list

public function options_list($key = 'id', $val = '' , $where = array(), $order = TRUE, $group = TRUE)
{
$order = 'packages.price asc';
$data = parent::options_list($key, $val, $where, $order);
//echo("HERE HERE" );

return $data;
}

Does absolutely nothing.

I'm assuming this function is for the list of all entries when you click on the menu item.

Comments

  • That function provides a key/value pair that is often used for dropdown selects. The dropdown select that is displayed in a detail view to quickly navigate to other records uses the get_others() method which internally uses the options_list() method.

  • So how do I change the order of the items on the view you see when you click the menu item. I want to order by price

  • I'm guessing you are referring to the get_others() dropdown list ordering. If so,
    the options_list() method has the following parameters:

    options_list($key = NULL, $val = NULL, $where = array(), $order = TRUE)
    

    If the value is set to TRUE, it will default to ordering the values to ascending order, however you can change that value to something like 'price desc'.

  • Say I wanted to order this by week when I come into this module list page
    How is that done?

  • There is a 'default_col' and 'default_order' simple module parameter you can use:
    https://docs.getfuelcms.com/modules/simple

    You can also set the default parameters in the model's list_items method signature.

Sign In or Register to comment.