Updated OSB to work with KH 3.1

This commit is contained in:
Deon George
2011-05-14 17:35:33 +10:00
parent 6d256839fc
commit 9dda9f43f4
42 changed files with 397 additions and 347 deletions

View File

@@ -25,11 +25,9 @@ class Controller_Cart extends Controller_TemplateDefault {
// @todo - this should be a global config item
$mediapath = Route::get('default/media');
$block = new block;
// If the cart is empty, we'll return here.
if (! Cart::instance()->contents()->count_all())
$block->add(array(
Block::add(array(
'title'=>_('Empty Cart'),
'body'=>_('The cart is empty')
));
@@ -61,7 +59,8 @@ class Controller_Cart extends Controller_TemplateDefault {
->set('mediapath',$mediapath);
// If we are a plugin product, we might need more information
if ($item->product->prod_plugin AND method_exists($item->product->prod_plugin_file,'product_cart')) {
// @todo If an admin, show a system message if cart_info doesnt exist.
if ($item->product->prod_plugin AND method_exists($item->product->prod_plugin_file,'product_cart') AND Kohana::find_file('views',sprintf('%s/cart_info',strtolower($item->product->prod_plugin_file)))) {
$output .= View::factory(sprintf('%s/cart_info',strtolower($item->product->prod_plugin_file)));
// @todo JS validation will need to verify data before submission
@@ -70,14 +69,12 @@ class Controller_Cart extends Controller_TemplateDefault {
$output .= '<div>'.Form::submit('submit',_('Checkout')).'</div>';
$output .= Form::close();
$block->add(array(
Block::add(array(
'title'=>_('Your Items'),
'body'=>$output,
));
}
$this->template->content = $block;
// Suppress our right hand tab
$this->template->right = ' ';
}
@@ -99,7 +96,7 @@ class Controller_Cart extends Controller_TemplateDefault {
echo Kohana::debug($cart->validate()->errors());
if ($cart->saved())
Request::instance()->redirect('cart/index');
Request::current()->redirect('cart/index');
else
throw new Kohana_Exception(_('There was a problem adding the item to the cart.'));
}

View File

@@ -15,11 +15,16 @@ class Model_Cart extends ORMOSB {
'product'=>array(),
);
protected $_formats = array(
'recurr_schedule'=>array('StaticList_RecurSchedule::display'=>array()),
);
// Cart doesnt use the update column
protected $_updated_column = FALSE;
/**
* Filters used to format the display of values into friendlier values
*/
protected $_display_filters = array(
'recurr_schedule'=>array(
array('StaticList_RecurSchedule::display',array(':value')),
),
);
}
?>