0

controller --

  public function add_to_cart($id,$quantity){
            $this->load->model("getdb");
            $this->load->model('shops_model');
            $ins=TRUE;
            $product1= $this->getdb->Product($id);
            $price1 = $quantity/$product1[0]->min_quantity;
            foreach ($this->cart->contents() as $items) {
                if($items['id']==$id){
                    $ins=FALSE;
                $data = array(  
              'rowid'    => $items['rowid'],
               'id'      => $id,
               'price'   => $product1[0]->selling_price*$price1,
               'name'    => $product1[0]->product_name,
               'options' => array('image' =>$product1[0]->image1, 'unit' => $product1[0]->unit, 'quantity' => $quantity)
            );
        $this->cart->update($data);
            }
        }if($ins){
        $data = array(
               'id'      => $id,
               'qty'     => 1,enter code here
               'price'   => $product1[0]->selling_price*$price1,
               'name'    => $product1[0]->product_name,
               'options' => array('image' =>$product1[0]->image1, 'unit' => $product1[0]->unit, 'quantity' => $quantity)
            );
        $this->cart->insert($data);
        }
        $data['shops_id_data']= $this->shops_model->getshopiddata($id);
        $a = end(end($data['shops_id_data']));
        $data['shops_data']= $this->shops_model->getshopdata($a);
        redirect('Shops/shop_page');
    }

here i want to redirect on shop_page method and also i want to pass $data['shop_data] array on shop_page using redirect method without using $this->>load->view('shop_page',$data) ....so how its possible..

Sorav Garg
  • 1,116
  • 1
  • 9
  • 26
  • I have no idea it's possible. redirect() cannot pass parameter because page or controller is changed. why you don't create $data['shop_data'] in shop page? – lyhong Mar 20 '15 at 09:44

1 Answers1

0

I use HMVC in my codeigniter installation. For this then I would use something like

$this->load->module("Shops/shop");
$this->Shops->shop_page($data);

This post helped me https://stackoverflow.com/a/14960794/501827

Not sure if this would work if you are not using HMVC, but some googling would probably fill the gaps.

Community
  • 1
  • 1
PrestonDocks
  • 4,851
  • 9
  • 47
  • 82