public function delBundling($bundling) { $bundling_id = NULL; $products_ids = NULL; $ship_id = NULL; if (isset($bundling["bundling_id"]) && $bundling["bundling_id"] > 0) { $bundling_id = $bundling["bundling_id"]; } else { $ret["msg"] = "添加商品失败,没有商品ID"; $ret["status"] = false; return $ret; } $bundling_inst = new Bundling(); if (isset($bundling["products_ids"]) && $bundling["products_ids"] > 0 && isset($bundling["ship_id"]) && $bundling["ship_id"] > 0) { $products_ids = $bundling["products_ids"]; $ship_id = $bundling["ship_id"]; } else { $item = array(); $item = $bundling_inst->getBundling($bundling_id); // 获取购物车 所有的商品 if (!empty($item) && isset($item["goods_id"])) { $products_ids = $item["products_ids"]; //$ship_id = $item["ship_id"]; // 为非空 } else { $ret["msg"] = "删除商品失败,没有商品ID或ship_id"; $ret["status"] = false; return $ret; } } unset($this->items[$ship_id]["bundling_list"][$bundling_id][$products_ids]); $ret["msg"] = "删除商品成功!"; $ret["status"] = true; return $ret; }
function index() { $bundling_inst = new Bundling(); $bundlingArr = $bundling_inst->getBundlingListWithProducts(4); $this->assign("bundling_list", $bundlingArr); $this->redirect(); }