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

@@ -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);
}