我想在 codeigniter 中为同一项目添加两个价格。但是在 codeigniter 购物车功能中只能添加一个价格。我需要单独插入 INR 价格和 USD 价格。我怎样才能做到这一点 ?我在过去的 8 小时里卡住了,请任何人清除我
在购物车中添加商品的正常代码
$proid=$this->input->post('pid');
$this->db->where('pid',$pid);
$data=$this->db->get('product')->result();
foreach ($data as $pro)
{
$proname=$pro->pro_name;
$salb1=$pro->s1price;
$salb2=$pro->s2price;
$salb3=$pro->s3price;
$salb4=$pro->s4price;
$proimg=$pro->image_name;
$nwt=$pro->case_netweight;
$gwt=$pro->case_grossweight;
$cbm=$pro->cbm;
}
switch ($this->session->userdata('buser_slab'))
{
case 1:
$price = $salb1;
break;
case 2:
$price = $salb2;
break;
case 3:
$price = $salb3;
break;
case 4:
$price = $salb4;
break;
}
$propriceinr =round($price + round(($price * $this->session->userdata('margin'))/100,2));
$dat = array(
'id' => $pid,
'qty' => 1,
'price' => $propriceinr,
'name' => $proname,
'options' => array('cbm' => $cbm, 'nwt' => $nwt,'gwt'=>$gwt,'image' => $proimg ,'price'=>$price)
);
$this->cart->insert($dat);