/** * Provides a dataset of links for sorting products. */ function SortLinks() { if (count(ProductGroup::get_sort_options()) <= 0) { return null; } $sort = isset($_GET['sortby']) ? Convert::raw2sql($_GET['sortby']) : "Title"; $dos = new DataObjectSet(); foreach (ProductGroup::get_sort_options() as $field => $name) { $current = $field == $sort ? 'current' : false; $dos->push(new ArrayData(array('Name' => $name, 'Link' => $this->Link() . "?sortby={$field}", 'Current' => $current))); } return $dos; }