Example #1
0
 /**
  * returns file attached to the order, if theres file...
  * @return void 
  */
 public function action_download()
 {
     $this->auto_render = FALSE;
     $err_msg = __('Download not found.');
     $order_id = $this->request->param('id', 0);
     $user = Auth::instance()->get_user();
     $order = new Model_Order();
     $order->where('id_user', '=', $user->id_user)->where('id_order', '=', $order_id)->where('status', '=', Model_Order::STATUS_PAID)->limit(1)->find();
     if ($order->loaded()) {
         $err_msg = $order->download();
     }
     Alert::set(Alert::ERROR, $err_msg);
     $this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'orders')));
 }