Removed the need for price_base/price_setup in products table

This commit is contained in:
Deon George 2013-01-11 14:12:04 +11:00
parent 3fa1ca3665
commit a7a60a96d8
5 changed files with 10 additions and 30 deletions

View File

@ -55,7 +55,6 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
'prod_plugin_file'=>array('label'=>'Plugin Name'), 'prod_plugin_file'=>array('label'=>'Plugin Name'),
'prod_plugin_data'=>array('label'=>'Plugin Data'), 'prod_plugin_data'=>array('label'=>'Plugin Data'),
'price_type'=>array('label'=>'Price Type'), 'price_type'=>array('label'=>'Price Type'),
'price_base'=>array('label'=>'Price Base'),
'taxable'=>array('label'=>'Taxable'), 'taxable'=>array('label'=>'Taxable'),
'count_services()'=>array('label'=>'Services'), 'count_services()'=>array('label'=>'Services'),
'count_invoices()'=>array('label'=>'Invoices'), 'count_invoices()'=>array('label'=>'Invoices'),

View File

@ -11,6 +11,9 @@
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
class Controller_Product extends Controller_TemplateDefault { class Controller_Product extends Controller_TemplateDefault {
/**
* Show a list of product categories
*/
public function action_categorys() { public function action_categorys() {
$output = '<div id="category">'; $output = '<div id="category">';
$output .= '<ul>'; $output .= '<ul>';
@ -19,9 +22,7 @@ class Controller_Product extends Controller_TemplateDefault {
$a = '<h3>'.$pco->display('name').'</h3>'; $a = '<h3>'.$pco->display('name').'</h3>';
$a .= '<p>'.$pco->description().'</p>'; $a .= '<p>'.$pco->description().'</p>';
$output .= '<li>'; $output .= '<li>'.HTML::anchor('product/category/'.$pco->id,$a).'</li>';
$output .= HTML::anchor('product/category/'.$pco->id,$a);
$output .= '</li>';
} }
$output .= '</ul>'; $output .= '</ul>';
@ -32,6 +33,7 @@ class Controller_Product extends Controller_TemplateDefault {
/** /**
* Show the available topics in a category * Show the available topics in a category
*
* @todo Only show categories according to their validity dates * @todo Only show categories according to their validity dates
* @todo Obey sort order * @todo Obey sort order
*/ */
@ -92,10 +94,10 @@ class Controller_Product extends Controller_TemplateDefault {
} }
Block::add(array( Block::add(array(
'title'=>$po->product_translate->find()->description_short, 'title'=>$po->description_short(),
'body'=>View::factory($this->viewpath()) 'body'=>View::factory($this->viewpath())
->set('record',$po), ->set('record',$po),
)); ));
} }
} }
?> ?>

View File

@ -26,10 +26,6 @@ class Model_Product extends ORM_OSB {
); );
protected $_display_filters = array( protected $_display_filters = array(
'price_base'=>array(
array('Tax::add',array(':value')),
array('Currency::display',array(':value')),
),
'price_type'=>array( 'price_type'=>array(
array('StaticList_PriceType::display',array(':value')), array('StaticList_PriceType::display',array(':value')),
), ),

View File

@ -9,10 +9,6 @@
<td style="width: 5%;">&nbsp;</td> <td style="width: 5%;">&nbsp;</td>
<td style="width: 60%;" class="data"><?php echo StaticList_YesNo::form('status',$po->status); ?></td> <td style="width: 60%;" class="data"><?php echo StaticList_YesNo::form('status',$po->status); ?></td>
</tr> </tr>
<tr>
<td colspan="2">Base Price</td>
<td class="data"><?php echo Form::input('price_base',$po->price_base); ?></td>
</tr>
<tr> <tr>
<td colspan="2">Price</td> <td colspan="2">Price</td>
<td class="data"> <td class="data">

View File

@ -1,20 +1,6 @@
<?php <?php
if (! $record) {
echo _('Sorry, product not found, or your account is not authorized to view it.');
return;
}
// Load the language
$translate = $record->product_translate->where('product_id','=',$record->id)->and_where('language_id','=','fr')->find();
// If there isnt a translated page, show the default language
// @todo - default language should come from configuration
if (! $translate->loaded())
$translate = $record->product_translate->where('product_id','=',$record->id)->and_where('language_id','=',1)->find();
// @todo Need to add in product attributes // @todo Need to add in product attributes
// @todo Need to add in product plugins // @todo Need to add in product plugins
echo Form::open('cart/add'); echo Form::open('cart/add');
?> ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_background"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_background">
@ -27,7 +13,7 @@ echo Form::open('cart/add');
<td style="background-color: #FFFFFF;"> <td style="background-color: #FFFFFF;">
<table width="100%" border="0" cellpadding="4"> <table width="100%" border="0" cellpadding="4">
<tr> <tr>
<td class="body" rowspan="4"><?php echo $translate->description_full; ?></td> <td class="body" rowspan="4"><?php echo $record->description_long(); ?></td>
<td style="text-align: right;"><?php if ($a=$record->show_thumb()) echo $a; ?></td> <td style="text-align: right;"><?php if ($a=$record->show_thumb()) echo $a; ?></td>
</tr> </tr>
<tr> <tr>
@ -39,7 +25,8 @@ echo Form::open('cart/add');
<tr> <tr>
<?php if ($record->prod_plugin_file && method_exists($record->prod_plugin_file,'contract_view')) { <?php if ($record->prod_plugin_file && method_exists($record->prod_plugin_file,'contract_view')) {
$pio = new $record->prod_plugin_file; $pio = new $record->prod_plugin_file;
echo '<td style="vertical-align: top;">'.$pio->contract_view($record->prod_plugin_data,$record->price_base,$record->price_setup).'</td>'; // @todo This is a hack, need to work out the correct recur_price_schedule dynamically
echo '<td style="vertical-align: top;">'.$pio->contract_view($record->prod_plugin_data,$record->price(0,1,'price_base'),$record->price(0,1,'price_setup')).'</td>';
} ?> } ?>
</tr> </tr>
<tr> <tr>