我目前正在制作一个模块,允许客户在他/她已经下订单后更新他/她的订单。 我的问题是我无法检索订购的产品并将它们插入购物车。
public function updateorder(){
if ($this->session->userdata('email')) {
$orderid = $this->session->userdata('email');
$data['order'] = $this->customer_model->order($serial);
$data['detail'] = $this->customer_model->get_order($serial);
$detail = $this->customer_model->get_order($serial);
$this->header();
foreach($detail as $item){
echo $item->customerid;
echo $item->productid;
echo $item->quantity;
echo $item->price;
echo $item->product;
echo $item->picture;
$itemarray = array(
'customerid' => $item['cid'],
'productid' => $item['pid'],
'quantity' => $item['qty'],
'price' => $item['price'],
'product' => $item['product'],
'picture' => $item['picture']
);
}
$this->cart->insert($itemarray);
redirect('customer/Cart');
} else {
redirect('customer/login');
}