'; $output .= ''; $output .= ''; $this->template->content = $output; } /** * Show the available topics in a category * @todo Only show categories according to their validity dates * @todo Obey sort order */ public function action_category($id) { $cat = ORM::factory('product_category',$id); if (! $cat->loaded()) Request::current()->redirect('welcome/index'); Breadcrumb::name($this->request->uri(),$cat->name); Breadcrumb::url('product','product/categorys'); Breadcrumb::url('product/category','product/categorys'); Block::add(array( 'title'=>sprintf('%s: %s',_('Category'),$cat->name), 'body'=>View::factory($this->viewpath().'/view') ->set('results',$this->_get_category($cat->id)) ->set('cat',$cat->id), )); } /** * Obtain a list of pages in a category */ private function _get_category($id) { return ORM::factory('product')->list_category($id); } /** * Show a product */ public function action_view($id) { $po = ORM::factory('product',$id); if (! $po->loaded()) Request::current()->redirect('product_category/index'); Breadcrumb::name($this->request->uri(),$po->product_translate->find()->name); Breadcrumb::url('product','product/categorys'); // Work out our category id for the control line if (! empty($_GET['cid'])) { $co = ORM::factory('product_category',$_GET['cid']); // If the product category doesnt exist, or doesnt match the product if (! $co->loaded() OR ! in_array($co->id,unserialize($po->avail_category))) Request::current()->redirect('product_category/index'); Breadcrumb::name('product/view',$co->name); Breadcrumb::url('product/view','product/category/'.$co->id); } Block::add(array( 'title'=>$po->product_translate->find()->description_short, 'body'=>View::factory($this->viewpath()) ->set('record',$po), )); } } ?>