From 6f1d0d749c709b2e51335b0ee417aa8563c6eed4 Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 27 Dec 2011 12:06:04 +1100 Subject: [PATCH] Minor DB updates --- modules/host/classes/controller/task/host.php | 4 ++-- .../product/classes/controller/product.php | 2 +- modules/product/classes/model/product.php | 15 ++++++++----- modules/product/views/product/view.php | 22 ++++++------------- modules/service/classes/model/service.php | 4 ++-- .../views/service/user/plugin/ssl/view.php | 2 +- 6 files changed, 23 insertions(+), 26 deletions(-) diff --git a/modules/host/classes/controller/task/host.php b/modules/host/classes/controller/task/host.php index a6757137..a565a88e 100644 --- a/modules/host/classes/controller/task/host.php +++ b/modules/host/classes/controller/task/host.php @@ -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; diff --git a/modules/product/classes/controller/product.php b/modules/product/classes/controller/product.php index 314d62ba..4f99cd5e 100644 --- a/modules/product/classes/controller/product.php +++ b/modules/product/classes/controller/product.php @@ -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); diff --git a/modules/product/classes/model/product.php b/modules/product/classes/model/product.php index fce47fde..d02cff5e 100644 --- a/modules/product/classes/model/product.php +++ b/modules/product/classes/model/product.php @@ -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); } diff --git a/modules/product/views/product/view.php b/modules/product/views/product/view.php index 9835c1e8..c9a72a78 100644 --- a/modules/product/views/product/view.php +++ b/modules/product/views/product/view.php @@ -28,22 +28,22 @@ echo Form::open('cart/add'); - + - prod_plugin && method_exists($record->prod_plugin_file,'product_view')) { + prod_plugin_file && method_exists($record->prod_plugin_file,'product_view')) { $pio = new $record->prod_plugin_file; echo ''; } ?> - prod_plugin && method_exists($record->prod_plugin_file,'contract_view')) { + prod_plugin_file && method_exists($record->prod_plugin_file,'contract_view')) { $pio = new $record->prod_plugin_file; echo ''; } ?> - prod_plugin && method_exists($record->prod_plugin_file,'feature_summary')) { + 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 ''; @@ -53,11 +53,11 @@ echo Form::open('cart/add'); - + - + @@ -72,14 +72,6 @@ echo Form::open('cart/add'); - - - - - - - -
description_full; ?>thumbnail) $record->show_thumb(); ?>show_thumb()) echo $a; ?>
'.$pio->product_view($record->prod_plugin_data).'
'.$pio->contract_view($record->prod_plugin_data,$record->price_base,$record->price_setup).'
'.$pio->feature_summary().' 
SKURecurring Billing Schedule Currency
sku;?> price_type);?> taxable);?>
Recurring Billing Schedule 
@@ -87,7 +79,7 @@ echo Form::open('cart/add');   - prod_plugin && method_exists($record->prod_plugin_file,'product_cart')) { + prod_plugin_file && method_exists($record->prod_plugin_file,'product_cart')) { $pio = new $record->prod_plugin_file; echo ''.$pio->product_cart($record->prod_plugin_data).''; } ?> diff --git a/modules/service/classes/model/service.php b/modules/service/classes/model/service.php index 9d311170..f81a37de 100644 --- a/modules/service/classes/model/service.php +++ b/modules/service/classes/model/service.php @@ -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); } diff --git a/modules/ssl/views/service/user/plugin/ssl/view.php b/modules/ssl/views/service/user/plugin/ssl/view.php index 22203bb6..5912fef9 100644 --- a/modules/ssl/views/service/user/plugin/ssl/view.php +++ b/modules/ssl/views/service/user/plugin/ssl/view.php @@ -35,7 +35,7 @@ Certificate -
display('cert'); ?>
+
cert; ?>