【发布时间】:2015-03-19 19:45:21
【问题描述】:
控制器 --
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');
}
在这里,我想在 shop_page 方法上重定向,并且我想使用重定向方法在 shop_page 上传递 $data['shop_data] 数组,而不使用 $this->>load->view('shop_page',$data) .. ..那么它怎么可能..
【问题讨论】:
-
我不知道这是可能的。 redirect() 无法传递参数,因为页面或控制器已更改。为什么不在商店页面中创建 $data['shop_data']?
标签: php codeigniter