/** * Method to auto-populate the model state. * */ public function populateState() { parent::populateState(); $system = \Dsc\System::instance(); if ($system->app->get('APP_NAME') == 'site') { $input = $system->get('input'); /** * Handle the sort_by value, which users use to sort the list of products */ $sort_by = $input->get('sort_by', null, 'string'); $this->handleSortBy($sort_by); } return $this; }