action_list(); } /** * List items in the cart */ public function action_list() { // @todo - this should be a global config item $mediapath = Route::get('default/media'); // If the cart is empty, we'll return here. if (! Cart::instance()->contents()->count_all()) Block::add(array( 'title'=>_('Empty Cart'), 'body'=>_('The cart is empty') )); else { Style::add(array( 'type'=>'file', 'data'=>'css/cart_contents.css', )); $output = Form::open('checkout/noready'); foreach (Cart::instance()->contents()->find_all() as $item) { $ppa = $item->product->get_price_array(); $pdata = Period::details($item->recurr_schedule,$item->product->price_recurr_weekday,time(),TRUE); $price_box = View::factory('cart/list_pricebox') ->set('price_recurring',Currency::display($item->quantity*$ppa[$item->recurr_schedule]['price_base'])) ->set('price_firstinvoice',Currency::display($item->quantity*$ppa[$item->recurr_schedule]['price_base']*$pdata['prorata'])) ->set('price_setup',Currency::display($item->quantity*$ppa[$item->recurr_schedule]['price_setup'])) ->set('item',$item) ->set('mediapath',$mediapath); $output .= View::factory('cart/list_item') ->set('price_box',$price_box) ->set('service_start',$pdata['date']) ->set('service_end',$pdata['end']) ->set('price_recurring',Currency::display($item->quantity*$ppa[$item->recurr_schedule]['price_base'])) ->set('item',$item) ->set('mediapath',$mediapath); // If we are a plugin product, we might need more information // @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 } } $output .= '