duanbei7035 2016-12-30 13:55
浏览 32
已采纳

在codeigniter中没有加载视图,redirect()方法也没有加载

I am integrating ccavenue and I have to send order data to the ccavenue_request_handler_view but that view is not loading for some reason...

I dont't know what is causing the error. Right now I have only displayed an h1 tag in that view file, which is also not working.

//order.php controller

$grand_total = 0;
                  $order_id = now();
                  $ccavenue_send_data = array();
                  if ($cart = $this->cart->contents())
                  {
                      $cart_item = $this->cart->total_items();

              foreach ($cart as $cart_item)
              {
                  $itemid=$cart_item['id'];
                  $quantity = $cart_item['qty'];
                  $item_price = $cart_item['price'];

                  $total = $item_price*$quantity;

                  $shipping_cost = $this->get_shipping_cost($itemid,$quantity);
                  $pay_amount = $total+$shipping_cost;

                  $grand_total += $pay_amount; 

                  if($cart_item > 1)
                  {
                      $order_type="bulk";
                  }
                  else
                  {
                      $order_type="single";
                  }

                  $order_data = array(
                      'order_id' => $order_id,
                      'email'   => $Email,
                      'customer_type'   => $customer_type,
                      'payment_id'   => $payment_id,
                      'payment_method'   => $payment_method,
                      'address_id'   => $add_id,
                      'order_type'   => $order_type,
                      'order_group'   => 0,
                      'order_status'   => "processing",
                      'active'   => 0,
                      'return_id'   => 0,
                      'coupon_id'   => $Coupon,
                      'coupon_discount'   => $coupon_discount ,
                      'total_amount'   => $total,
                      'pay_amount'   => $pay_amount,
                      'shipping_date'   => "2017-12-28 06:12:10",
                      'item_id'   => $itemid,
                      'item_quantity'   => $quantity,
                      'shipping_charge'   => $shipping_cost,
                      'order_modified'   => $Contact
                  );

                   $this->order_model->add_order($order_data);
              }

              $ccavenue_send_data = array(
                  'tid' => $order_id,
                  'merchant_id' => 'xxxxx',
                  'order_id' => $order_id,
                  'amount' => $grand_total,
                  'currency' => 'INR',
                  'redirect_url' => base_url().'index.php/Order/return_from_ccavenue',
                  'cancel_url' => base_url().'index.php/Order/cancel_from_ccavenue',
                  'language' => 'EN',
                  'billing_name' => $Fname,
                  'billing_address' => $Address1.'&&'.$Address2,
                  'billing_city' => $City,
                  'billing_state' => 'Gujarat',
                  'billing_zip' => $Zip,
                  'billing_country' => 'India',
                  'billing_tel' => $Contact,
                  'billing_email' => $Email,
                  'delivery_name' => $Fname,
                  'delivery_address' => $Address1.'&&'.$Address2,
                  'delivery_city' => $City,
                  'delivery_state' => 'Gujarat',
                  'delivery_zip' => $Zip,
                  'delivery_country' => 'India',
                  'delivery_tel' => $Contact,
                  'promo_code' => $Coupon
              );
              $this->session->set_userdata('ccavenue_send_data',$ccavenue_send_data);             
          }

          //$data['ccav_request_data'] = $ccavenue_send_data ;

          // $this->load->view('ccavRequestHandler_view',$data); --> loading view is not working so i tried redirect method by storing data in session which is not working too

           redirect('Order/ccavenue_request_handler','refresh');

          $this->cart->destroy();
          redirect('home','refresh');

this is where it will be redirected if that works...

function ccavenue_request_handler()
    {
        $data['post_data'] = $this->session->userdata('ccavenue_send_data');
        $this->load->view('ccavRequestHandler_view',$data);
    }
  • 写回答

1条回答 默认 最新

  • dragon188199 2017-01-09 23:59
    关注

    in codeigniter you have to redirect routes manually it should not be like this redirect('home','refresh'); it should be like this -if you configure your base_url it can go like this- redirect(base_url()."order/ccavenue_request_handler"); or if the base_url is not configured redirect('http://yourprojectname/order/ccavenue_request_handler');

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵