} else { $display .= PAYPAL_siteHeader($_REQUEST['n'] . ' | ' . $_PAY_CONF['seo_shop_title']); } if (SEC_hasRights('paypal.user', 'paypal.admin')) { $display .= paypal_user_menu(); } else { $display .= paypal_viewer_menu(); } switch ($_REQUEST['mode']) { case 'endTransaction': // START SESSION session_start(); // INITIALIZE JCART AFTER SESSION START $cart =& $_SESSION['jcart']; if (!is_object($cart)) { $cart = new jcart(); } // EMPTY THE CART $cart->empty_cart(); $msg = $LANG_PAYPAL_1['thanks_details']; $msg .= '<p>' . $LANG_PAYPAL_1['transaction'] . ' ' . $_POST['txn_id'] . '</p>'; $msg .= '<p>' . $LANG_PAYPAL_1['name_label'] . ' ' . $_POST['first_name'] . ' ' . $_POST['last_name'] . ' | ' . $LANG_PAYPAL_1['email'] . ' ' . $_POST['payer_email'] . '</p><ul>'; for ($i = 1; $i <= $_POST['num_cart_items']; $i++) { $msg .= '<li>' . $_POST["quantity{$i}"] . 'x ' . $_POST["item_name{$i}"] . '... ' . $_POST["mc_gross_{$i}"] . ' ' . $_POST['mc_currency']; } $msg .= '</ul><p>' . $LANG_PAYPAL_1['total'] . ' ' . $_POST['mc_gross'] . ' ' . $_POST['mc_currency'] . '</p>'; $display .= COM_showMessageText($msg, $LANG_PAYPAL_1['thanks']); $display .= '<div id="cart">' . PAYPAL_displayCart() . '</div>'; $display .= PAYPAL_siteFooter(); break; case 'cancel':
<?php // INCLUDE JCART BEFORE SESSION START include 'jcart/jcart.php'; // START SESSION session_start(); // INITIALIZE JCART AFTER SESSION START $cart =& $_SESSION['jcart']; if (!is_object($cart)) { $cart = new jcart(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>jCart - Free Ajax/PHP shopping cart</title> <style type="text/css"> * { margin:0; padding:0; } html { background:#fff; font-family:trebuchet ms, candara, sans-serif; font-size:62.5%; } body { font-size:1.5em; } #wrapper { margin:30px auto 250px auto; width:890px; border:solid 1px #ccc; padding:30px; background:#efefef; } h2 { margin-bottom:1em; }
<?php include_once './global.php'; include 'jcart/jcart.php'; include "./header.php"; echo "<div id='content'>"; session_start(); $cart =& $_SESSION['jcart']; if (!is_object($cart)) { $cart = new jcart(); } isset($_COOKIE['bid']) ? $bulid = $_COOKIE['bid'] : header("location:./index.php"); //$area = get_area($db,$bulid); //$smarty->assign("buildname",$area['b']); $smarty->assign("shopcart", $cart->display_cart($jcart)); $sctime = get_sctime(); $smarty->assign('sctime', $sctime); if (isset($_SESSION['email'])) { $scadd = get_scadd($db, $_SESSION['email']); $smarty->assign('scadd', $scadd); } $smarty->display("checkout.tpl"); include "./footer.php"; ?>
<?php include_once '../global.php'; include_once '../jcart/jcart.php'; session_start(); $cart =& $_SESSION['jcart']; if (!is_object($cart)) { $cart = new jcart(); } $email = !empty($_SESSION['email']) ? $_SESSION['email'] : 0; if ($cart->get_contents()) { extract($_POST); $orderdate = date("Y-m-d H:i:s"); foreach ($cart->get_contents() as $item) { $total_price[$item['shop']] += $item['price'] * $item['qty']; } foreach ($cart->get_contents() as $item) { $item_id = $item['id']; $detail = get_din_details($db, $item_id); $item_name = $item['name']; $item_price = $item['price']; $item_qty = $item['qty']; $shopid = $item['shop']; $type = get_dintypename($db, $shopid, $detail['dintype']); if ($shopid != $shop) { $orderid = "3" . $shopid . get_orders($db, $shopid); $query = "insert into wm_orders values('{$orderid}{$shopid}','{$email}','{$shopid}','','','','','','','{$orderdate}','','2','{$total_price[$shopid]}','')"; $db->query($query); } $sqlquery = "insert into wm_order_items values('{$orderid}{$shopid}','{$item_id}','" . $shopid . "','" . $item['name'] . "','" . $type . "',{$item_qty} ,'" . $item_price * $item_qty . "','" . $item_price . "' , '" . $orderdate . "','')"; if (!$db->query($sqlquery)) {
// | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to the Free Software Foundation, | // | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | // | | // +---------------------------------------------------------------------------+ /** * require core geeklog code */ require_once '../../lib-common.php'; // START SESSION session_start(); // INITIALIZE JCART AFTER SESSION START $cart =& $_SESSION['jcart']; if (!is_object($cart)) { $cart = new jcart(); } // WHEN JAVASCRIPT IS DISABLED THE UPDATE AND EMPTY BUTTONS ARE DISPLAYED // RE-DISPLAY THE CART IF THE VISITOR CLICKS EITHER BUTTON if ($_POST['jcart_update_cart'] || $_POST['jcart_empty']) { // UPDATE THE CART if ($_POST['jcart_update_cart']) { $cart_updated = $cart->update_cart(); if ($cart_updated !== true) { $_SESSION['quantity_error'] = true; } } // EMPTY THE CART if ($_POST['jcart_empty']) { $cart->empty_cart(); }
<?php // JCART v1.1 // http://conceptlogic.com/jcart/ // THIS FILE TAKES INPUT FROM AJAX REQUESTS VIA JQUERY post AND get METHODS, THEN PASSES DATA TO JCART // RETURNS UPDATED CART HTML BACK TO SUBMITTING PAGE // INCLUDE JCART BEFORE SESSION START include_once 'jcart.php'; // START SESSION session_start(); // INITIALIZE JCART AFTER SESSION START $cart =& $_SESSION['jcart']; if (!is_object($cart)) { $cart = new jcart(); } if ($_POST['empty'] == 1) { $cart->empty_cart(); } // PROCESS INPUT AND RETURN UPDATED CART HTML $cart->display_cart($jcart);
<?php // The shopping cart needs sessions, so start one include_once './global.php'; include_once './jcart/jcart.php'; //require_once ('./email.class.php'); include "./header.php"; session_start(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $cart =& $_SESSION['jcart']; if (!is_object($cart)) { $cart = new jcart(); } $email = !empty($_SESSION['email']) ? $_SESSION['email'] : 0; //$msg = "您的订单已生效,"; $mark = array(); $temp = ""; extract($_POST); if (empty($address) || empty($telphone)) { echo "地址或电话不能为空!<a href='./index.php'>返回首页</a>"; exit; } if ($cart->get_contents()) { $fee = $cart->get_shopfee(); $orderdate = date("Y-m-d H:i:s"); foreach ($cart->get_contents() as $item) { $total_price[$item['shop']] += $item['price'] * $item['qty']; $contents[$item['shop']][] = $item; } try { $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);