Cart work for payments and Paypal work to test

This commit is contained in:
Deon George
2013-01-15 17:07:54 +11:00
parent 133ae4d5c6
commit 69645c4eea
42 changed files with 968 additions and 801 deletions

View File

@@ -18,6 +18,10 @@ class Model_Cart extends ORM_OSB {
// Cart doesnt use the update column
protected $_updated_column = FALSE;
protected $_serialize_column = array(
'module_data',
);
/**
* Filters used to format the display of values into friendlier values
*/
@@ -26,5 +30,47 @@ class Model_Cart extends ORM_OSB {
array('StaticList_RecurSchedule::display',array(':value')),
),
);
private $mo;
public function __construct($id = NULL) {
// Load our Model
parent::__construct($id);
// Autoload our Sub Items
if ($this->loaded())
$this->_load_sub_items();
return $this;
}
private function _load_sub_items() {
$this->mo = ORM::factory('Module',$this->module_id)->instance($this->module_item);
if (! $this->mo->loaded())
throw new Kohana_Exception('Item :item not loaded?',array(':item'=>$this->module_item));
}
public function checkout() {
if (! method_exists($this->mo,'checkout'))
throw new Kohana_Exception('Module :module doesnt implement checkout?',array(':module'=>get_class($this->mo)));
return $this->mo->checkout();
}
public function item() {
if (! method_exists($this->mo,'cart_item'))
throw new Kohana_Exception('Module :module doesnt implement cart_item?',array(':module'=>get_class($this->mo)));
return $this->mo->cart_item();
}
public function mo() {
return $this->mo;
}
public function motype() {
return strtolower(preg_replace('/^Model_/','',get_class($this->mo)));
}
}
?>