public function setUp() { parent::setUp(); ProductCategory::config()->must_have_price = false; $this->products = $this->objFromFixture('ProductCategory', 'products'); $this->products->publish('Stage', 'Live'); $this->clothing = $this->objFromFixture('ProductCategory', 'clothing'); $this->clothing->publish('Stage', 'Live'); $this->electronics = $this->objFromFixture('ProductCategory', 'electronics'); $this->electronics->publish('Stage', 'Live'); $this->socks = $this->objFromFixture('Product', 'socks'); $this->socks->publish('Stage', 'Live'); $this->tshirt = $this->objFromFixture('Product', 'tshirt'); $this->tshirt->publish('Stage', 'Live'); $this->hdtv = $this->objFromFixture('Product', 'hdtv'); $this->hdtv->publish('Stage', 'Live'); $this->beachball = $this->objFromFixture('Product', 'beachball'); $this->beachball->publish('Stage', 'Live'); $this->mp3player = $this->objFromFixture('Product', 'mp3player'); $this->mp3player->publish('Stage', 'Live'); Versioned::reading_stage('Live'); }
/** * Sorting controls * * @return ListSorter sorter */ public function getSorter() { $options = array(); foreach (ProductCategory::config()->sort_options as $k => $v) { // make the label translatable $k = _t("ProductCategory.{$k}", $k); $options[$k] = $v; } $sorter = ListSorter::create($this->request, $options); $this->extend('updateSorter', $sorter); return $sorter; }
/** * Sorting controls * @return ListSorter sorter */ public function getSorter() { $sorter = new ListSorter($this->request, ProductCategory::config()->sort_options); $this->extend('updateSorter', $sorter); return $sorter; }