Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- //define Roots
- $root = '../';
- $shop_root = '../';
- //Include Top Files
- include($root.'includes/config.php');
- include($root.'includes/functions.php');
- //Get Order ID
- $order_id = $_GET['order_id'];
- /*************************
- GET AND ASSIGN MAIN VARIABLES
- *************************/
- //Get main fields from order column Details
- $variable_query = mysqli_query($link, "SELECT DISTINCT `customer_id`, `collection_date`, `order_for_delivery`, `order_date`, `delivery_local` FROM `orders` WHERE `order_id`='$order_id'");
- //Assign main variables
- while($variable = mysqli_fetch_array($variable_query)) {
- $customer_id = $variable['customer_id'];
- $collection_date = $variable['collection_date'];
- $order_for_delivery = $variable['order_for_delivery'];
- $order_date = $varible['order_date'];
- $delivery_local = $variable['delivery_local'];
- }
- /*************************
- MARK ORDER AS PAID
- *************************/
- /*************************
- MARK EVENT AS PAID
- *************************/
- /*************************
- CUSTOMER DETAILS
- *************************/
- //Process Customer Details
- $customer_query = mysqli_query($link, "SELECT * FROM `customer` WHERE `customer_id`='$customer_id'");
- //Loop through customer details
- while($customer = mysqli_fetch_array($customer_query)){
- $name = $customer['customer_name'];
- $address = $customer['customer_address'];
- $city = $customer['customer_city'];
- $postcode = $customer['customer_postcode'];
- $tel_number = $customer['customer_number'];
- $customer_email = $customer['customer_email'];
- $customer_loyalty = $customer['customer_loyalty'];
- }
- /*************************
- BUILD ORDER ROWS
- *************************/
- //order query
- $order_query = mysqli_query($link, "SELECT * FROM `orders` WHERE `order_id`='$order_id'");
- //Total assign
- $total = '';
- //Event Check assign
- $event_order = '';
- //Order Row Assign
- $order_row = '';
- while($order = mysqli_fetch_array($order_query)) {
- //Get general product info
- $product_id = $order['product_id'];
- $product_name = product_title($product_id, $link);
- $quantity = $order['order_quanity'];
- $price = money($order['order_price'], '');
- //Query if the product has an event id
- $event_check = mysqli_query($link, "SELECT `event_id` FROM `products` WHERE `product_id`='$product_id'");
- //order row
- $order_row .= '<tr><td>'.$product_name.'</td><td>'.$quantity.'</td><td>'.money($price,'£').'</td></tr>';
- $total += $price;
- $event_order = mysqli_num_rows($event_check);
- }
- /*************************
- VOUCHER CHECK AND ROW
- *************************/
- //query voucher use
- $voucher_use = mysqli_query($link, "SELECT * FROM `voucher_use` WHERE `order_id`='$order_id'");
- //if there is a voucher with the order id
- if(mysqli_num_rows($voucher_use) != 0) {
- //Get Voucher use variables
- $result = mysqli_fetch_object($voucher_use);
- $old_total = $result->old_total;
- $total = $result->order_total;
- $voucher_code = $result->voucher_code;
- //query voucher details
- $voucher_details = mysqli_query($link, "SELECT * FROM `vouchers` WHERE `voucher_code`='$voucher_code'");
- $query_result = mysqli_fetch_object($voucher_details);
- $voucher_cust_text = $query_result->voucher_cust_text;
- if(!empty($old_total)) {
- $old_total = '<strike style="color: red;">'.$old_total.'</strike>';
- }
- $voucher_email = '<tr style="background: #dff0d8;"><td colspan="4" style="padding:5px;"><strong>'.$voucher_code.' - </strong> '.$voucher_cust_text.'</td></tr>';
- }
- /*************************
- EVENT E-TICKET
- *************************/
- //Check if there is an event
- if($event_order > 0) {
- //Query for event with customer_id
- $event_order_query = mysqli_query($link, "SELECT * FROM `event_booking` WHERE `customer_id`='$customer_id'");
- //Assign event details
- $event = mysqli_fetch_array($event_order_query);
- $event_id = $event['event_id'];
- //Get Event Details
- $event_query = mysqli_query($link, "SELECT * FROM `events` WHERE `event_id`='$event_id'");
- //Assign Details
- $event_details = mysqli_fetch_array($event_query);
- $event_name = $event_details['event_name'];
- $event_date = $event_details['event_date'];
- $event_start_time = $event_details['event_start_time'];
- $event_end_time = $event_details['event_end_time'];
- $event_type = event_type($link, $event_details['event_type_id']);
- $event_location = event_location($link, $event_details['event_loaction_id']);
- $event_description = $event_details['event_desc'];
- $event_email = '';
- }
- /*************************
- EVENT GIFT EMAIL
- *************************/
- //check if there is gift details
- $gift_check = mysqli_query($link, "SELECT * FROM `event_gift` WHERE `customer_id`='$customer_id'");
- //If there is a gift then create gift email
- if(mysqli_num_rows($gift_check) != 0) {
- //Loop to get gift details
- while($gift = mysqli_fetch_array($gift_check)) {
- $gift_name = $gift['gift_name'];
- $gift_email = $gift['gift_email'];
- $gift_message = $gift['gift_message'];
- }
- $gift_email = '';
- }
- /*************************
- ORDER CONFIRMATION EMAIL
- *************************/
- /*************************
- SEND EMAILS
- *************************/
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement