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..

1
  • 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? Commented Mar 20, 2015 at 9:44

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.