我的代码出了什么问题。我想在购物车中添加包含现有商品的新商品
<?php
if($_SESSION['shopping_cart']['item'])
{
$dish[0]= array('meal_type'=>$meal_type,'meal_package'=>$meal_package,'meal_time'=>$meal_time,'meal_plan_days'=>$meal_plan_days,'meal_dish_type'=>$meal_dish_type,'prefixed_qty'=>$prefixed_qty,'prefixed_date'=>$prefixed_date,'cart_plan'=>$cart_total,'product_rule'=>$product_rule);
$_SESSION['shopping_cart']['item'] = $dish;
$_SESSION['shopping_cart']['cart_total'] = $cart_total*$prefixed_qty;
}
else
{
$item[]=array('meal_type'=>$meal_type,'meal_package'=>$meal_package,'meal_time'=>$meal_time,'meal_plan_days'=>$meal_plan_days,'meal_dish_type'=>$meal_dish_type,'prefixed_qty'=>$prefixed_qty,'prefixed_date'=>$prefixed_date,'cart_plan'=>$cart_total,'product_rule'=>$product_rule);
$dish=array_push($dish,$item);
$_SESSION['shopping_cart']['item'] = $dish;
$_SESSION['shopping_cart']['cart_total'] = $cart_total*$prefixed_qty;
}
?>
答案 0 :(得分:0)
试试这个
{{1}}