2013-10-10 02:44:53 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class supports a product cart
|
|
|
|
*
|
|
|
|
* @package Cart
|
|
|
|
* @category Models
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2009-2013 Open Source Billing
|
|
|
|
* @license http://dev.osbill.net/license.html
|
|
|
|
*/
|
2016-08-15 11:23:18 +00:00
|
|
|
class Model_Cart extends ORM {
|
2013-12-02 04:16:28 +00:00
|
|
|
// Cart doesnt use the update column
|
|
|
|
protected $_updated_column = FALSE;
|
|
|
|
|
2013-10-10 02:44:53 +00:00
|
|
|
protected $_belongs_to = array(
|
|
|
|
'product'=>array(),
|
2013-12-02 04:16:28 +00:00
|
|
|
'module'=>array(),
|
2013-10-10 02:44:53 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
protected $_serialize_column = array(
|
|
|
|
'module_data',
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Filters used to format the display of values into friendlier values
|
|
|
|
*/
|
|
|
|
protected $_display_filters = array(
|
|
|
|
'recurr_schedule'=>array(
|
2013-04-26 01:42:09 +00:00
|
|
|
array('StaticList_RecurSchedule::get',array(':value')),
|
2013-10-10 02:44:53 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
public function checkout() {
|
2013-12-02 04:16:28 +00:00
|
|
|
if (! method_exists($this->mo(),'checkout'))
|
2013-10-10 02:44:53 +00:00
|
|
|
throw new Kohana_Exception('Module :module doesnt implement checkout?',array(':module'=>get_class($this->mo)));
|
|
|
|
|
2013-12-02 04:16:28 +00:00
|
|
|
return $this->mo()->checkout();
|
2013-10-10 02:44:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function item() {
|
2013-12-02 04:16:28 +00:00
|
|
|
if (! method_exists($this->mo(),'cart_item'))
|
2013-10-10 02:44:53 +00:00
|
|
|
throw new Kohana_Exception('Module :module doesnt implement cart_item?',array(':module'=>get_class($this->mo)));
|
|
|
|
|
2013-12-02 04:16:28 +00:00
|
|
|
return $this->mo()->cart_item();
|
2013-10-10 02:44:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function mo() {
|
2013-12-02 04:16:28 +00:00
|
|
|
return $this->module->instance($this->module_item);
|
2013-10-10 02:44:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function motype() {
|
2013-12-02 04:16:28 +00:00
|
|
|
return strtolower(preg_replace('/^Model_/','',get_class($this->mo())));
|
2013-10-10 02:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|