Minor DB updates

This commit is contained in:
Deon George 2011-12-27 12:06:04 +11:00
parent fe317b9cb0
commit 6f1d0d749c
6 changed files with 23 additions and 26 deletions

View File

@ -64,10 +64,10 @@ class Controller_Task_Host extends Controller_Task {
// Limit to show only those by the requested category.
if ($cats) {
if (! $so->product->avail_category_id OR ! preg_match('/^a:/',$so->product->avail_category_id))
if (! $so->product->avail_category OR ! preg_match('/^a:/',$so->product->avail_category))
continue;
$pc = unserialize($so->product->avail_category_id);
$pc = unserialize($so->product->avail_category);
if (! array_intersect($pc,array_keys($cats)))
continue;

View File

@ -55,7 +55,7 @@ class Controller_Product extends Controller_TemplateDefault {
$co = ORM::factory('product_category',$_GET['cid']);
// If the product category doesnt exist, or doesnt match the product
if (! $co->loaded() OR ! in_array($co->id,unserialize($po->avail_category_id)))
if (! $co->loaded() OR ! in_array($co->id,unserialize($po->avail_category)))
Request::current()->redirect('product_category/index');
Breadcrumb::name('product/view',$co->name);

View File

@ -23,7 +23,6 @@ class Model_Product extends ORMOSB {
protected $_sorting = array(
'position'=>'asc',
'sku'=>'asc',
);
protected $_display_filters = array(
@ -121,10 +120,16 @@ class Model_Product extends ORMOSB {
public function show_thumb() {
$mediapath = Route::get('default/media');
$thumb = $mediapath->uri(array('file'=>'img/thumbnails/'.$this->thumbnail));
$thumbfile = sprintf('prod_thmb_%s',$this->id);
// @todo Change the ALT to the product name.
echo HTML::image($thumb,array('alt'=>_('Thumb Nail')));
// @todo This needs to be optimised. By nice if find_files could return the HTML path too.
if (Kohana::find_file('media/img/thumbnails',$thumbfile,'png')) {
$thumb = $mediapath->uri(array('file'=>'img/thumbnails/'.$thumbfile.'.png'));
// @todo Change the ALT to the product name.
echo HTML::image($thumb,array('alt'=>_('Thumb Nail')));
} else
echo '';
}
/**
@ -149,7 +154,7 @@ class Model_Product extends ORMOSB {
$results = array();
foreach ($this->where('active','=',TRUE)->find_all() as $po) {
if ($c = unserialize($po->avail_category_id) AND in_array($cat,$c))
if ($c = unserialize($po->avail_category) AND in_array($cat,$c))
array_push($results,$po);
}

View File

@ -28,22 +28,22 @@ echo Form::open('cart/add');
<table width="100%" border="0" cellpadding="4">
<tr>
<td class="body" rowspan="3"><?php echo $translate->description_full; ?></td>
<td style="text-align: right;"><?php if ($record->thumbnail) $record->show_thumb(); ?></td>
<td style="text-align: right;"><?php if ($a=$record->show_thumb()) echo $a; ?></td>
</tr>
<tr>
<?php if ($record->prod_plugin && method_exists($record->prod_plugin_file,'product_view')) {
<?php if ($record->prod_plugin_file && method_exists($record->prod_plugin_file,'product_view')) {
$pio = new $record->prod_plugin_file;
echo '<td style="vertical-align: bottom;">'.$pio->product_view($record->prod_plugin_data).'</td>';
} ?>
</tr>
<tr>
<?php if ($record->prod_plugin && 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;
echo '<td style="vertical-align: top;">'.$pio->contract_view($record->prod_plugin_data,$record->price_base,$record->price_setup).'</td>';
} ?>
</tr>
<tr>
<?php if ($record->prod_plugin && method_exists($record->prod_plugin_file,'feature_summary')) {
<?php if ($record->prod_plugin_file && method_exists($record->prod_plugin_file,'feature_summary')) {
// @todo This doesnt work, it needs to be product_plugin_xx class
$pio = new $record->prod_plugin_file;
echo '<td style="vertical-align: top;">'.$pio->feature_summary().'</td>';
@ -53,11 +53,11 @@ echo Form::open('cart/add');
<td class="spacer" colspan="2">&nbsp;</td>
</tr>
<tr>
<td class="body" style="width: 50%;"><b>SKU</b></td>
<td class="body" style="width: 50%;"><b>Recurring Billing Schedule</b></td>
<td class="body" style="width: 50%;"><b>Currency</b></td>
</tr>
<tr>
<td class="body"><?php echo $record->sku;?></td>
<td class="body"><?php echo StaticList_RecurSchedule::form('recurr_schedule',$record);?> </td>
<!-- @todo The default currency should be system configurable and displayed by default -->
<!-- @todo If CURRENCY's value is not active in the DB, then the wrong flag is shown, as StaticList_Module::form() only returns active values -->
<!-- @todo Currency is not used in the cart? -->
@ -72,14 +72,6 @@ echo Form::open('cart/add');
<td class="body"><?php echo StaticList_PriceType::display($record->price_type);?></td>
<td class="body"><?php echo StaticList_YesNo::display($record->taxable);?></td>
</tr>
<tr>
<td class="body"><b>Recurring Billing Schedule</b></td>
<td class="body"><b>&nbsp;</b></td>
</tr>
<tr>
<td class="body"><?php echo StaticList_RecurSchedule::form('recurr_schedule',$record);?> </td>
<td class="body"><?php echo '';?></td>
</tr>
</table>
</td>
</tr>
@ -87,7 +79,7 @@ echo Form::open('cart/add');
<td class="spacer" colspan="2">&nbsp;</td>
</tr>
<tr>
<?php if ($record->prod_plugin && method_exists($record->prod_plugin_file,'product_cart')) {
<?php if ($record->prod_plugin_file && method_exists($record->prod_plugin_file,'product_cart')) {
$pio = new $record->prod_plugin_file;
echo '<td style="vertical-align: top;">'.$pio->product_cart($record->prod_plugin_data).'</td>';
} ?>

View File

@ -134,10 +134,10 @@ class Model_Service extends ORMOSB {
$cats = ORM::factory('product_category')->list_bylistgroup($cat);
foreach ($this->list_active() as $so) {
if (! $so->product->avail_category_id OR ! preg_match('/^a:/',$so->product->avail_category_id))
if (! $so->product->avail_category OR ! preg_match('/^a:/',$so->product->avail_category))
continue;
$pc = unserialize($so->product->avail_category_id);
$pc = unserialize($so->product->avail_category);
if (array_intersect($pc,array_keys($cats)))
array_push($result,$so);
}

View File

@ -35,7 +35,7 @@
</tr>
<tr>
<td>Certificate</td>
<td class="data"><pre><?php echo $so->display('cert'); ?></pre></td>
<td class="data"><pre><?php echo $so->cert; ?></pre></td>
</tr>
</table>
</td>