Improved service display

This commit is contained in:
Deon George
2011-07-14 19:09:03 +10:00
parent 46c3b9a075
commit 27cdab1fe4
37 changed files with 1319 additions and 1042 deletions

View File

@@ -21,12 +21,71 @@ class Model_Product extends ORMOSB {
'sku'=>'asc',
);
protected $_formats = array(
protected $_display_format = array(
'price_type'=>array('StaticList_PriceType::display'=>array()),
);
/**
* The feature summary should be implemented in child objects.
* It is displayed on the product overview page, as a summary of the products features.
*/
protected function _feature_summary() {
throw new Kohana_Exception(':method not defined in child class :class',array(':method'=>__METHOD__,':class'=>get_class($this)));
}
/**
* The summary should be implemented in child objects.
*/
protected function _summary() {
return _('No Description');
}
/**
* Return the object of the product plugin
*/
private function plugin() {
if (! $this->prod_plugin_file)
return NULL;
if (! is_numeric($this->prod_plugin_data))
throw new Kohana_Exception('Missing plugin_id for :product (:type)',array(':product'=>$this->id,':type'=>$this->prod_plugin_file));
$spn = sprintf('%s_%s',get_class($this),$this->prod_plugin_file);
return new $spn($this->prod_plugin_data);
}
/**
* Get the product name, after translating
*/
public function name() {
return $this->product_translate->find()->display('name');
}
/**
* This will render the product feature summary information
*/
public function feature_summary() {
if (is_null($plugin = $this->plugin()))
return HTML::nbsp('');
else
return $plugin->_feature_summary();
}
/**
* Get the summary description
*
* Generally this is used on the invoice summary page
*/
public function summary() {
if (is_null($plugin = $this->plugin()))
return _('Other');
else
return $plugin->_summary();
}
/**
* Return the products for a given category
* @todo This shouldnt be here.
*/
public function category($cat) {
$results = array();