/** * Returns the string for the company info (address, phone number, fax number) * * See also corresponding the_company_info() function for displaying the * company info. * * @return string */ function get_company_info() { return ' <div class="company_info" itemscope itemtype="http://schema.org/LocalBusiness"> <span style="display: none;" itemprop="name">' . get_bloginfo('name') . '</span> ' . '<span style="display: none;" itemprop="description">' . get_bloginfo('description') . '</span> ' . get_address() . get_phone_number(true) . get_fax_number(true) . ' </div>'; }
function getHTML($url, &$arr) { $m_url = $url; $m_html = file_get_html($m_url); $property = ""; $no_bed = get_no_bed($m_html); $no_bath = get_no_bath($m_html); $no_car = get_no_car($m_html); $address = get_address($m_html); $agency = get_agency($m_html); $agency_localDir = get_agency_localDir($m_html); $first_agent_name = get_first_agent_name($m_html); $first_agent_contact = get_first_agent_contact($m_html); $listing_type = ""; $price = get_price($m_html); $inspect_time = get_inspect_time($m_html); // $inspect_date = get_inspect_date ($m_html); // $inspect_hour = get_inspect_hour ($m_html); $auction_time = get_auction_time($m_html); $auction_date = get_auction_date($m_html); $auction_day = get_day($auction_date); $auction_hour = get_auction_hour($m_html); $auction_inspect_hour = get_auction_inspect_hour($m_html); $auction_string = get_auction_string($auction_date, $auction_hour, $auction_inspect_hour); $justlisted_string = get_justlisted_string($inspect_time); $arr = array('url' => $m_url, 'no_bed' => $no_bed, 'no_bath' => $no_bath, 'no_car' => $no_car, 'address' => $address, 'agency' => $agency, 'agency_localDir' => $agency_localDir, 'first_agent_name' => $first_agent_name, 'first_agent_contact' => $first_agent_contact, 'listing_type' => $listing_type, 'price' => $price, 'inspect_time' => $inspect_time, 'auction_time' => $auction_time, 'auction_date' => $auction_date, 'auction_day' => $auction_day, 'auction_hour' => $auction_hour, 'auction_inspect_hour' => $auction_inspect_hour, 'auction_string' => $auction_string, 'justlisted_string' => $justlisted_string); //print_r ($arr); }
function tax_amount($subtotal) { $shipping_address = get_address($_SESSION['user']['shipAddressID']); $state = $shipping_address['state']; $state = strtoupper($state); switch ($state) { case 'CA': $tax_rate = 0.09; break; default: $tax_rate = 0; break; } return round($subtotal * $tax_rate, 2); }
<h1>Shop items</h1> <?php foreach ($shopItems as $id => $item) { ?> <h2><?php echo h($item['title']); ?> </h2> <strong>Price: </strong> <?php echo h($item['price'] / 100), ' ', h($item['currency']); ?> <br /> <a href="<?php echo get_address('buy.php?id=') . $id; ?> ">Buy</a> <?php }
<h1>Select payment method</h1> <form action="<?php echo get_address('request.php'); ?> " method="post"> <?php foreach ($methods->getCountries() as $country) { ?> <h2><?php echo h($country->getTitle()); ?> </h2> <?php foreach ($country->getGroups() as $group) { ?> <h3><?php echo h($group->getTitle()); ?> </h3> <?php foreach ($group->getPaymentMethods() as $paymentMethod) { ?> <?php if ($paymentMethod->getLogoUrl()) { ?> <label> <input type="radio" class="radio" name="payment" value="<?php echo h($paymentMethod->getKey()); ?> " /> <img src="<?php
function sendShippingConfirmEmail($order_id) { $customer = get_customer(get_customer_id($order_id)); $customer_name = $customer['firstName'] . ' ' . $customer['lastName']; $customer_email = $customer['emailAddress']; $order = get_order($order_id); $order_date = strtotime($order['orderDate']); $order_date = date('M j, Y', $order_date); $order_items = get_order_items($order_id); $ship_date = date('M j, Y', strtotime($order['shipDate'])); $shipping_address = get_address($order['shipAddressID']); $ship_line1 = $shipping_address['line1']; $ship_line2 = $shipping_address['line2']; $ship_city = $shipping_address['city']; $ship_state = $shipping_address['state']; $ship_zip = $shipping_address['zipCode']; $ship_phone = $shipping_address['phone']; $copyright_date = date("Y"); set_time_limit(0); $messageHTML = <<<HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <!-- the head section --> <head> <title>My Guitar Shop: Shipping Confirmation</title> <style> /* the styles for the HTML elements */ body { margin-top: 0; background-color: rgb(128, 141, 159); font-family: Arial, Helvetica, sans-serif; } h1 { font-size: 150%; margin: 0; padding: .5em 0 .25em; } h2 { font-size: 120%; margin: 0; padding: .5em 0 .25em; } h1, h2 { color: rgb(205, 163, 94); } ul { margin: 0 0 1em 0; padding: 0 0 0 2.5em; } li { margin: 0; padding: .25em; } a { color: rgb(69, 85, 106); font-weight: bold; } a:hover { color: blue; } p { margin: 0; padding: .25em 0; } form { margin: .5em 0; width: 100%; } label { width: 8em; padding-right: .5em; padding-bottom: .5em; text-align: right; float: left; } textarea { width: 25em; margin-bottom: .5em; } table { border-collapse: collapse; } td, th { margin: 0; padding: .15em 0; } br { clear: both; } /* the styles for the div tags that divide the page into sections */ #page { width: 850px; margin: 0 auto; background-color: white; border: 1px solid rgb(119, 75, 77); } #header { margin: 0; border-bottom: 2px solid rgb(119, 75, 77); padding: .5em 2em; } #header h1 { margin: 0; padding: .5em 0; color: black; } #main { margin: 0; padding: .5em 2em; } #sidebar { float: left; width: 170px; } #sidebar h2 { padding: 1em 0 .25em; } #sidebar ul { list-style-type: none; margin-left: 0; padding-left: 0; margin-bottom: 2em; } #sidebar li { margin: 0; padding-bottom: .25em; } #content { float: left; width: 580px; padding-bottom: 1.5em; } #left_column { float: left; width: 150px; padding-left: .5em; } #right_column { float: left; width: 300px; padding-left: 1em; } #footer { clear: both; margin-top: 1em; padding-right: 1em; border-top: 2px solid rgb(119, 75, 77); } #footer p { text-align: right; font-size: 80%; margin: 1em 0; } /******************************************************************** * styles for the classes ********************************************************************/ .right { text-align: right; } .left { text-align: left; } .cart_qty { text-align: right; width: 3em; } .button_form { margin: 0; padding: 0; float: left; } .inline { display: inline; margin-left: .5em; } /******************************************************************** * Styles for the Product Manager application ********************************************************************/ #category_table form { margin: 0; } #category_table td { margin: 0; padding: .15em .5em 0 0; } #add_category_form { margin: 0; } #add_category_form input { margin-right: .5em; } #add_admin_user_form label { width: 8.5em; } #edit_and_delete_buttons { margin-bottom: .5em; } #edit_and_delete_buttons form { display: inline; } #image_manager input { margin: .25em; } /******************************************************************** * Styles for the Product Catalog application ********************************************************************/ #product_image_column { width: 8em; text-align: center; } /*******************************************************************/ #add_to_cart_form { margin: .25em; } #add_to_cart_form input { float: none; } /*******************************************************************/ #cart { margin: 0; padding: 1em .25em; border-collapse: collapse; width: 100%; } #cart_header th { border-bottom: 2px solid black; } #cart_footer td { border-top: 2px solid black; font-style: bold; } #cart td { padding: .25em 0; } /*******************************************************************/ #login_form label { width: 5em; padding-right: 1em; } #login_form input[text] { } #payment_form label { width: 8em; padding-right: 1em; } #payment_form input[text] { width: 5em; margin: 0; padding-right: 1em; } #add_category label { text-align: left; width: 3em; } #add_category input { margin-right: .25em; } </style> </head> <!-- the body section --> <body> <div id="page"> <div id="header"> <h1>My Guitar Shop</h1> </div> <div id="main"> <div id="content"> <h2>Shipping Confirmation</h2> <p>Hello <b>{$customer_name}</b>,<br /><br /> Thank you for shopping with us. We thought you'd like to know that we shipped your item(s), and that this completes your order. Your order is on its way, and can no longer be changed. Please allow 5-7 business days for your order to arrive.</p> <h2>Shipping Details</h2> <p>Order #{$order_id}<br /> Placed on {$order_date}<br /> Shipped on {$ship_date}</p> <p> </p> <p><b>Your order was sent to:</b><br /> {$customer_name}<br /> {$ship_line1}<br /> HTML; if (strlen($ship_line2) > 0) { $messageHTML .= $ship_line2 . '<br />'; } $messageHTML .= <<<HTML {$ship_city}, {$ship_state} {$ship_zip} </p> <p> </p> <table id="cart"> <tr id="cart_header"> <th class="left">Item</th> <th class="right">List Price</th> <th class="right">Savings</th> <th class="right">Your Cost</th> <th class="right">Quantity</th> <th class="right">Line Total</th> </tr> HTML; $message = <<<TEXT My Guitar Shop Shipping Confirmation ------------------ Hello {$customer_name}, Thank you for shopping with us. We thought you'd like to know that we shipped your item(s), and that this completes your order. Your order is on its way, and can no longer be changed. Please allow 5-7 business days for your order to arrive. Shipping Details ---------------- Order #{$order_id} Placed on {$order_date} Shipped on {$ship_date} Your order was sent to: {$customer_name} {$ship_line1} TEXT; if (strlen($ship_line2) > 0) { $message .= $ship_line2 . ' '; } $message = <<<TEXT {$ship_city}, {$ship_state} {$ship_zip} TEXT; $subtotal = 0; $url = 'http://localhost/book_apps/guitar_shop/'; foreach ($order_items as $item) { $product_id = $item['productID']; $product_url = $url . 'catalog/?product_id=' . $product_id; $product = get_product($product_id); $item_name = $product['productName']; $list_price = $item['itemPrice']; $list_price_txt = sprintf('$%.2f', $list_price); $savings = $item['discountAmount']; $savings_txt = sprintf('$%.2f', $savings); $your_cost = $list_price - $savings; $your_cost_txt = sprintf('$%.2f', $your_cost); $quantity = $item['quantity']; $line_total = $your_cost * $quantity; $line_total_txt = sprintf('$%.2f', $line_total); $subtotal += $line_total; $messageHTML .= <<<HTML <tr> <td><a href="{$product_url}" target="_blank"> {$item_name}</a></td> <td class="right"> {$list_price_txt} </td> <td class="right"> {$savings_txt} </td> <td class="right"> {$your_cost_txt} </td> <td class="right"> {$quantity} </td> <td class="right"> {$line_total_txt} </td> </tr> HTML; $message .= <<<TEXT {$item_name} List Price: {$list_price_txt} Savings: {$savings_txt} Your Cost: {$your_cost_txt} Quantity: {$quantity} Line Total: {$line_total_txt} TEXT; } $order_url = $url . 'account/?action=view_order&order_id=' . $order_id; $subtotal_txt = sprintf('$%.2f', $subtotal); $tax_amount_txt = sprintf('$%.2f', $order['taxAmount']); $ship_amount_txt = sprintf('$%.2f', $order['shipAmount']); $total = $subtotal + $order['taxAmount'] + $order['shipAmount']; $total_txt = sprintf('$%.2f', $total); $messageHTML .= <<<HTML <tr id="cart_footer"> <td colspan="5" class="right">Subtotal:</td> <td class="right"> {$subtotal_txt} </td> </tr> <tr> <td colspan="5" class="right">{$ship_state} Tax:</td> <td class="right"> {$tax_amount_txt} </td> </tr> <tr> <td colspan="5" class="right">Shipping:</td> <td class="right"> {$ship_amount_txt} </td> </tr> <tr> <td colspan="5" class="right">Total:</td> <td class="right"> {$total_txt} </td> </tr> </table> <p> </p> <p>Thank you for shopping with us.<br /><b>My Guitar Shop</b></p> </div> </div><!-- end main --> <div id="footer"> <p class="copyright"> © {$copyright_date} My Guitar Shop, Inc. </p> </div><!-- end footer --> </div><!-- end page --> </body> </html> HTML; $message .= <<<TEXT -------------------------------------------- Subtotal: {$subtotal_txt} GA Tax: {$tax_amount_txt} Shipping: {$ship_amount_txt} Total: {$total_txt} Thank you for shopping with us. My Guitar Shop TEXT; $email = new PHPMailer(); $email->IsSMTP(); // $email->IsSendmail(); $email->Host = "smtp.gmail.com"; //Will need to be modified $email->SMTPAuth = true; $email->Port = 465; $email->SMTPDebug = 0; // enables SMTP debug information (for testing) //$email->SMTPSecure = 'tls'; $email->SMTPSecure = 'ssl'; $email->Username = "******"; // SMTP account username Will need to be modified $email->Password = "******"; // SMTP account password Will need to be modified $email->SetFrom('*****@*****.**', 'My Guitar Shop'); $email->SingleTo = true; // true allows that only one person will receive an email per array group $email->Subject = 'Your Order with My Guitar Shop has Shipped!'; // appears in subject of email $email->Body = $messageHTML; // the body will interpret HTML - $messageHTML identified above $email->AltBody = $message; // the AltBody will not interpret HTML - $message identified above $destination_email_address = "{$customer_email}"; // destination email address $destination_user_name = "{$customer_name}"; // Destination user name $email->AddAddress($destination_email_address, $destination_user_name); // AddAddress method identifies destination and sends email if (!$email->Send()) { return false; } else { return true; } }
public function order() { if (!is_login()) { $this->error("您还没有登陆", U("User/login")); } /* 菜单调用*/ $menu = R('index/menulist'); $this->assign('categoryq', $menu); /* 热词调用*/ $hotsearch = R("Index/getHotsearch"); $this->assign('hotsearch', $hotsearch); /* uid调用*/ $uid = D('member')->uid(); $score = get_score($uid); /* 底部分类调用*/ $menulist = R('Service/AllMenu'); $this->assign('footermenu', $menulist); /* 积分兑换*/ $ratio = $score / C('RATIO'); $this->assign('ratio', $ratio); $this->assign('uid', $uid); /* 创建订单*/ if (IS_POST) { $goodlist = M("shoplist"); $order = M("order"); $tag = $this->ordersn(); //标识号 for ($i = 0; $i < count($_POST["id"]); $i++) { $id = htmlspecialchars($_POST["id"][$i]); $num = htmlspecialchars($_POST["num"][$i]); $goodlist->goodid = $id; $goodlist->status = 1; $goodlist->orderid = ''; $goodlist->parameters = htmlspecialchars($_POST["parameters"][$i]); $goodlist->sort = htmlspecialchars($_POST["sort"][$i]); $goodlist->num = $num; $goodlist->uid = $uid; $goodlist->tag = $tag; //标识号必须相同 $goodlist->create_time = NOW_TIME; $goodprice = htmlspecialchars($_POST["price"][$i]); $goodlist->price = $goodprice; $goodtotal = $num * $goodprice; $goodlist->total = $goodtotal; $goodlist->add(); } $defaultaddress = get_address($uid); $this->assign('address', $defaultaddress); $a = M("shoplist")->where(" tag='{$tag}'")->select(); $total = ''; $num = ''; foreach ($a as $k => $val) { $total += $val['total']; $num += $val['num']; } if ($total < C('LOWWEST')) { $trans = C('SHIPMONEY'); } else { $trans = 0; } $all = $total + $trans; $shoplist = M('shoplist')->where("tag='{$tag}'")->select(); $this->assign('shoplist', $shoplist); $this->assign('all', $all); $this->assign('num', $num); $this->assign('tag', $tag); $this->assign('total', $total); $this->assign('trans', $trans); $this->meta_title = '订单结算'; $this->display(); } }
$order['status'] = 'done'; $data['orders'][$orderId] = $order; save_data($data); echo 'OK'; } } elseif ($response['status'] == 3) { $data['orders'][$orderId]['additionalResponse'] = $response; save_data($data); } } catch (Exception $e) { echo 'FAIL ' . $e->getMessage(); } } else { if ('accept' == $answer) { try { $response = WebToPay::validateAndParseData($get, $config['projectid'], $config['sign_password']); if ($response['status'] == 1 || $response['status'] == 2) { // You can start providing services when you get confirmation with accept url // Be sure to check if this order is not yet confirmed - user can refresh page anytime // status 2 means that payment has been got but it's not yet confirmed // @todo: get order by $response['orderid'], validate test (!), amount and currency echo 'Your payment has been got successfuly, it will be confirmed shortly<br />'; } } catch (Exception $e) { echo 'Your payment is not yet confirmed, system error<br />'; } echo template('Thank you for buying<br /><a href="' . get_address('orders.php') . '">Orders</a>'); } else { echo template('<div class="error">Payment rejected.</div>'); } }
function draw_shipping_address($error) { global $_CONF, $_USER, $_TABLES, $LANG_ECOM; $current_id = 0; $T = new Template($_CONF['path'] . 'plugins/ecommerce/templates'); $T->set_file(array('user_shipping_address' => 'user_shipping_address.thtml', 'user_shipping_info_box' => 'user_shipping_info_box.thtml')); $res = get_default_address($_USER['uid']); //No address specified and no default address for the user. Or new address. Load a blank template if (!isset($_GET['id']) && DB_numRows($res) <= 0 || $_GET['action'] == "new") { $T->set_var('submit_value', 'Add Shipping Address'); $T->set_var('submit_name', 'add_shipping_address'); $T->set_var('country', 'US'); //Make US default country $T->set_var('site_url', $PHP_SELF . '?op=shipping_address'); } else { if ($_GET['id'] > 0) { //Shipping address was specified $current_id = COM_applyFilter($_GET['id']); $res = get_address($current_id); # $address = DB_fetchArray($res); //Make sure address belongs to user if ($_USER['uid'] != $address['ecom_ship_uid']) { echo "This is not your users address."; exit; } } else { //Load the default address $address = DB_fetchArray($res); //res is set on fourth line in this function. $current_id = $address['ecom_shipid']; } $T->set_var('submit_value', 'Update Shipping Address'); $T->set_var('submit_name', 'update_shipping_address'); $T->set_var('error', $error); $T->set_var('full_name', $address['ecom_ship_fullname']); $T->set_var('company', $address['ecom_ship_company']); $T->set_var('adress_line1', $address['ecom_ship_street1']); $T->set_var('adress_line2', $address['ecom_ship_street2']); $T->set_var('city', $address['ecom_ship_city']); $T->set_var('state', $address['ecom_ship_state']); $T->set_var('zip', $address['ecom_ship_postalcode']); $T->set_var('country', $address['ecom_ship_country']); $T->set_var('default', $address['ecom_ship_default'] == 1 ? true : false); $T->set_var('site_url', $PHP_SELF . '?op=shipping_address&id=' . $address['ecom_shipid']); $T->set_var('showDelete', true); } $T->set_var('new_address_link', 'index.php?op=shipping_address&action=new'); $T->set_var('msg_1', $LANG_ECOM[1]); $T->set_var('msg_27', $LANG_ECOM[27]); $T->set_var('msg_28', $LANG_ECOM[28]); $T->set_var('msg_29', $LANG_ECOM[29]); $T->set_var('msg_30', $LANG_ECOM[30]); $T->set_var('msg_31', $LANG_ECOM[31]); $T->set_var('msg_151', $LANG_ECOM[151]); $T->set_var('msg_152', $LANG_ECOM[152]); $T->set_var('msg_153', $LANG_ECOM[153]); $T->set_var('msg_154', $LANG_ECOM[154]); $T->set_var('msg_155', $LANG_ECOM[155]); $T->set_var('msg_156', $LANG_ECOM[156]); /* echo "<SCRIPT type=\"text/javascript\">initCountry();</SCRIPT>"; //Needed for State & Country */ //Draw additional address box's $res = DB_query("SELECT ecom_shipid, ecom_ship_street1, ecom_ship_street2, ecom_ship_city, ecom_ship_state, ecom_ship_postalcode FROM {$_TABLES['ecom_user_shipping']} WHERE ecom_ship_uid = " . $_USER['uid'] . " AND ecom_shipid != " . $current_id . ""); while ($address_row = DB_fetchArray($res)) { $T->set_var('box_address1', $address_row['ecom_ship_street1']); $T->set_var('box_address2', $address_row['ecom_ship_street2']); $T->set_var('box_city', $address_row['ecom_ship_city']); $T->set_var('box_state', $address_row['ecom_ship_state']); $T->set_var('box_zip', $address_row['ecom_ship_postalcode']); $T->set_var('url', 'index.php?op=shipping_address&id=' . $address_row['ecom_shipid'] . ''); $T->set_var('url_delete', 'index.php?op=shipping_address&delete_id=' . $address_row["ecom_shipid"]); $T->set_var('showDelete', true); $T->set_var('msg_157', $LANG_ECOM[157]); $T->set_var('msg_158', $LANG_ECOM[158]); $T->set_var('msg_32', $LANG_ECOM[32]); $T->parse('user_shipping_info_box', 'user_shipping_info_box', true); } $T->parse('output', 'user_shipping_address'); echo $T->finish($T->get_var('output')); echo "<SCRIPT type=\"text/javascript\">initCountry();</SCRIPT>"; //Needed for State & Country }
public function order() { /* 菜单调用*/ $menu = R('index/menulist'); $this->assign('categoryq', $menu); /* 热词调用*/ $hotsearch = R("Index/getHotsearch"); $this->assign('hotsearch', $hotsearch); /* uid调用*/ $user = session('user_auth'); $uid = $user['uid']; $score = get_score($uid); /* 积分兑换*/ $ratio = $score / C('RATIO'); $this->assign('ratio', $ratio); $this->assign('uid', $uid); /* 创建订单*/ if (IS_POST) { $order = D("order"); $goodlist = M("shoplist"); $makeid = $this->ordersn(); $order->orderid = $makeid; $order->uid = $uid; $order->add(); $orderid = $order->where("orderid='{$makeid}'")->getField('id'); for ($i = 0; $i < count($_POST["id"]); $i++) { $id = $_POST["id"][$i]; $num = $_POST["num"][$i]; $goodlist->goodid = $id; $goodlist->status = 1; $goodlist->orderid = $orderid; $goodlist->num = $num; $goodlist->time = NOW_TIME; $goodprice = get_good_price($id); $goodtotal = $num * $goodprice; $goodlist->total = $goodtotal; $result = $goodlist->add(); } $shoplist = $goodlist->where("orderid='{$orderid}'")->select(); $this->assign('shoplist', $shoplist); $this->assign('uid', $uid); $this->assign('orderid', $orderid); $msg = get_address($uid); $total = $this->getPricetotal($orderid); if ($total < C('LOWWEST')) { $trans = C('SHIPPRICE'); } else { $trans = 0; } $all = $total + $trans; $allnum = $this->getpriceNum($orderid); $this->assign('all', $all); $this->assign('allnum', $allnum); $this->assign('trans', $trans); $this->assign('total', $total); $this->assign('address', $msg); } $this->display(); }
$hotelname = get_settings_option('hotelname', 'general_option'); $address = get_post_meta($post->ID, 'address_field', true); if ($alttitle != '' || $alttitle != null) { ?> <h1 class="entry-title <?php echo $address != null || $address != '' ? "no-margin" : null; ?> "><?php echo $alttitle; ?> </h1> <?php } else { ?> <h1 class="entry-title <?php echo $address != null || $address != '' ? "no-margin" : null; ?> "><?php the_title($hotelname . ' - '); ?> </h1> <?php } ?> <?php echo $address ? get_address(array('hotelname' => true, 'telephone' => true, 'telephone1' => true, 'telephone2' => true, 'seperator' => true)) : null; } } } } }
/** * 生成订单信息 * */ public function add() { if (!is_login()) { $this->error("您还没有登陆", U("User/login")); } /* uid调用*/ $uid = is_login(); $score = get_score($uid); /* 积分兑换*/ $ratio = $score / C('RATIO'); $this->assign('ratio', $ratio); $this->assign('uid', $uid); /* 创建订单*/ if (IS_POST) { $goodlist = M("shoplist"); $tag = $this->ordersn(); //创建支付订单号 for ($i = 0; $i < count($_POST["id"]); $i++) { $id = $_POST["id"][$i]; $num = $_POST["num"][$i]; if ($num < 1) { $this->error("无效数量"); } $goodlist->goodid = $id; $goodlist->status = 1; $goodlist->orderid = ''; $goodlist->parameters = $_POST["parameters"][$i]; $goodlist->sort = $_POST["sort"][$i]; $goodlist->num = $num; $goodlist->uid = $uid; $goodlist->tag = $tag; //标识号必须相同 $goodlist->create_time = NOW_TIME; $goodprice = $_POST["price"][$i]; $goodlist->price = $goodprice; $goodtotal = $num * $goodprice; $goodlist->total = $goodtotal; $goodlist->add(); } $defaultaddress = get_address($uid); $this->assign('address', $defaultaddress); $a = M("shoplist")->where(" tag='{$tag}'")->select(); $total = ''; $num = ''; foreach ($a as $k => $val) { $total += $val['total']; $num += $val['num']; } if ($total < C('LOWWEST')) { $trans = C('SHIPMONEY'); } else { $trans = 0; } $all = $total + $trans; $shoplist = M('shoplist')->where("tag='{$tag}'")->select(); $this->assign('shoplist', $shoplist); $map["pid"] = 0; $list = M("area")->where($map)->select(); $this->assign('list', $list); $this->assign('all', $all); $this->assign('num', $num); $this->assign('tag', $tag); $this->assign('total', $total); $this->assign('trans', $trans); $this->meta_title = '订单结算'; $this->display('Shopcart/add'); } }
<div style="color:red"> <p style="text-align:right;color:red;width:100%">小计:<?php echo $info["total"]; ?> 元 </p> <p style="text-align:right;color:red;width:100%">申请时间:<?php echo date($info["time"], 'Y-m-d H:i:s'); ?> </p> <p style="text-align:right;color:red;width:100%">收货人:<?php echo get_realname($info["total"]); ?> </p> <p style="text-align:right;color:red;width:100%">收货地址:<?php echo get_address($info["total"]); ?> </p> <p style="text-align:right;color:red;width:100%">联系电话:<?php echo get_cellphone($info["time"]); ?> </p> </div> <div class="form-item" style="border-top:1px solid #000"> <?php echo get_good_content($info["goodid"]); ?> </div> </div> </div>
<?php $config = array('sign_password' => '73cdb059d0f29f275a34b370f8e4f900', 'projectid' => 6028, 'test' => 1, 'accepturl' => get_address('response.php?answer=accept'), 'cancelurl' => get_address('response.php?answer=cancel'), 'callbackurl' => get_address('response.php?answer=callback')); $shopItems = array(array('title' => 'Item A', 'price' => 100, 'currency' => 'LTL'), array('title' => 'Item B', 'price' => 2000, 'currency' => 'EUR'), array('title' => 'Item C', 'price' => 4990, 'currency' => 'LTL'));
<h1>Buy item</h1> <h2><?php echo h($item['title']); ?> </h2> <strong>Price: </strong> <?php echo h($item['price'] / 100), ' ', h($item['currency']); ?> <br /> <form action="<?php echo get_address('paymentMethod.php'); ?> " method="post"> <label>Email:* <input name="p_email" /></label> <label>Name: <input name="p_firstname" /></label> <label>Surname: <input name="p_lastname" /></label> <label>Address: <input name="p_street" /></label> <label>City: <input name="p_city" /></label> <label>State: <input name="p_state" /></label> <label>ZIP code: <input name="p_zip" /></label> <input type="hidden" name="id" value="<?php echo h($id); ?> " /> <input type="submit" value="Submit" /> </form>
$name = NULL; } /* if (preg_match('/@/',$how_to_apply)) { if ($email == '') $email = $how_to_apply; $how_to_apply = NULL; } */ if (isset($homepage)) { $homepage = addhttp($homepage); } ## CLEANING ADDRESS ## if ($address != '') { $address_array = get_address($address); } if ($address_array['country_id'] == '') { $address_array['country_id'] = $country_id; } ## INSERTING EMPLOYER AND AVOIDING SOME DUPLICATES ## // Conditions for avoiding duplicates must be tested for more jobs to avoid wrong relations. Maybe we should take them off for now ? if ($name != '' || $address != '' && $address != ', ,') { $query = "SELECT id FROM employer WHERE name = '{$name}' AND address = '{$address}' AND country_id = '{$address_array['country_id']}'"; $employer_id = select_id($query); if ($employer_id == '') { if ($name != '' && $address_array['formatted_address'] != '') { $query = "SELECT id FROM employer WHERE name = '{$name}' AND formatted_address = '{$address_array['formatted_address']}' AND country_id = '{$address_array['country_id']}'"; } $employer_id = select_id($query); }
<div class="dl_goods_info"> <h2 class="dginfo_h2" ><?php echo $info["title"]; ?> </h2> <p >价格:<span class="dginfo_price">¥<em class="price"><?php echo $info["price"]; ?> </em></span></p> <p >净重:<em class="price"><?php echo $info["weight"]; ?> </em>g</p> <ul class="dginfo_info"> <li>配送地:<?php echo get_address($info["uid"]); ?> </li> <li style="clear:both; width:100%"> <form action="<?php echo U("Shopcart/order"); ?> " name="orderform" id="orform" method="post" onsubmit="return trySubmit()"> <input type="hidden" name="id[]" value="<?php echo $info["id"]; ?> "/> <p class="num_box">数量:<a href="javascript:void(0)" onclick="add()" >+</a> <input type="text" class="num" value="1" name="num[]" /><a onclick="reduce()" id="oneA" href="javascript:void(0)" >-</a></p> </form></li>
$result = $GLOBALS['db']->getRow($sql); extract($result); //获取客户来源 $sql = 'SELECT `from` FROM ' . $GLOBALS['ecs']->table('from_where') . ' WHERE from_id=' . $from_where; $from_where = $GLOBALS['db']->getOne($sql); //获取经济来源 $sql = 'SELECT income FROM ' . $GLOBALS['ecs']->table('income') . ' WHERE income_id=' . $income; $income = $GLOBALS['db']->getOne($sql); $sql = 'SELECT zipcode, address, province, city, district FROM ' . $GLOBALS['ecs']->table('user_address') . ' WHERE user_id=' . $user_id; $address = $GLOBALS['db']->getRow($sql); if ($address['province'] && $address['city']) { extract($address); $province = get_address($province); $city = get_address($city); if (!empty($district)) { $district = get_address($district); } else { $district = ''; } $address = $province . $city . $district . $address; } else { $address = "请到点击<a href='users.php?act=edit&id={$user_id}' title='编辑'><img src='images/icon_edit.gif' alt='编辑' /></a>完善顾客地址信息!"; } switch ($sex) { case 1: $sex = '男'; break; case 2: $sex = '女'; break; case 0:
$subtotal = cart_subtotal(); $item_count = cart_item_count(); $item_shipping = 5000; $shipping_cost = shipping_cost(); $shipping_address = get_address($_SESSION['user']['iddiachigiaohang']); $state = $shipping_address['quanhuyen']; $tax = tax_amount($subtotal); // function from order_db.php file $total = $subtotal + $tax + $shipping_cost; include 'checkout_confirm.php'; break; case 'payment': if (cart_product_count() == 0) { redirect($app_path . 'cart'); } $billing_address = get_address($_SESSION['user']['iddiachithanhtoan']); $bill_line1 = $billing_address['diachi1']; $bill_line2 = $billing_address['diachi2']; $bill_city = $billing_address['thanhpho']; $bill_state = $billing_address['quanhuyen']; $bill_zip = $billing_address['mavung']; $bill_phone = $billing_address['sodienthoai']; include 'checkout_payment.php'; break; case 'process': if (cart_product_count() == 0) { redirect('Location: ' . $app_path . 'cart'); } $cart = cart_get_items(); $card_type = intval($_POST['card_type']); $card_number = $_POST['card_number'];
function showVenueDetails($conn, $vid) { $root = "/venues"; $latitude = ""; $longitude = ""; $name = ""; $description = ""; $tag = ""; $picture = ""; $result = pg_execute($conn, "get_venues_details", array($vid)) or die("Can't execute get_venues_details: " . pg_last_error()); if (pg_num_rows($result) == 1) { $row = pg_fetch_row($result); $latitude = $row[0]; $longitude = $row[1]; $name = $row[2]; $description = $row[3]; if ($description == "" || $description == null) { $description = 'No description available'; } $tag = $row[4]; $picture = $root . "/" . $row[5]; $is_secret = false; pg_freeresult($result); } else { pg_freeresult($result); $latitude = -62.2184041; $longitude = -58.9601368; $name = "Secret Venue"; $description = "No description available"; $tag = ""; $picture = $root . "/img/venue/logo/secret.png"; $is_secret = true; echo "<script type='text/javascript'>\n\t\t\tjError('Cannot find venue...<br />',\n\t\t\t\t{\n\t\t\t\t\tonClosed:function()\n\t\t\t\t\t{\n\t\t\t\t\t\twindow.location.href='" . $root . "/index.php';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\t</script>"; } $food_rating = 0; $service_rating = 0; $value_rating = 0; $atmosphere_rating = 0; $total_rating = 0; $food_count = 0; $service_count = 0; $value_count = 0; $atmosphere_count = 0; $total_count = 0; $result = pg_execute($conn, "get_venue_ratings", array($vid)) or die("Can't execute get_venue_ratings: " . pg_last_error()); if (pg_num_rows($result) == 0) { $rating = 'No Ratings Yet!'; } else { if (pg_num_rows($result) == 4) { while ($row = pg_fetch_row($result)) { if ($row[1] == 1) { $food_rating = round($row[3], 2); $food_count = $row[2]; } else { if ($row[1] == 2) { $service_rating = round($row[3], 2); $service_count = $row[2]; } else { if ($row[1] == 3) { $value_rating = round($row[3], 2); $value_count = $row[2]; } else { if ($row[1] == 4) { $atmosphere_rating = round($row[3], 2); $atmosphere_count = $row[2]; } } } } } $total_rating = round(($food_rating + $service_rating + $value_rating + $atmosphere_rating) / 4.0, 2); if ($food_count == $service_count && $food_count == $value_count && $food_count == $atmosphere_count) { $total_count = $food_count; } pg_freeresult($result); $rating = ' <p> <b><i class="fa fa-star fa-lg"></i> Rating: </b>' . $total_rating . '   <b>Votes: </b> <span class="fa-stack fa-1x"> <i class="fa fa-circle fa-stack-2x"></i> <strong class="fa-stack-1x fa-stack-text fa-inverse">' . $total_count . '</strong> </span> </p> <p style="margin: 6px 0px 10px 40px; line-height: 9px; padding: 0px 0px 10px;"> <span style="display:box; width:115px; clear:both; float:left;"><b>Food: </b>' . $food_rating . '</span> <span style="display:box; width:115px; float:left;"><b>Service: </b>' . $service_rating . '</span> </p> <p style="margin: 6px 0px 10px 40px; line-height: 9px; padding: 0px 0px 10px;"> <span style="display:box; width:115px; clear:both; float:left;"><b>Value: </b>' . $value_rating . '</span> <span style="display:box; width:115px; float:left;"><b>Atmosphere: </b>' . $atmosphere_rating . '</span> </p>'; } } $location = get_address($latitude, $longitude); echo ' <!--div class="container"> <!--Container--> <div class="tile rounded-border" style="max-width: 1430px;"> <h2 class="tile-title rounded-border-top" style="line-height:1.0em; padding-top:7px;"><b><i class="fa fa-info-circle fa-2x"></i><span style="font-size:13px; vertical-align:3px;"> ' . $name . '</span></b></h2> <div class="fb span9 offset1" style="background: url(' . $root . '/img/venue/logo/Coffee-Beans.png) no-repeat;"> <!--Cover--> <div class="profilePhoto"> <img src="' . $picture . '" alt="' . $name . ' Photo" /> </div> </div> <!--Cover--> <div class="panel span9 offset1"> <!--Panel --> <div class="row"> <!--Row --> <div class="span9"> <!--Panel Inside --> <div class="row push"> <!--Row --> <!--First Line Panel --> <div class="span3 offset2 "> <p class="name">' . $name . '</p> </div> <!--First Line Panel--> <!--Details --> <div class="span4 details "> <p><i class="fa fa-map-marker fa-lg"></i> ' . $location['formatted_address'] . ' </p> ' . $rating . ' </div> <!--Details --> </div><!--Row --> </div> <!--Panel Inside --> </div> <!--Row --> </div> <!--Panel --> </div> <!--/div> <!--Container--> '; }
public function search() { $query = $this->input->post('q'); if (empty($query) || strlen($query) < 2) { $json = '{"success": false, "msg": "กรุณาระบุคำค้นหา"}'; } else { $rs = $this->patient->search($this->hospcode, $query); if ($rs) { $arr_result = array(); foreach ($rs as $r) { $obj = new stdClass(); $obj->e0 = $r->e0_hosp; $obj->e1 = $r->e1_hosp; $obj->id = $r->id; $obj->name = $r->name; $obj->hn = $r->hn; $obj->cid = $r->cid; $obj->datesick = to_thai_date($r->datesick); $obj->address = $r->address . ' ' . get_address($r->addrcode); $obj->diag = $r->icd10 . ' ' . $this->basic->get_diagname($r->icd10); $obj->code506 = $r->disease . ' ' . $this->basic->get_code506name($r->disease); $obj->nation = get_nation_nhso_name($r->nation); $obj->ptstatus = $r->result; $arr_result[] = $obj; } $rows = json_encode($arr_result); $json = '{"success": true, "rows": ' . $rows . '}'; } else { $json = '{"success": false, "msg": "ไม่มีข้อมูล."}'; } } render_json($json); }
function draw_address($T, $display) { global $_TABLES, $_USER, $_CONF, $LANG_ECOM; if (!SEC_inGroup('Logged-in Users')) { //User is not logged in //Will need to use sessions. $T->set_var('submit_value', 'Register Account'); $T->set_var('submit_name', 'register_account'); $T->set_var('site_url', $PHP_SELF); $T->set_var('isCheckout', true); if (isset($_SESSION['country'])) { $T->set_var('country', $_SESSION['country']); } else { $T->set_var('country', 'US'); } //default country $T->set_var('full_name', $_SESSION['full_name']); $T->set_var('company', $_SESSION['company']); $T->set_var('adress_line1', $_SESSION['address_line1']); $T->set_var('adress_line2', $_SESSION['address_line2']); $T->set_var('city', $_SESSION['city']); $T->set_var('state', $_SESSION['state']); $T->set_var('zip', $_SESSION['zip']); } else { //User is registered $res = get_default_address($_USER['uid']); if ($_GET['action'] == "new") { //Allow user to enter new shipping address $T->set_var('submit_value', 'Add Shipping Address'); $T->set_var('submit_name', 'add_shipping_address'); $T->set_var('new_address_link', 'check_out_shipping.php?action=new'); $T->set_var('site_url', $PHP_SELF); $T->set_var('country', 'US'); //Make US default country } else { if (!isset($_GET['id']) && DB_numRows($res) <= 0) { #TODO: Allow to save information. $T->set_var('submit_value', 'Add Shipping Address'); $T->set_var('submit_name', 'add_shipping_address'); $T->set_var('check_out_button', "<input type=\"submit\" value=\"Get Shipping Cost ->\" name=\"shipping_price\" />"); $T->set_var('site_url', 'check_out_shipping.php'); $T->set_var('isCheckout', true); $T->set_var('new_address_link', 'check_out_shipping.php?action=new'); $T->set_var('country', 'US'); //default country } else { //If shipping address is specified use that one, if not then use default if ($_GET['id'] > 0) { $res = get_address($_GET['id']); $address = DB_fetchArray($res); //Make sure address belongs to user if ($_USER['uid'] != $address['ecom_ship_uid']) { echo "This is not your address."; exit; } } else { $address = DB_fetchArray($res); //user default shipping address } $T->set_var('submit_value', '<-- Back to cart contents'); $T->set_var('submit_name', 'back'); $T->set_var('error', $error); $T->set_var('full_name', $address['ecom_ship_fullname']); $T->set_var('company', $address['ecom_ship_company']); $T->set_var('adress_line1', $address['ecom_ship_street1']); $T->set_var('adress_line2', $address['ecom_ship_street2']); $T->set_var('city', $address['ecom_ship_city']); $T->set_var('state', $address['ecom_ship_state']); $T->set_var('zip', $address['ecom_ship_postalcode']); $T->set_var('country', $address['ecom_ship_country']); $T->set_var('default', $address['ecom_ship_default'] == 1 ? true : false); $T->set_var('new_address_link', 'check_out_shipping.php?action=new'); $T->set_var('site_url', $PHP_SELF); $T->set_var('isCheckout', true); } } } $T->set_var('msg_1', $LANG_ECOM[1]); $T->set_var('msg_27', $LANG_ECOM[27]); $T->set_var('msg_28', $LANG_ECOM[28]); $T->set_var('msg_29', $LANG_ECOM[29]); $T->set_var('msg_30', $LANG_ECOM[30]); $T->set_var('msg_31', $LANG_ECOM[31]); $T->set_var('msg_151', $LANG_ECOM[151]); $T->set_var('msg_152', $LANG_ECOM[152]); $T->set_var('msg_153', $LANG_ECOM[153]); $T->set_var('msg_154', $LANG_ECOM[154]); $T->set_var('msg_155', $LANG_ECOM[155]); $T->set_var('msg_156', $LANG_ECOM[156]); }
$order_items = get_order_items($order_id); // Get customer data $customer = get_customer($order['customerID']); $name = $customer['lastName'] . ', ' . $customer['firstName']; $email = $customer['emailAddress']; $card_number = $order['cardNumber']; $card_expires = $order['cardExpires']; $card_name = card_name($order['cardType']); $shipping_address = get_address($order['shipAddressID']); $ship_line1 = $shipping_address['line1']; $ship_line2 = $shipping_address['line2']; $ship_city = $shipping_address['city']; $ship_state = $shipping_address['state']; $ship_zip = $shipping_address['zipCode']; $ship_phone = $shipping_address['phone']; $billing_address = get_address($order['billingAddressID']); $bill_line1 = $billing_address['line1']; $bill_line2 = $billing_address['line2']; $bill_city = $billing_address['city']; $bill_state = $billing_address['state']; $bill_zip = $billing_address['zipCode']; $bill_phone = $billing_address['phone']; include 'order.php'; break; case 'set_ship_date': $order_id = intval($_POST['order_id']); set_ship_date($order_id); $url = '?action=view_order&order_id=' . $order_id; sendShippingConfirmEmail($order_id); redirect($url); case 'confirm_delete':
public function respond_request() { $token = Input::get('token'); $walker_id = Input::get('id'); $request_id = Input::get('request_id'); $accepted = Input::get('accepted'); $date_time = Input::get('datetime'); $validator = Validator::make(array('token' => $token, 'walker_id' => $walker_id, 'request_id' => $request_id, 'accepted' => $accepted), array('token' => 'required', 'walker_id' => 'required|integer', 'accepted' => 'required|integer', 'request_id' => 'required|integer')); /* $driver = Keywords::where('id', 1)->first(); */ if ($validator->fails()) { $error_messages = $validator->messages()->all(); $response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages); $response_code = 200; } else { $is_admin = $this->isAdmin($token); if ($walker_data = $this->getWalkerData($walker_id, $token, $is_admin)) { // check for token validity if (is_token_active($walker_data->token_expiry) || $is_admin) { // Retrive and validate the Request if ($request = Requests::find($request_id)) { if ($request->current_walker == $walker_id) { if ($accepted == 1) { if ($request->later == 1) { // request ended Requests::where('id', '=', $request_id)->update(array('confirmed_walker' => $walker_id, 'status' => 1)); } else { Requests::where('id', '=', $request_id)->update(array('confirmed_walker' => $walker_id, 'status' => 1, 'request_start_time' => date('Y-m-d H:i:s'))); } // confirm walker RequestMeta::where('request_id', '=', $request_id)->where('walker_id', '=', $walker_id)->update(array('status' => 1)); // Update Walker availability Walker::where('id', '=', $walker_id)->update(array('is_available' => 0)); // remove other schedule_meta RequestMeta::where('request_id', '=', $request_id)->where('status', '=', 0)->delete(); // Send Notification $walker = Walker::find($walker_id); $walker_data = array(); $walker_data['first_name'] = $walker->first_name; $walker_data['last_name'] = $walker->last_name; $walker_data['phone'] = $walker->phone; $walker_data['bio'] = $walker->bio; $walker_data['picture'] = $walker->picture; $walker_data['latitude'] = $walker->latitude; $walker_data['longitude'] = $walker->longitude; $walker_data['type'] = $walker->type; $walker_data['rating'] = $walker->rate; $walker_data['num_rating'] = $walker->rate_count; $walker_data['car_model'] = $walker->car_model; $walker_data['car_number'] = $walker->car_number; /* $walker_data['rating'] = DB::table('review_walker')->where('walker_id', '=', $walker->id)->avg('rating') ? : 0; $walker_data['num_rating'] = DB::table('review_walker')->where('walker_id', '=', $walker->id)->count(); */ $settings = Settings::where('key', 'default_distance_unit')->first(); $unit = $settings->value; if ($unit == 0) { $unit_set = 'kms'; } elseif ($unit == 1) { $unit_set = 'miles'; } $bill = array(); if ($request->is_completed == 1) { $bill['distance'] = (string) convert($request->distance, $unit); $bill['unit'] = $unit_set; $bill['time'] = $request->time; $bill['base_price'] = $request->base_price; $bill['distance_cost'] = $request->distance_cost; $bill['time_cost'] = $request->time_cost; $bill['total'] = $request->total; $bill['is_paid'] = $request->is_paid; } /* $setting = Settings::where('key', 'allow_calendar')->first(); if ($request->later == 1 && $setting->value == 1) { */ if ($request->later == 1) { $date_time = $request->request_start_time; $datewant = new DateTime($date_time); $datetime = $datewant->format('Y-m-d H:i:s'); $end_time = $datewant->add(new DateInterval('P0Y0M0DT2H0M0S'))->format('Y-m-d H:i:s'); $provavail = ProviderAvail::where('provider_id', $walker_id)->where('start', '<=', $datetime)->where('end', '>=', $end_time)->first(); $starttime = $provavail->start; $endtime = $provavail->end; $provavail->delete(); if ($starttime == $datetime) { $provavail1 = new ProviderAvail(); $provavail1->provider_id = $walker_id; $provavail1->start = $end_time; $provavail1->end = $endtime; $provavail1->save(); } elseif ($endtime == $end_time) { $provavail1 = new ProviderAvail(); $provavail1->provider_id = $walker_id; $provavail1->start = $starttime; $provavail1->end = $datetime; $provavail1->save(); } else { $provavail1 = new ProviderAvail(); $provavail1->provider_id = $walker_id; $provavail1->start = $starttime; $provavail1->end = $datetime; $provavail1->save(); $provavail2 = new ProviderAvail(); $provavail2->provider_id = $walker_id; $provavail2->start = $end_time; $provavail2->end = $endtime; $provavail2->save(); } } $response_array = array('success' => true, 'request_id' => $request_id, 'status' => $request->status, 'confirmed_walker' => $request->confirmed_walker, 'is_walker_started' => $request->is_walker_started, 'is_walker_arrived' => $request->is_walker_arrived, 'is_walk_started' => $request->is_started, 'is_completed' => $request->is_completed, 'is_walker_rated' => $request->is_walker_rated, 'walker' => $walker_data, 'bill' => $bill); /* $driver = Keywords::where('id', 1)->first(); */ /* $trip = Keywords::where('id', 4)->first(); */ /* $title = '' . $driver->keyword . ' has accepted the ' . $trip->keyword; */ $title = '' . Config::get('app.generic_keywords.Provider') . ' has accepted the ' . Config::get('app.generic_keywords.Trip'); $message = $response_array; send_notifications($request->owner_id, "owner", $title, $message); // Send SMS $owner = Owner::find($request->owner_id); $settings = Settings::where('key', 'sms_when_provider_accepts')->first(); $pattern = $settings->value; $pattern = str_replace('%user%', $owner->first_name . " " . $owner->last_name, $pattern); $pattern = str_replace('%driver%', $walker->first_name . " " . $walker->last_name, $pattern); $pattern = str_replace('%driver_mobile%', $walker->phone, $pattern); sms_notification($request->owner_id, 'owner', $pattern); // Send SMS $owner = Owner::find($request->owner_id); $src_address = get_address($owner->latitude, $owner->longitude); $pattern = Config::get('app.generic_keywords.User') . " Pickup Address : " . $src_address; sms_notification($walker_id, 'walker', $pattern); // Send SMS $settings = Settings::where('key', 'sms_request_completed')->first(); $pattern = $settings->value; $pattern = str_replace('%user%', $owner->first_name . " " . $owner->last_name, $pattern); $pattern = str_replace('%id%', $request->id, $pattern); $pattern = str_replace('%user_mobile%', $owner->phone, $pattern); sms_notification(1, 'admin', $pattern); //email to client for accept the request $settings = Settings::where('key', 'admin_email_address')->first(); $admin_email = $settings->value; $pattern = array('admin_eamil' => $admin_email, 'client_name' => ucwords($owner->first_name . " " . $owner->last_name), 'web_url' => web_url(), 'driver_name' => ucwords($walker->first_name . " " . $walker->last_name), 'driver_contact' => $walker->phone, 'driver_car_model' => $walker->car_model, 'driver_licence' => $walker->car_number); $subject = "Get Ready For Ride"; email_notification($owner->id, 'owner', $pattern, $subject, 'accept_request', null); } else { $time = date("Y-m-d H:i:s"); $query = "SELECT id,owner_id,current_walker,TIMESTAMPDIFF(SECOND,request_start_time, '{$time}') as diff from request where id = '{$request_id}'"; $results = DB::select(DB::raw($query)); $settings = Settings::where('key', 'provider_timeout')->first(); $timeout = $settings->value; // Archiving Old Walker RequestMeta::where('request_id', '=', $request_id)->where('walker_id', '=', $walker_id)->update(array('status' => 3)); $request_meta = RequestMeta::where('request_id', '=', $request_id)->where('status', '=', 0)->orderBy('created_at')->first(); // update request if (isset($request_meta->walker_id)) { Requests::where('id', '=', $request_id)->update(array('current_walker' => $request_meta->walker_id, 'request_start_time' => date("Y-m-d H:i:s"))); // Send Notification $walker = Walker::find($request_meta->walker_id); $settings = Settings::where('key', 'provider_timeout')->first(); $time_left = $settings->value; $owner = Owner::find($request->owner_id); $msg_array = array(); $msg_array['unique_id'] = 1; $msg_array['request_id'] = $request->id; $msg_array['id'] = $request_meta->walker_id; if ($walker) { $msg_array['token'] = $walker->token; } $msg_array['time_left_to_respond'] = $time_left; $msg_array['payment_mode'] = $request->payment_mode; $msg_array['payment_type'] = $request->payment_mode; $msg_array['time_left_to_respond'] = $timeout; $msg_array['client_profile'] = array(); $msg_array['client_profile']['name'] = $owner->first_name . " " . $owner->last_name; $msg_array['client_profile']['picture'] = $owner->picture; $msg_array['client_profile']['bio'] = $owner->bio; $msg_array['client_profile']['address'] = $owner->address; $msg_array['client_profile']['phone'] = $owner->phone; $request_data = array(); $request_data['owner'] = array(); $request_data['owner']['name'] = $owner->first_name . " " . $owner->last_name; $request_data['owner']['picture'] = $owner->picture; $request_data['owner']['phone'] = $owner->phone; $request_data['owner']['address'] = $owner->address; $request_data['owner']['latitude'] = $owner->latitude; $request_data['owner']['longitude'] = $owner->longitude; if ($request->d_latitude != NULL) { $request_data['owner']['d_latitude'] = $request->D_latitude; $request_data['owner']['d_longitude'] = $request->D_longitude; } $request_data['owner']['owner_dist_lat'] = $request->D_latitude; $request_data['owner']['owner_dist_long'] = $request->D_longitude; $request_data['owner']['dest_latitude'] = $request->D_latitude; $request_data['owner']['dest_longitude'] = $request->D_longitude; $request_data['owner']['payment_type'] = $request->payment_mode; $request_data['owner']['rating'] = $owner->rate; $request_data['owner']['num_rating'] = $owner->rate_count; /* $request_data['owner']['rating'] = DB::table('review_dog')->where('owner_id', '=', $owner->id)->avg('rating') ? : 0; $request_data['owner']['num_rating'] = DB::table('review_dog')->where('owner_id', '=', $owner->id)->count(); */ $request_data['dog'] = array(); if ($dog = Dog::find($owner->dog_id)) { $request_data['dog']['name'] = $dog->name; $request_data['dog']['age'] = $dog->age; $request_data['dog']['breed'] = $dog->breed; $request_data['dog']['likes'] = $dog->likes; $request_data['dog']['picture'] = $dog->image_url; } $msg_array['request_data'] = $request_data; $title = "New Request"; $message = $msg_array; send_notifications($request_meta->walker_id, "walker", $title, $message); } else { // request ended Requests::where('id', '=', $request_id)->update(array('current_walker' => 0, 'status' => 1)); /* $driver = Keywords::where('id', 1)->first(); */ $owne = Owner::where('id', $request->owner_id)->first(); /* $driver_keyword = $driver->keyword; */ $driver_keyword = Config::get('app.generic_keywords.Provider'); $owner_data_id = $owne->id; send_notifications($owner_data_id, "owner", 'No ' . $driver_keyword . ' Found', 'No ' . $driver_keyword . ' are available right now in your area. Kindly try after sometime.'); } } $response_array = array('success' => true); $response_code = 200; } else { /* $response_array = array('success' => false, 'error' => 'Request ID does not matches' . $driver->keyword . ' ID', 'error_code' => 472); */ $response_array = array('success' => false, 'error' => 'Request ID does not matches' . Config::get('app.generic_keywords.Provider') . ' ID', 'error_code' => 472); $response_code = 200; } } else { $response_array = array('success' => false, 'error' => 'Request ID Not Found', 'error_code' => 405); $response_code = 200; } } else { $response_array = array('success' => false, 'error' => 'Token Expired', 'error_code' => 405); $response_code = 200; } } else { if ($is_admin) { /* $response_array = array('success' => false, 'error' => '' . $driver->keyword . ' ID not Found', 'error_code' => 410); */ $response_array = array('success' => false, 'error' => '' . Config::get('app.generic_keywords.Provider') . ' ID not Found', 'error_code' => 410); } else { $response_array = array('success' => false, 'error' => 'Not a valid token', 'error_code' => 406); } $response_code = 200; } } $response = Response::json($response_array, $response_code); return $response; }
<?php require_once 'includes/helpers.php'; require_once 'includes/config.php'; require_once '../src/includes.php'; $post = removeQuotes($_POST); $id = $post['id']; if (!isset($shopItems[$id])) { redirect_to(get_address()); } $item = $shopItems[$id]; $amount = $item['price']; $currency = $item['currency']; // get payment methods available for this project with min/max amounts in specified currency $methods = WebToPay::getPaymentMethodList($config['projectid'], $currency)->filterForAmount($amount, $currency)->setDefaultLanguage('en'); // set default language for titles (default: lt) echo template('paymentMethod.html', array('methods' => $methods, 'post' => $post));
} else { ?> <div id="senderdetail"> <p id="f_default"><input type="radio" id="default" name="sender" checked="checked" value="<?php echo get_addressid($uid); ?> " /> 收件人:<?php echo get_realname($uid); ?> 联系电话:<?php echo get_cellphone($uid); ?> 收货地址:<?php echo get_address($uid); ?> </p> </div> <div id="formsender" style="display:none"> <form id="form" name="form" > <dl> <dt>详细地址:</dt> <dd><input type="text" class="cart_n_long" id="address" maxlength="40" data-input="text" value="" name="area"><font class="ml10 cleb6100" style="display: none;">详细地址不能为空</font></dd> </dl> <dl> <dt><span>*</span>收 货 人:</dt> <dd><input type="text" class="cart_n_short" id="realname" maxlength="20" data-input="text" value=""><font class="ml10 cleb6100" style="display: none;">收货人不能为空</font></dd> </dl> <dl> <dt><span>*</span>手 机:</dt> <dd><input type="text" class="cart_n_short" id="phone" maxlength="11" data-msg="收货手机号码格式不正确" data-input="text" data-type="cellphone" value=""> 用于接收发货通知及送货前确认</dd> </dl> <dl> <dd><input id="default" checked="checked" name="default" type="checkbox" class="cart_n_box">设为默认地址</dd> </dl> <dl> <dt> </dt> <dd><a href="javascript:void(0)" class="ncart_btn_on" onclick="savemsg();">保存</a></dd> </dl> </form></div><?php } ?>
public function index() { /*查询购物车*/ $count = count($_SESSION['cart']); if (is_login()) { $cart = D("shopcart"); $result = $cart->getcart(); $this->assign('sqlcart', $result); $count = $cart->getCntByuid(); /*查询购物车中商品的种类 */ $sum = $cart->getNumByuid(); /* 查询购物车中商品的个数*/ $price = $cart->getPriceByuid(); /* 购物车中商品的总金额*/ $member = D("member"); $uid = $member->uid(); } else { $uid = ""; $count = $this->getCnt(); /*查询购物车中商品的种类 */ $sum = $this->getNum(); /* 查询购物车中商品的个数*/ $price = $this->getPrice(); /* 购物车中商品的总金额*/ $usercart = $_SESSION['cart']; $this->assign('usercart', $usercart); } $this->assign('uid', $uid); $address = get_address($uid); $this->assign('address', $address); $this->assign('count', $count); $this->assign('sum', $sum); $this->assign('price', $price); $this->meta_title = '我的购物车'; $this->display(); }
$cc_number_message = ''; $cc_ccv_message = ''; $cc_expiration_message = ''; $billing_address = get_address($_SESSION['user']['billingAddressID']); include 'checkout_payment.php'; break; case 'process': if (cart_product_count() == 0) { redirect('Location: ' . $app_path . 'cart'); } $cart = cart_get_items(); $card_type = filter_input(INPUT_POST, 'card_type', FILTER_VALIDATE_INT); $card_number = filter_input(INPUT_POST, 'card_number'); $card_cvv = filter_input(INPUT_POST, 'card_cvv'); $card_expires = filter_input(INPUT_POST, 'card_expires'); $billing_address = get_address($_SESSION['user']['billingAddressID']); // Validate card data // NOTE: This uses functions from the util/validation.php file if ($card_type === false) { display_error('Card type is required.'); } elseif (!is_valid_card_type($card_type)) { display_error('Card type ' . $card_type . ' is invalid.'); } $cc_number_message = ''; if ($card_number == null) { $cc_number_message = 'Required.'; } elseif (!is_valid_card_number($card_number, $card_type)) { $cc_number_message = 'Invalid.'; } $cc_ccv_message = ''; if ($card_cvv == null) {
// Set the new customer data in the session $_SESSION['user'] = get_customer($customer_id); redirect('.'); break; case 'view_address_edit': // Set up variables for address type $billing = $_POST['address_type'] == 'billing'; if ($billing) { $address_id = $_SESSION['user']['billingAddressID']; $heading = 'Update Billing Address'; } else { $address_id = $_SESSION['user']['shipAddressID']; $heading = 'Update Shipping Address'; } // Get the data for the address $address = get_address($address_id); $line1 = $address['line1']; $line2 = $address['line2']; $city = $address['city']; $state = $address['state']; $zip = $address['zipCode']; $phone = $address['phone']; // Display the data on the page include 'address_edit.php'; break; case 'update_address': $customer_id = $_SESSION['user']['customerID']; // Get the address ID for the address to be updated $billing = $_POST['address_type'] == 'billing'; if ($billing) { $address_id = $_SESSION['user']['billingAddressID'];
/** * 加入shoplist中 */ public function order() { /* uid调用*/ $uid = $this->login(); $score = get_score($uid); /* 积分兑换*/ $ratio = ceil($score / C('RATIO')); $this->assign('ratio', $ratio); $this->assign('uid', $uid); /* 创建订单*/ if (IS_POST) { $goodlist = M("shoplist"); $tag = $this->ordersn(); //标识号 $total_money = 0; $total_num = 0; $res_data = array(); for ($i = 0; $i < count($_POST["id"]); $i++) { $data = array(); $id = $_POST["id"][$i]; $num = $_POST["num"][$i]; $data['goodid'] = $id; $data['status'] = 1; $data['orderid'] = ''; $data['parameters'] = $_POST["parameters"][$i]; $data['sort'] = $_POST["sort"][$i]; $data['num'] = $num; $data['uid'] = $uid; $data['tag'] = $tag; //标识号必须相同 $data['create_time'] = NOW_TIME; $goodprice = $_POST["price"][$i]; $data['price'] = $goodprice; $goodtotal = $num * $goodprice; $data['total'] = $goodtotal; $total_money += $goodtotal; $total_num += $num; $goodlist->add($data); array_push($res_data, $data); } $useraddress = get_address($uid, false); $this->assign('address', $useraddress); if ($total_money < C('LOWWEST')) { $trans = C('SHIPMONEY'); } else { $trans = 0; } $all = $total_money + $trans; // $shoplist = M('Shoplist')->where("tag='$tag'")->field('parameters,goodid,price,num')->select(); $this->assign('shoplist', $res_data); $this->assign('all', $all); $this->assign('num', $total_num); $this->assign('tag', $tag); $this->assign('total', $total_money); $this->assign('trans', $trans); $this->meta_title = '订单结算'; $this->display(); } else { $this->error('对不起,错误访问!'); } }