Major theme rework

This commit is contained in:
Deon George
2012-01-29 17:23:24 +11:00
parent 3d1c43687c
commit 89bb9004ed
49 changed files with 663 additions and 1320 deletions

View File

@@ -40,7 +40,7 @@ class Model_Invoice_Item extends ORMOSB {
// Items belonging to an invoice
private $subitems = array();
private $subitems_load = FALSE;
private $subitems_loaded = FALSE;
public function __construct($id = NULL) {
// Load our model.
@@ -51,9 +51,9 @@ class Model_Invoice_Item extends ORMOSB {
private function load_sub_items() {
// Load our sub items
if (! $this->subitems_load AND $this->loaded()) {
if (! $this->subitems_loaded AND $this->loaded()) {
$this->subitems['tax'] = $this->invoice_item_tax->find_all()->as_array();
$this->subitems_load = TRUE;
$this->subitems_loaded = TRUE;
}
return $this;

View File

@@ -11,6 +11,25 @@
* @license http://dev.leenooks.net/license.html
*/
class Controller_Product extends Controller_TemplateDefault {
public function action_categorys() {
$output = '<div id="category">';
$output .= '<ul>';
foreach (ORM::factory('product_category')->list_active()->find_all() as $pco) {
$a = '<h3>'.$pco->display('name').'</h3>';
$a .= '<p>'.$pco->description().'</p>';
$output .= '<li>';
$output .= HTML::anchor('product/category/'.$pco->id,$a);
$output .= '</li>';
}
$output .= '</ul>';
$output .= '</div>';
$this->template->content = $output;
}
/**
* Show the available topics in a category
* @todo Only show categories according to their validity dates

View File

@@ -13,10 +13,22 @@
class Model_Product_Category extends ORMOSB {
protected $_table_name = 'product_cat';
protected $_has_many = array(
'product_category_translate'=>array('foreign_key'=>'product_cat_id','far_key'=>'id'),
);
protected $_sorting = array(
'name'=>'asc',
);
public function description() {
return ($a=$this->product_category_translate->where('language_id','=','en')->find()->description) ? $a : 'No Description';
}
public function list_active() {
return $this->where('status','=',1);
}
public function list_bylistgroup($cat) {
$result = array();