function index_f() { $sn = $this->trans_lib->safe("sn"); $paycode = "paypal"; $pass = $this->trans_lib->safe("pass"); $rs = $this->payment_m->get_one_code($paycode); if (!$rs) { error($this->lang["alipay_not_rs"], $this->url("checkout,info", "sn=" . $sn . "&pass="******"user_id"]) { if (!$pass || $pass != $order_rs["pass"]) { error($this->lang["alipay_not_popedom"], $this->url("index")); } } else { if ($_SESSION["user_id"] != $order_rs["uid"]) { error($this->lang["alipay_not_popedom"], $this->url("index")); } } $this->tpl->assign("order_rs", $order_rs); if ($order_rs["pay_status"]) { error($this->lang["alipay_paystatus_ok"], $this->url("checkout,info", "sn=" . $sn . "&pass="******"price"] < 0.001) { error($this->lang["alipay_free"], $this->url("checkout,info", "sn=" . $sn . "&pass="******"id"]); //判断是否是客 //加载paypal付款类 $paypal = new paypal_payment($f_rs["business"], $f_rs["at"]); $price = $f_rs["price_format"] ? sys_format_price($f_rs["price_format"] * $order_rs["price"]) : sys_format_price($order_rs["price"]); $paypal->set_value("amount", $price); $currency = $f_rs["currency_code"] ? $f_rs["currency_code"] : "USD"; $paypal->set_value("currency", $currency); $paypal->set_value("ordersn", $order_rs["sn"]); $paypal->set_value("action_url", $f_rs["action_url"]); $return_url = $this->sys_config["siteurl"] . site_url("checkout,info", "sn=" . $sn . "&pass="******"pass"]); $paypal->set_value("return_url", $return_url); //成功返回 $paypal->set_value("cancel_return", $return_url); //取消退出 $notify_url = $this->sys_config["siteurl"] . site_url("paypal,notify", "sn=" . $sn . "&pass="******"pass"]); $paypal->set_value("notify_url", $notify_url); //订单成功后发送给网站的信息 $htmlbutton = $paypal->create_button(); $this->tpl->assign("htmlbutton", $htmlbutton); $this->tpl->display("payment/paypal." . $this->tpl->ext); }
function index_f() { $this->auto_cartid(); //判断是否有启用图片 $rslist = $this->cart_m->get_all($this->sys_config["cart_thumb"]); //取得购物车中的产品 $this->tpl->assign("rslist", $rslist); //计算产品总价 $total_price = 0; if ($rslist) { foreach ($rslist as $key => $value) { $total_price += sys_format_price($value["price"], $value["price_currency"], true) * $value["amount"]; } } $this->tpl->assign("total_price", $total_price); $this->tpl->assign("sitetitle", $this->lang["cart"]); $leader[0] = array("title" => $this->lang["cart"]); $this->tpl->assign("leader", $leader); //判断是否有会员 $user_rs = $_SESSION["user_id"] && $_SESSION["user_rs"] ? $_SESSION["user_rs"] : array(); $this->tpl->assign("user_rs", $user_rs); $this->tpl->display("cart." . $this->tpl->ext); }
function index_f() { //检测验证码是否为空 if (function_exists("imagecreate") && defined("SYS_VCODE_USE") && SYS_VCODE_USE == true) { $chk = $this->trans_lib->safe("sys_check"); if (!$chk) { error($this->lang["login_vcode_empty"], $this->url("cart")); } $chk = md5($chk); if ($chk != $_SESSION[SYS_VCODE_VAR]) { error($this->lang["login_vcode_false"], $this->url("cart")); } unset($_SESSION[SYS_VCODE_VAR]); } $this->db->close_cache(); //禁止缓存 $this->cart_m->sessid($this->session_lib->sessid); $rslist = $this->cart_m->get_all(); $otype = "cart"; if (!$rslist) { $otype = "user"; $array = array(); $array["proid"] = "0"; $array["title"] = $this->trans_lib->safe("product_name"); $array["amount"] = $this->trans_lib->int("product_amount"); $array["price"] = $this->trans_lib->float("product_price"); $array["price_currency"] = $_SESSION["currency_default"]["code"]; $array["thumb_id"] = 0; if (!$array["title"]) { error($this->lang["checkout_not_empty"], $this->url("cart")); } if ($array["amount"] < 1) { error($this->lang["checkout_limit_1"], $this->url("cart")); } $rslist[0] = $array; } if (!$rslist) { error($this->lang["checkout_not_rslist"], $this->url("cart")); } //计算总价 $total_price = 0; foreach ($rslist as $key => $value) { $total_price += sys_format_price($value["price"], $value["price_currency"], true) * $value["amount"]; $n = $value; $n["price"] = sys_format_price($value["price"], $value["price_currency"], true); $n["price_currency"] = $_SESSION["currency_default"]["code"]; $rslist[$key] = $n; } $array_sys = array(); $array_sys["otype"] = $otype; $array_sys["pass"] = md5(rand(5, 99) . time() . date("Ymd")); //32位密码串 $array_sys["price"] = $total_price; $array_sys["price_currency"] = $_SESSION["currency_default"]["code"]; $array_sys["uid"] = $_SESSION["user_id"] ? $_SESSION["user_id"] : "0"; $array_sys["note"] = $this->trans_lib->safe("note"); $array_sys["postdate"] = $this->system_time; $array_sys["email"] = $this->trans_lib->safe("email"); //存储订单信息 $order_id = $this->checkout_m->save_order($array_sys); if (!$order_id) { error($this->lang["checkout_save_error"], site_url("cart")); } //存储产品信息 $this->checkout_m->save_products($order_id, $rslist); //存储收货人信息 $address = array(); $address["order_id"] = $order_id; $address["address_type"] = "shipping"; $address["fullname"] = $this->trans_lib->safe("s_fullname"); $address["tel"] = $this->trans_lib->safe("s_tel"); $address["email"] = $this->trans_lib->safe("s_email"); $address["country"] = $this->trans_lib->safe("s_country"); $address["address"] = $this->trans_lib->safe("s_address"); $address["zipcode"] = $this->trans_lib->safe("s_zipcode"); $address["note"] = $this->trans_lib->safe("s_note"); $this->checkout_m->save_address($address); //存储账单接收者地址信息 if ($this->sys_config["cart_address"]) { $address = array(); $address["order_id"] = $order_id; $address["address_type"] = "billing"; $address["fullname"] = $this->trans_lib->safe("b_fullname"); $address["tel"] = $this->trans_lib->safe("b_tel"); $address["email"] = $this->trans_lib->safe("b_email"); $address["country"] = $this->trans_lib->safe("b_country"); $address["address"] = $this->trans_lib->safe("b_address"); $address["zipcode"] = $this->trans_lib->safe("b_zipcode"); $address["note"] = $this->trans_lib->safe("b_note"); $this->checkout_m->save_address($address); } //删除购物车内容 $this->cart_m->del(); //取得订单信息 $rs = $this->checkout_m->get_one($order_id); //判断是否发送订单通知 if ($_sys["smtp_order"]) { $this->load_lib("email"); $this->email_lib->order($order_id); //通知客户订单信息 $this->email_lib->order_admin($order_id); //通知管理员有订单信息 } $error_title = sys_eval($this->lang["checkout_save_success"], array("sn" => $rs["sn"])); $error_url = site_url("checkout,info", "sn=" . $rs["sn"] . "&pass="******"pass"]); error($error_title, $error_url); }
<tr> <td>图片:</td> <td><img src="<?php echo $rs[thumb]; ?> " /></td> </tr> <?php } if ($m_rs[if_biz]) { ?> <tr> <td>售价:</td> <td><?php if ($rs[price]) { echo sys_format_price($rs[price], $rs[price_currency]); } else { ?> 未设定<?php } ?> </td> </tr> <?php if ($rs[weight] > 0) { ?> <tr> <td>重量:</td> <td><?php echo $rs[weight]; ?>