function ReturnBuycardd() { global $empire, $class_r, $dbtbpre; $buycar = getcvar('mybuycar'); $record = "!"; $field = "|"; $r = explode($record, $buycar); $alltotal = 0; $return[0] = 0; //是否全部积分 $return[1] = 0; //购买总积分 $return[2] = 0; //购买总金额 $return[3] = ""; //存放格式 $newbuycar = ""; for ($i = 0; $i < count($r) - 1; $i++) { $pr = explode($field, $r[$i]); $productid = $pr[1]; $fr = explode(",", $pr[1]); //ID $classid = (int) $fr[0]; $id = (int) $fr[1]; if (empty($class_r[$classid][tbname])) { continue; } //数量 $num = ReturnBuycarProductNum($pr[2]); if (empty($num)) { $num = 1; } //取得产品信息 $productr = $empire->fetch1("select title,tprice,price,titleurl,groupid,classid,newspath,filename,id,titlepic,buyfen from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " where classid='{$classid}' and id='{$id}' limit 1"); if (empty($productr[id])) { continue; } //是否全部积分 if (!$productr[buyfen]) { $return[0] = 1; } $return[1] += $productr[buyfen] * $num; $thistotal = $productr[price] * $num; $alltotal += $thistotal; //组成存放的格式 $title = str_replace("!", "", $productr[title]); $title = str_replace("|", "", $title); $title = str_replace(",", "", $title); $newbuycar .= "|" . $classid . "," . $id . "|" . $num . "|" . $productr[price] . "|" . $productr[buyfen] . "|" . $title . "!"; } $return[2] = $alltotal; $return[3] = $newbuycar; return $return; }
function ReturnBuycardd($shoppr) { global $empire, $class_r, $dbtbpre; $buycar = getcvar('mybuycar'); $record = "!"; $field = "|"; $r = explode($record, $buycar); $alltotal = 0; $return[0] = 0; //是否全部积分 $return[1] = 0; //购买总积分 $return[2] = 0; //购买总金额 $return[3] = ""; //存放格式 $return['classids'] = ""; //栏目集合 $cdh = ''; $newbuycar = ""; for ($i = 0; $i < count($r) - 1; $i++) { $pr = explode($field, $r[$i]); $productid = $pr[1]; $fr = explode(",", $pr[1]); //ID $classid = (int) $fr[0]; $id = (int) $fr[1]; if (empty($class_r[$classid][tbname])) { continue; } //验证商城表 ShopSys_CheckShopTb($class_r[$classid]['tbname'], $shoppr); //附加属性 if ($shoppr['haveatt']) { $addattstr = ShopSys_BuycarRepvar2(RepPostStr($pr[2])); } else { $addattstr = ''; } //数量 $num = ReturnBuycarProductNum($pr[3]); if (empty($num)) { $num = 1; } //取得产品信息 $productr = $empire->fetch1("select title,tprice,price,isurl,titleurl,classid,id,titlepic,buyfen,pmaxnum from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " where id='{$id}' limit 1"); if (!$productr['id'] || $productr['classid'] != $classid) { continue; } //无货 if ($productr['pmaxnum'] < 1) { printerror("ShopNotProductNum", "history.go(-1)", 1); } //库存 Shopsys_CheckMaxnum($num, $productr['pmaxnum'], $shoppr); //是否全部积分 if (!$productr[buyfen]) { $return[0] = 1; } $return[1] += $productr[buyfen] * $num; $thistotal = $productr[price] * $num; $alltotal += $thistotal; //栏目集合 $return['classids'] .= $cdh . $productr['classid']; $cdh = ','; //组成存放的格式 $title = str_replace("!", "", $productr[title]); $title = str_replace("|", "", $title); $title = str_replace(",", "", $title); $newbuycar .= "|" . $classid . "," . $id . "|" . $addattstr . "|" . $num . "|" . $productr[price] . "|" . $productr[buyfen] . "|" . $title . "!"; } $return[2] = $alltotal; $return[3] = $newbuycar; return $return; }