Exemple #1
0
 function display_cart($jcart)
 {
     // JCART ARRAY HOLDS USER CONFIG SETTINGS
     extract($jcart);
     // ASSIGN USER CONFIG VALUES AS POST VAR LITERAL INDICES
     // INDICES ARE THE HTML NAME ATTRIBUTES FROM THE USERS ADD-TO-CART FORM
     $item_id = $_POST[$item_id];
     $item_qty = $_POST[$item_qty];
     $item_price = $_POST[$item_price];
     $item_name = is_utf8($_POST[$item_name]) ? mb_convert_encoding($_POST[$item_name], 'gb2312', 'utf-8') : $_POST[$item_name];
     $item_shop = $_POST[$item_shop];
     // ADD AN ITEM
     if ($_POST[$item_add]) {
         $item_added = $this->add_item($item_id, $item_qty, $item_price, $item_name, $item_shop);
         // IF NOT TRUE THE ADD ITEM FUNCTION RETURNS THE ERROR TYPE
         if ($item_added !== true) {
             $error_type = $item_added;
             switch ($error_type) {
                 case 'qty':
                     $error_message = $text['quantity_error'];
                     break;
                 case 'price':
                     $error_message = $text['price_error'];
                     break;
             }
         }
     }
     // UPDATE A SINGLE ITEM
     // CHECKING POST VALUE AGAINST $text ARRAY FAILS?? HAVE TO CHECK AGAINST $jcart ARRAY
     if ($_POST['jcart_update_item'] == $jcart['text']['update_button']) {
         $item_updated = $this->update_item($_POST['item_id'], $_POST['item_qty']);
         if ($item_updated !== true) {
             $error_message = $text['quantity_error'];
         }
     }
     // UPDATE ALL ITEMS IN THE CART
     if ($_POST['jcart_update_cart'] || $_POST['jcart_checkout']) {
         $cart_updated = $this->update_cart();
         if ($cart_updated !== true) {
             $error_message = $text['quantity_error'];
         }
     }
     // REMOVE AN ITEM
     if ($_GET['jcart_remove'] && !$_POST[$item_add] && !$_POST['jcart_update_cart'] && !$_POST['jcart_check_out']) {
         $this->del_item($_GET['jcart_remove']);
     }
     // EMPTY THE CART
     if ($_POST['jcart_empty']) {
         $this->empty_cart();
     }
     // DETERMINE WHICH TEXT TO USE FOR THE NUMBER OF ITEMS IN THE CART
     if ($this->itemcount >= 0) {
         $text['items_in_cart'] = $text['multiple_items'];
     }
     if ($this->itemcount == 1) {
         $text['items_in_cart'] = $text['single_item'];
     }
     // DETERMINE IF THIS IS THE CHECKOUT PAGE
     // WE FIRST CHECK THE REQUEST URI AGAINST THE USER CONFIG CHECKOUT (SET WHEN THE VISITOR FIRST CLICKS CHECKOUT)
     // WE ALSO CHECK FOR THE REQUEST VAR SENT FROM HIDDEN INPUT SENT BY AJAX REQUEST (SET WHEN VISITOR HAS JAVASCRIPT ENABLED AND UPDATES AN ITEM QTY)
     $is_checkout = strpos($_SERVER['REQUEST_URI'], $form_action);
     if ($is_checkout !== false || $_REQUEST['jcart_is_checkout'] == 'true') {
         $is_checkout = true;
     } else {
         $is_checkout = false;
     }
     // OVERWRITE THE CONFIG FORM ACTION TO POST TO jcart-gateway.php INSTEAD OF POSTING BACK TO CHECKOUT PAGE
     // THIS ALSO ALLOWS US TO VALIDATE PRICES BEFORE SENDING CART CONTENTS TO PAYPAL
     if ($is_checkout == true) {
         $form_action = $path . 'jcart-gateway.php';
     }
     // DEFAULT INPUT TYPE
     // CAN BE OVERRIDDEN IF USER SETS PATHS FOR BUTTON IMAGES
     $input_type = 'submit';
     // IF THIS ERROR IS TRUE THE VISITOR UPDATED THE CART FROM THE CHECKOUT PAGE USING AN INVALID PRICE FORMAT
     // PASSED AS A SESSION VAR SINCE THE CHECKOUT PAGE USES A HEADER REDIRECT
     // IF PASSED VIA GET THE QUERY STRING STAYS SET EVEN AFTER SUBSEQUENT POST REQUESTS
     if ($_SESSION['quantity_error'] == true) {
         $error_message = $text['quantity_error'];
         unset($_SESSION['quantity_error']);
     }
     // OUTPUT THE CART
     // IF THERE'S AN ERROR MESSAGE WRAP IT IN SOME HTML
     if ($error_message) {
         $error_message = "<p class='jcart-error'>{$error_message}</p>";
     }
     // DISPLAY THE CART HEADER]
     echo "<div id='sidebar'>";
     echo "<!-- BEGIN JCART -->\n<div id='jcart'>\n";
     echo "\t{$error_message}\n";
     echo "\t<form method='post' action='{$form_action}'  onsubmit='return checkForm()' name='mycart'>\n";
     echo "\t\t<fieldset>\n";
     echo "\t\t\t<table border='1'>\n";
     echo "\t\t\t\t<tr>\n";
     echo "\t\t\t\t\t<th id='jcart-header' colspan='3'>\n";
     echo "\t\t\t\t\t\t<div id='jcart-title'></div> (" . $this->itemcount . $text['items_in_cart'] . ")\n";
     echo "\t\t\t\t\t</th>\n";
     echo "\t\t\t\t</tr>" . "\n";
     // IF ANY ITEMS IN THE CART
     if ($this->itemcount > 0) {
         // DISPLAY LINE ITEMS
         foreach ($data = $this->get_contents() as $i => $item) {
             $key[$i] = $item['shop'];
         }
         array_multisort($key, SORT_ASC, $data);
         foreach ($data as $i => $item) {
             $array[] = array($item['shop'] => $item['subtotal']);
             $k[$item['shop']] = 1;
         }
         $a = array_keys($k);
         foreach ($a as $i) {
             ${$i} = 0;
             foreach ($array as $it) {
                 ${$i} += $it[$i];
             }
         }
         foreach ($a as $i) {
             $p = get_minprice($i)->min_price;
             $qsj = ${$i} + $this->shopfee[$i];
             echo "<input type='hidden' name='s" . $i . "' value='" . $qsj . " '/>";
             $string .= "document.mycart.s" . $i . ".value<{$p}||";
         }
         $len = strlen($string) - 2;
         $string = substr($string, 0, $len);
         echo "<script>function checkForm(){if(" . $string . "){alert('您订的东西可能未满某一餐厅的起送价,请再检查一下?:-)');return false;}else{return true;}}</script>";
         foreach ($data as $item) {
             $now = strtotime(date("YmdHis"));
             $time = strtotime(date("H:i:s"));
             if ($item['shop'] != $shop) {
                 $minprice = get_minprice($item['shop'])->min_price;
                 echo "<tr>";
                 echo "<th colspan='1' style='font-weight:bold;text-align:center'>";
                 echo get_shop($item['shop'])->shopname;
                 echo "</th>";
                 if ($minprice != 0) {
                     echo "<th style='font-weight:bold;text-align:center'>起送价:" . number_format($minprice, 2) . "</th>";
                     echo "<th style=\"text-align:right;font-weight:bold; \">";
                     echo "<span>¥" . number_format(${$item}['shop'] + $this->shopfee[$item['shop']], 2) . "</span>";
                     echo "</th>";
                 } else {
                     echo "<th colspan='2' style=\"text-align:right;font-weight:bold; \">";
                     echo "<span>¥" . number_format(${$item}['shop'] + $this->shopfee[$item['shop']], 2) . "</span>";
                     echo "</th>";
                 }
                 echo "</tr>";
                 if ($this->shopfee[$item['shop']] != 0) {
                     echo "<tr><td colspan='3' style=\"text-align:right; \">送餐费:" . number_format($this->shopfee[$item['shop']], 2) . "</td></tr>";
                 }
                 //如果$item['shop']==1则是体验店铺,开通在线订餐功能
                 if (abs($now - get_shop($item['shop'])->linktime < 60) && get_shop($item['shop'])->online == 2 || $item['shop'] == '1' || get_shop($item['shop'])->online == 1 && (strtotime(get_shop($item['shop'])->swstart) < $time && strtotime(get_shop($item['shop'])->swend) > $time || strtotime(get_shop($item['shop'])->xwstart) < $time && strtotime(get_shop($item['shop'])->xwend) > $time)) {
                 } else {
                     echo "<tr class='outline' style='display:none'>";
                     if (!empty($_SESSION['email'])) {
                         echo "<td colspan='3'><font size='2' color='#F30'>订餐热线:" . get_shop($item['shop'])->shoptel . "</font>";
                     } else {
                         echo "<td colspan='3'><font size='2' color='#F30'>注册会员即可查看订餐热线</font>";
                     }
                     echo "</td>";
                     echo "</tr>";
                     //有餐店离线
                     $mark = 1;
                     echo "<input type='hidden' id='mark' value='" . $mark . "' />";
                 }
                 $shop = $item['shop'];
             }
             echo "\t\t\t\t<tr>\n";
             echo "<td class='jcart-item-name'>\n";
             echo "\t\t\t\t\t\t" . $item['name'] . "<input type='hidden' name='jcart_item_name[ ]' value='" . $item['name'] . "' />\n";
             echo "\t\t\t\t\t\t<input type='hidden' name='jcart_item_id[ ]' value='" . $item['id'] . "' />\n";
             echo "\t\t\t\t\t</td>\n";
             echo "<td class='jcart-item-qty'>";
             echo "<img src='./jcart/jian.gif' align='absmiddle' onclick='jiajian(" . $item['id'] . ",2)'/>\n\t\t\t\t<input type='text' size='2' id='jcart-item-id-" . $item['id'] . "' name='jcart_item_qty[ ]' value='" . $item['qty'] . "' />\n\t\t\t\t<img src='./jcart/jia.gif' align='absmiddle' onclick='jiajian(" . $item['id'] . ",1)' />";
             echo "</td>";
             echo "\t\t\t\t\t<td class='jcart-item-price'>\n";
             echo "\t\t\t\t\t\t<span>" . $text['currency_symbol'] . number_format($item['subtotal'], 2) . "</span><input type='hidden' name='jcart_item_price[ ]' value='" . $item['price'] . "' />";
             echo "\t\t\t\t\t\t<a class='jcart-remove' href='?jcart_remove=" . $item['id'] . "'>" . $text['remove_link'] . "</a>\n";
             echo "\t\t\t\t\t</td>\n";
             echo "\t\t\t\t</tr>\n";
         }
     } else {
         echo "\t\t\t\t<tr><td colspan='3' class='empty'>" . $text['empty_message'] . "</td></tr>\n";
     }
     echo "<tr><td colspan='3' style='text-align:center'>";
     echo "<span id='jcart-subtotal'><strong>" . $text['subtotal'] . ":" . $text['currency_symbol'] . number_format($this->total, 2) . "</strong></span>";
     echo "</td></tr>";
     echo "<tr><th id='jcart-footer' colspan='3'>";
     echo "<div style='float:left'><input type='button' value='' onclick='empty()' id='emptyall' /></div>";
     if ($is_checkout !== true && $mark != 1) {
         if ($button['checkout']) {
             $input_type = 'submit';
             $src = ' src="' . $button['checkout'] . '" alt="' . $text['checkout_button'] . '" title="" ';
         }
         echo "\t\t\t\t\t\t<input type='" . $input_type . "' " . $src . "id='jcart-checkout' name='jcart_checkout' class='jcart-button' value='' style='background:url(./jcart/order.jpg) no-repeat; width:108px ;height:30px; border:0px'/>\n";
     } elseif ($mark == 1) {
         echo "\t\t\t\t\t\t<div style='float:right'><input type='button' id='jcart-checkout' value='查看订餐热线' onclick='showtelephone()' style='height:32px'/></div>\n";
     }
     if ($is_checkout == true) {
         // HIDDEN INPUT ALLOWS US TO DETERMINE IF WE'RE ON THE CHECKOUT PAGE
         // WE NORMALLY CHECK AGAINST REQUEST URI BUT AJAX UPDATE SETS VALUE TO jcart-relay.php
         echo "\t\t\t<input type='hidden' id='jcart-is-checkout' name='jcart_is_checkout' value='true' />\n";
     }
     echo "\t\t\t\t\t</th>\n";
     echo "\t\t\t\t</tr>\n";
     echo "\t\t\t</table>\n\n";
     echo "\t\t</fieldset>\n";
     //echo "<input type='hidden' name='total' value='".$this->total."'/>";
     echo "\t</form>\n";
     echo "</div>\n<!-- END JCART -->\n";
     echo "</div>";
 }
Exemple #2
0
 function display_cart($jcart)
 {
     // JCART ARRAY HOLDS USER CONFIG SETTINGS
     extract($jcart);
     // Returns true if $string is valid UTF-8 and false otherwise.
     function is_utf8($word)
     {
         return preg_match("/^([" . chr(228) . "-" . chr(233) . "]{1}[" . chr(128) . "-" . chr(191) . "]{1}[" . chr(128) . "-" . chr(191) . "]{1}){1}/", $word) == true || preg_match("/([" . chr(228) . "-" . chr(233) . "]{1}[" . chr(128) . "-" . chr(191) . "]{1}[" . chr(128) . "-" . chr(191) . "]{1}){1}\$/", $word) == true || preg_match("/([" . chr(228) . "-" . chr(233) . "]{1}[" . chr(128) . "-" . chr(191) . "]{1}[" . chr(128) . "-" . chr(191) . "]{1}){2,}/", $word) == true ? true : false;
     }
     // function is_utf8
     function get_shop($id)
     {
         // query database for the name for a  bulid
         $conn = db_connect();
         $query = "select `shopname`,`linktime`,`shoptel` from wm_shopinfo where shopid = '" . $id . "'";
         $result = @$conn->query($query);
         $row = $result->fetch_object();
         return $row;
     }
     function get_minprice($sid)
     {
         $bulid = isset($_COOKIE['bid']) ? $_COOKIE['bid'] : 8;
         $conn = db_connect();
         $query = "select `min_price` from  `wm_shoplinkbul` where shopid = '" . $sid . "' and areaid='" . $bulid . "'";
         $result = @$conn->query($query);
         $row = $result->fetch_object();
         return $row;
     }
     // ASSIGN USER CONFIG VALUES AS POST VAR LITERAL INDICES
     // INDICES ARE THE HTML NAME ATTRIBUTES FROM THE USERS ADD-TO-CART FORM
     $item_id = $_POST[$item_id];
     $item_qty = $_POST[$item_qty];
     $item_price = $_POST[$item_price];
     $item_name = is_utf8($_POST[$item_name]) ? mb_convert_encoding($_POST[$item_name], 'gb2312', 'utf-8') : $_POST[$item_name];
     $item_shop = $_POST[$item_shop];
     // ADD AN ITEM
     if ($_POST[$item_add]) {
         $item_added = $this->add_item($item_id, $item_qty, $item_price, $item_name, $item_shop);
         // IF NOT TRUE THE ADD ITEM FUNCTION RETURNS THE ERROR TYPE
         if ($item_added !== true) {
             $error_type = $item_added;
             switch ($error_type) {
                 case 'qty':
                     $error_message = $text['quantity_error'];
                     break;
                 case 'price':
                     $error_message = $text['price_error'];
                     break;
             }
         }
     }
     // UPDATE A SINGLE ITEM
     // CHECKING POST VALUE AGAINST $text ARRAY FAILS?? HAVE TO CHECK AGAINST $jcart ARRAY
     if ($_POST['jcart_update_item'] == $jcart['text']['update_button']) {
         $item_updated = $this->update_item($_POST['item_id'], $_POST['item_qty']);
         if ($item_updated !== true) {
             $error_message = $text['quantity_error'];
         }
     }
     // UPDATE ALL ITEMS IN THE CART
     if ($_POST['jcart_update_cart'] || $_POST['jcart_checkout']) {
         $cart_updated = $this->update_cart();
         if ($cart_updated !== true) {
             $error_message = $text['quantity_error'];
         }
     }
     // REMOVE AN ITEM
     if ($_GET['jcart_remove'] && !$_POST[$item_add] && !$_POST['jcart_update_cart'] && !$_POST['jcart_check_out']) {
         $this->del_item($_GET['jcart_remove']);
     }
     // EMPTY THE CART
     if ($_POST['jcart_empty']) {
         $this->empty_cart();
     }
     // DETERMINE WHICH TEXT TO USE FOR THE NUMBER OF ITEMS IN THE CART
     if ($this->itemcount >= 0) {
         $text['items_in_cart'] = $text['multiple_items'];
     }
     if ($this->itemcount == 1) {
         $text['items_in_cart'] = $text['single_item'];
     }
     // DETERMINE IF THIS IS THE CHECKOUT PAGE
     // WE FIRST CHECK THE REQUEST URI AGAINST THE USER CONFIG CHECKOUT (SET WHEN THE VISITOR FIRST CLICKS CHECKOUT)
     // WE ALSO CHECK FOR THE REQUEST VAR SENT FROM HIDDEN INPUT SENT BY AJAX REQUEST (SET WHEN VISITOR HAS JAVASCRIPT ENABLED AND UPDATES AN ITEM QTY)
     $is_checkout = strpos($_SERVER['REQUEST_URI'], $form_action);
     if ($is_checkout !== false || $_REQUEST['jcart_is_checkout'] == 'true') {
         $is_checkout = true;
     } else {
         $is_checkout = false;
     }
     // OVERWRITE THE CONFIG FORM ACTION TO POST TO jcart-gateway.php INSTEAD OF POSTING BACK TO CHECKOUT PAGE
     // THIS ALSO ALLOWS US TO VALIDATE PRICES BEFORE SENDING CART CONTENTS TO PAYPAL
     if ($is_checkout == true) {
         $form_action = $path . 'jcart-gateway.php';
     }
     // DEFAULT INPUT TYPE
     // CAN BE OVERRIDDEN IF USER SETS PATHS FOR BUTTON IMAGES
     $input_type = 'submit';
     // IF THIS ERROR IS TRUE THE VISITOR UPDATED THE CART FROM THE CHECKOUT PAGE USING AN INVALID PRICE FORMAT
     // PASSED AS A SESSION VAR SINCE THE CHECKOUT PAGE USES A HEADER REDIRECT
     // IF PASSED VIA GET THE QUERY STRING STAYS SET EVEN AFTER SUBSEQUENT POST REQUESTS
     if ($_SESSION['quantity_error'] == true) {
         $error_message = $text['quantity_error'];
         unset($_SESSION['quantity_error']);
     }
     // OUTPUT THE CART
     // IF THERE'S AN ERROR MESSAGE WRAP IT IN SOME HTML
     if ($error_message) {
         $error_message = "<p class='jcart-error'>{$error_message}</p>";
     }
     // DISPLAY THE CART HEADER]
     echo "<div id='sidebar'>";
     echo "<!-- BEGIN JCART -->\n<div id='jcart'>\n";
     echo "\t{$error_message}\n";
     echo "\t<form method='post' action='{$form_action}'  onsubmit='return checkForm()' name='mycart'>\n";
     echo "\t\t<fieldset>\n";
     echo "\t\t\t<table border='1'>\n";
     echo "\t\t\t\t<tr>\n";
     echo "\t\t\t\t\t<th id='jcart-header' colspan='3'>\n";
     echo "\t\t\t\t\t\t<span id='jcart-title'>" . $text['cart_title'] . "</span> (" . $this->itemcount . "&nbsp;" . $text['items_in_cart'] . ")\n";
     echo "\t\t\t\t\t</th>\n";
     echo "\t\t\t\t</tr>" . "\n";
     // IF ANY ITEMS IN THE CART
     if ($this->itemcount > 0) {
         // DISPLAY LINE ITEMS
         foreach ($data = $this->get_contents() as $i => $item) {
             $key[$i] = $item['shop'];
         }
         array_multisort($key, SORT_ASC, $data);
         foreach ($data as $i => $item) {
             $array[] = array($item['shop'] => $item['subtotal']);
             $k[$item['shop']] = 1;
         }
         $a = array_keys($k);
         foreach ($a as $i) {
             ${$i} = 0;
             foreach ($array as $it) {
                 ${$i} += $it[$i];
             }
         }
         foreach ($a as $i) {
             $p = get_minprice($item['shop'])->min_price;
             echo "<input type='hidden' name='s" . $i . "' value='" . ${$i} . "'/>";
             $string .= "document.mycart.s" . $i . ".value<{$p}||";
         }
         $len = strlen($string) - 2;
         $string = substr($string, 0, $len);
         echo "<script>function checkForm(){if(" . $string . "){alert('您订的东西可能未满某一餐厅的起送价,请再检查一下?:-)');return false;}else{return true;}}</script>";
         foreach ($data as $item) {
             $now = strtotime(date("YmdHis"));
             if ($item['shop'] != $shop) {
                 echo "<tr>";
                 echo "<th colspan='1'>";
                 echo get_shop($item['shop'])->shopname;
                 echo "</th>";
                 echo "<th>";
                 echo "起送价格:" . number_format(get_minprice($item['shop'])->min_price, 2);
                 echo "</th>";
                 echo "<th colspan='1' style=\"text-align:right;font-weight:bold; \">";
                 echo "<span>¥" . number_format(${$item}['shop'], 2) . "</span>";
                 echo "</th>";
                 echo "</tr>";
                 //如果$item['shop']==1则是体验店铺,开通在线订餐功能
                 if (abs($now - get_shop($item['shop'])->linktime > 60) && $item['shop'] != '1' && (get_shop($item['shop'])->online == 2 && (strtotime(get_shop($item['shop'])->swstart) < $time && strtotime(get_shop($item['shop'])->swend) > $time || strtotime(get_shop($item['shop'])->xwstart) < $time && strtotime(get_shop($item['shop'])->xwend) > $time))) {
                     echo "<tr class='outline' style='display:none'>";
                     if (!empty($_SESSION['email'])) {
                         echo "<td colspan='3'><font size='2' color='#F30'>订购热线:" . get_shop($item['shop'])->shoptel . "</font>";
                     } else {
                         echo "<td colspan='3'><font size='2' color='#F30'>注册会员即可查看订餐热线</font>";
                     }
                     echo "</td>";
                     echo "</tr>";
                     //有餐店离线
                     $mark = 1;
                     echo "<input type='hidden' id='mark' value='" . $mark . "' />";
                 }
                 $shop = $item['shop'];
             }
             echo "\t\t\t\t<tr>\n";
             // ADD THE ITEM ID AS THE INPUT ID ATTRIBUTE
             // THIS ALLOWS US TO ACCESS THE ITEM ID VIA JAVASCRIPT ON QTY CHANGE, AND THEREFORE UPDATE THE CORRECT ITEM
             // NOTE THAT THE ITEM ID IS ALSO PASSED AS A SEPARATE FIELD FOR PROCESSING VIA PHP
             echo "\t\t\t\t\t<td class='jcart-item-qty'>\n";
             echo "\t\t\t\t\t\t<input type='text' size='2' id='jcart-item-id-" . $item['id'] . "' name='jcart_item_qty[ ]' value='" . $item['qty'] . "' />\n";
             echo "\t\t\t\t\t</td>\n";
             echo "\t\t\t\t\t<td class='jcart-item-name'>\n";
             //if(strpos($_SERVER["HTTP_USER_AGENT"],"MSIE 6.0"))
             //{
             echo "\t\t\t\t\t\t" . $item['name'] . "<input type='hidden' name='jcart_item_name[ ]' value='" . $item['name'] . "' />\n";
             /*}else
             		{
             		echo "\t\t\t\t\t\t" . mb_convert_encoding($item['name'],'gb2312','utf-8') . "<input type='hidden' name='jcart_item_name[ ]' value='" . mb_convert_encoding($item['name'],'gb2312','utf-8') . "' />\n";
             		
             		}*/
             echo "\t\t\t\t\t\t<input type='hidden' name='jcart_item_id[ ]' value='" . $item['id'] . "' />\n";
             echo "\t\t\t\t\t</td>\n";
             echo "\t\t\t\t\t<td class='jcart-item-price'>\n";
             echo "\t\t\t\t\t\t<span>" . $text['currency_symbol'] . number_format($item['subtotal'], 2) . "</span><input type='hidden' name='jcart_item_price[ ]' value='" . $item['price'] . "' />";
             echo "\t\t\t\t\t\t<a class='jcart-remove' href='?jcart_remove=" . $item['id'] . "'>" . $text['remove_link'] . "</a>\n";
             echo "\t\t\t\t\t</td>\n";
             echo "\t\t\t\t</tr>\n";
         }
     } else {
         echo "\t\t\t\t<tr><td colspan='3' class='empty'>" . $text['empty_message'] . "</td></tr>\n";
     }
     // DISPLAY THE CART FOOTER
     echo "\t\t\t\t<tr>\n";
     echo "\t\t\t\t\t<th id='jcart-footer' colspan='3'>\n";
     // IF THIS IS THE CHECKOUT HIDE THE CART CHECKOUT BUTTON
     if ($is_checkout !== true && $mark != 1) {
         if ($button['checkout']) {
             $input_type = 'submit';
             $src = ' src="' . $button['checkout'] . '" alt="' . $text['checkout_button'] . '" title="" ';
         }
         echo "\t\t\t\t\t\t<input type='" . $input_type . "' " . $src . "id='jcart-checkout' name='jcart_checkout' class='jcart-button' value='" . $text['checkout_button'] . "' />\n";
     } elseif ($mark == 1) {
         echo "\t\t\t\t\t\t<input type='button' id='jcart-checkout' value='查看订餐热线' onclick='showtelephone()'/>\n";
     }
     echo "\t\t\t\t\t\t<span id='jcart-subtotal'>" . $text['subtotal'] . ": <strong>" . $text['currency_symbol'] . number_format($this->total, 2) . "</strong></span>\n";
     echo "\t\t\t\t\t</th>\n";
     echo "\t\t\t\t</tr>\n";
     echo "\t\t\t</table>\n\n";
     echo "\t\t\t<div class='jcart-hide'>\n";
     if ($button['update']) {
         $input_type = 'image';
         $src = ' src="' . $button['update'] . '" alt="' . $text['update_button'] . '" title="" ';
     }
     echo "\t\t\t\t<input type='" . $input_type . "' " . $src . "name='jcart_update_cart' value='" . $text['update_button'] . "' class='jcart-button' />\n";
     if ($button['empty']) {
         $input_type = 'image';
         $src = ' src="' . $button['empty'] . '" alt="' . $text['empty_button'] . '" title="" ';
     }
     echo "\t\t\t\t<input type='" . $input_type . "' " . $src . "name='jcart_empty' value='" . $text['empty_button'] . "' class='jcart-button' />\n";
     //echo "<font color=red><b>您的浏览器版本太低啦,请按F5键刷新</b></font>";
     echo "\t\t\t</div>\n";
     // IF THIS IS THE CHECKOUT DISPLAY THE PAYPAL CHECKOUT BUTTON
     if ($is_checkout == true) {
         // HIDDEN INPUT ALLOWS US TO DETERMINE IF WE'RE ON THE CHECKOUT PAGE
         // WE NORMALLY CHECK AGAINST REQUEST URI BUT AJAX UPDATE SETS VALUE TO jcart-relay.php
         echo "\t\t\t<input type='hidden' id='jcart-is-checkout' name='jcart_is_checkout' value='true' />\n";
         // SEND THE URL OF THE CHECKOUT PAGE TO jcart-gateway.php
         // WHEN JAVASCRIPT IS DISABLED WE USE A HEADER REDIRECT AFTER THE UPDATE OR EMPTY BUTTONS ARE CLICKED
         $protocol = 'http://';
         if (!empty($_SERVER['HTTPS'])) {
             $protocol = 'https://';
         }
         echo "\t\t\t<input type='hidden' id='jcart-checkout-page' name='jcart_checkout_page' value='" . $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "' />\n";
         // PAYPAL CHECKOUT BUTTON
     }
     echo "\t\t</fieldset>\n";
     //echo "<input type='hidden' name='total' value='".$this->total."'/>";
     echo "\t</form>\n";
     // IF UPDATING AN ITEM, FOCUS ON ITS QTY INPUT AFTER THE CART IS LOADED (DOESN'T SEEM TO WORK IN IE7)
     if ($_POST['jcart_update_item']) {
         echo "\t" . '<script type="text/javascript">$(function(){$("#jcart-item-id-' . $_POST['item_id'] . '").focus()});</script>' . "\n";
     }
     echo "</div>\n<!-- END JCART -->\n";
     echo "</div>";
 }