/** * Echos the order status page. Use in the mp_orderstatus.php template. * */ function mp_order_status($echo = true) { global $mp, $wp_query, $blog_id; $bid = is_multisite() ? $blog_id : 1; // FPM: Used for Custom Field Processing $content = do_shortcode($mp->get_setting('msg->order_status')); $order_id = isset($wp_query->query_vars['order_id']) ? $wp_query->query_vars['order_id'] : (isset($_GET['order_id']) ? $_GET['order_id'] : ''); $order = false; if (!empty($order_id)) { //get order $order = $mp->get_order($order_id); if ($order) { //valid order $content .= ' <h2><em>' . sprintf(__('Order Details (%s):', 'mp'), esc_html($order_id)) . '</em></h2> <h3>' . apply_filters('mp_order_status_section_title', __('Current Status', 'mp'), $order) . '</h3> <ul>'; //get times $received = isset($order->mp_received_time) ? $mp->format_date($order->mp_received_time) : ''; if (!empty($order->mp_paid_time)) { $paid = $mp->format_date($order->mp_paid_time); } if (!empty($order->mp_shipped_time)) { $shipped = $mp->format_date($order->mp_shipped_time); } if ($order->post_status == 'order_received') { $content .= '<li>' . apply_filters('mp_order_status_label_received', __('Received', 'mp'), $order) . ' <strong>' . $received . '</strong></li>'; } else { if ($order->post_status == 'order_paid') { $content .= '<li>' . apply_filters('mp_order_status_label_paid', __('Paid', 'mp'), $order) . ' <strong>' . $paid . '</strong></li>'; $content .= '<li>' . apply_filters('mp_order_status_label_received', __('Received', 'mp'), $order) . ' <strong>' . $received . '</strong></li>'; } else { if ($order->post_status == 'order_shipped' || $order->post_status == 'order_closed') { $content .= '<li>' . apply_filters('mp_order_status_label_shipped', __('Shipped', 'mp'), $order) . ' <strong>' . $shipped . '</strong></li>'; $content .= '<li>' . apply_filters('mp_order_status_label_paid', __('Paid', 'mp'), $order) . ' <strong>' . $paid . '</strong></li>'; $content .= '<li>' . apply_filters('mp_order_status_label_received', __('Received', 'mp'), $order) . ' <strong>' . $received . '</strong></li>'; } } } $order_paid = $order->post_status != 'order_received'; $max_downloads = $mp->get_setting('max_downloads', 5); $content .= ' </ul> <h3>' . apply_filters('mp_order_status_section_title_payment_info', __('Payment Information', 'mp'), $order) . '</h3> <ul> <li>' . apply_filters('mp_order_status_label_payment_method', __('Payment Method', 'mp'), $order) . ' <strong>' . $order->mp_payment_info['gateway_public_name'] . '</strong> </li> <li>' . apply_filters('mp_order_status_label_payment_type', __('Payment Type', 'mp'), $order) . ' <strong>' . $order->mp_payment_info['method'] . '</strong> </li> <li>' . apply_filters('mp_order_status_label_trans_id', __('Transaction ID', 'mp'), $order) . ' <strong>' . $order->mp_payment_info['transaction_id'] . '</strong> </li> <li>' . apply_filters('mp_order_status_label_payment_total', __('Payment Total', 'mp'), $order) . ' <strong>' . $mp->format_currency($order->mp_payment_info['currency'], $order->mp_payment_info['total']) . ' ' . $order->mp_payment_info['currency'] . '</strong> </li> </ul> <h3>' . apply_filters('mp_order_status_section_title_order_info', __('Order Information', 'mp'), $order) . '</h3> <table id="mp-order-product-table" class="mp_cart_contents"> <thead><tr> <th class="mp_cart_col_thumb"> </th> <th class="mp_cart_col_product">' . apply_filters('mp_order_status_label_item', __('Item', 'mp'), $order) . '</th> <th class="mp_cart_col_quant">' . apply_filters('mp_order_status_label_quantity', __('Quantity', 'mp'), $order) . '</th> <th class="mp_cart_col_price">' . apply_filters('mp_order_status_label_price', __('Price', 'mp'), $order) . '</th> <th class="mp_cart_col_subtotal">' . apply_filters('mp_order_status_label_subtotal', __('Subtotal', 'mp'), $order) . '</th> <th class="mp_cart_col_downloads">' . apply_filters('mp_order_status_label_download', __('Download', 'mp'), $order) . '</th> </tr></thead> <tbody>'; $coupon_code = is_array($order->mp_discount_info) ? $order->mp_discount_info['code'] : ''; if (is_array($order->mp_cart_info) && count($order->mp_cart_info)) { foreach ($order->mp_cart_info as $product_id => $variations) { //for compatibility for old orders from MP 1.x if (isset($variations['name'])) { $data = $variations; $price = $data['price'] * $data['quantity']; $discount_price = $mp->coupon_value_product($coupon_code, $price, $product_id); $price_text = ''; $subtotal_text = ''; //price text if ($price != $discount_price) { $price_text = '<del>' . $mp->format_currency('', $price / $data['quantity']) . '</del><br />'; } $price_text .= $mp->format_currency('', $discount_price / $data['quantity']); //subtotal text if ($price != $discount_price) { $subtotal_text .= '<del>' . $mp->format_currency('', $price) . '</del><br />'; } $subtotal_text .= $mp->format_currency('', $discount_price); $content .= '<tr>'; $content .= ' <td class="mp_cart_col_thumb">' . mp_product_image(false, 'widget', $product_id) . '</td>'; $content .= ' <td class="mp_cart_col_product"><a href="' . apply_filters('mp_product_url_display_in_cart', get_permalink($product_id), $product_id) . '">' . apply_filters('mp_product_name_display_in_cart', $data['name'], $product_id) . '</a>' . '</td>'; // Added WPML (This differs than other code) $content .= ' <td class="mp_cart_col_quant">' . number_format_i18n($data['quantity']) . '</td>'; $content .= ' <td class="mp_cart_col_price">' . $price_text . '</td>'; $content .= ' <td class="mp_cart_col_subtotal">' . $subtotal_text . '</td>'; $content .= ' <td class="mp_cart_col_downloads"></td>'; $content .= '</tr>'; } else { foreach ($variations as $variation => $data) { $price = $data['price'] * $data['quantity']; $discount_price = $mp->coupon_value_product($coupon_code, $price, $product_id); $price_text = ''; $subtotal_text = ''; //price text if ($price != $discount_price) { $price_text = '<del>' . $mp->format_currency('', $price / $data['quantity']) . '</del><br />'; } $price_text .= $mp->format_currency('', $discount_price / $data['quantity']); //subtotal text if ($price != $discount_price) { $subtotal_text .= '<del>' . $mp->format_currency('', $price) . '</del><br />'; } $subtotal_text .= $mp->format_currency('', $discount_price); $content .= '<tr>'; $content .= ' <td class="mp_cart_col_thumb">' . mp_product_image(false, 'widget', $product_id) . '</td>'; $content .= ' <td class="mp_cart_col_product"><a href="' . apply_filters('mp_product_url_display_in_cart', get_permalink($product_id), $product_id) . '">' . apply_filters('mp_product_name_display_in_cart', $data['name'], $product_id) . '</a>'; // Output product custom field information $cf_key = $bid . ':' . $product_id . ':' . $variation; if (isset($order->mp_shipping_info['mp_custom_fields'][$cf_key])) { $cf_item = $order->mp_shipping_info['mp_custom_fields'][$cf_key]; $mp_custom_field_label = get_post_meta($product_id, 'mp_custom_field_label', true); if (isset($mp_custom_field_label[$variation])) { $label_text = $mp_custom_field_label[$variation]; } else { $label_text = __('Product Personalization:', 'mp'); } $content .= '<div class="mp_cart_custom_fields">' . apply_filters('mp_order_status_label_custom_fields', $label_text, $order) . '<br />'; foreach ($cf_item as $item) { $content .= $item; } $content .= '</div>'; } $content .= '</td>'; $content .= ' <td class="mp_cart_col_quant">' . number_format_i18n($data['quantity']) . '</td>'; $content .= ' <td class="mp_cart_col_price">' . $price_text . '</td>'; $content .= ' <td class="mp_cart_col_subtotal">' . $subtotal_text . '</td>'; if (is_array($data['download']) && ($download_url = $mp->get_download_url($product_id, $order->post_title))) { if ($order_paid) { //check for too many downloads if (intval($data['download']['downloaded']) < $max_downloads) { $content .= ' <td class="mp_cart_col_downloads"><a href="' . $download_url . '">' . apply_filters('mp_order_status_label_download', __('Download»', 'mp'), $order) . '</a></td>'; } else { $content .= ' <td class="mp_cart_col_downloads">' . apply_filters('mp_order_status_label_limit_reached', __('Limit Reached', 'mp'), $order) . '</td>'; } } else { $content .= ' <td class="mp_cart_col_downloads">' . apply_filters('mp_order_status_label_awaiting_payment', __('Awaiting Payment', 'mp'), $order) . '</td>'; } } else { $content .= ' <td class="mp_cart_col_downloads"></td>'; } $content .= '</tr>'; } } } } else { $content .= '<tr><td colspan="6">' . apply_filters('mp_order_status_label_no_products_found', __('No products could be found for this order', 'mp'), $order) . '</td></tr>'; } $content .= ' </tbody> </table> <ul>'; //coupon line if ($order->mp_discount_info) { $content .= '<li>' . apply_filters('mp_order_status_label_coupon_discount', __('Coupon', 'mp'), $order) . ': <strong>' . strtoupper($order->mp_discount_info['code']) . '</strong></li>'; } //shipping line if ($order->mp_shipping_total) { $content .= '<li>' . apply_filters('mp_order_status_label_shipping', __('Shipping', 'mp'), $order) . ': <strong>' . $mp->format_currency('', $mp->get_display_shipping($order)) . '</strong></li>'; } //tax line if ($order->mp_tax_total) { $content .= '<li>' . esc_html($mp->get_setting('tax->label', __('Taxes', 'mp'))) . ': <strong>' . $mp->format_currency('', $order->mp_tax_total) . '</strong></li>'; } $content .= '<li>' . apply_filters('mp_order_status_label_order_total', __('Order Total', 'mp'), $order) . ': <strong>' . $mp->format_currency('', $order->mp_order_total) . '</strong></li> </ul>'; if (MP_HIDE_ORDERSTATUS_SHIPPING !== true) { $content .= ' <h3>' . apply_filters('mp_order_status_section_title_shipping_info', __('Shipping Information', 'mp'), $order) . '</h3> <table class="mp_cart_shipping"> <tr> <td align="right">' . apply_filters('mp_order_status_label_full_name', __('Full Name', 'mp'), $order) . '</td> <td>' . esc_attr($order->mp_shipping_info['name']) . '</td> </tr> <tr> <td align="right">' . apply_filters('mp_order_status_label_address', __('Address', 'mp'), $order) . '</td> <td>' . esc_attr($order->mp_shipping_info['address1']) . '</td> </tr>'; if ($order->mp_shipping_info['address2']) { $content .= ' <tr> <td align="right">' . apply_filters('mp_order_status_label_address_2', __('Address 2', 'mp'), $order) . '</td> <td>' . esc_attr($order->mp_shipping_info['address2']) . '</td> </tr>'; } $content .= ' <tr> <td align="right">' . apply_filters('mp_order_status_label_city', __('City', 'mp'), $order) . '</td> <td>' . esc_attr($order->mp_shipping_info['city']) . '</td> </tr>'; if ($order->mp_shipping_info['state']) { $content .= ' <tr> <td align="right">' . apply_filters('mp_order_status_label_state', __('State/Province/Region', 'mp'), $order) . '</td> <td>' . esc_attr($order->mp_shipping_info['state']) . '</td> </tr>'; } $content .= ' <tr> <td align="right">' . apply_filters('mp_order_status_label_zip_code', __('Postal/Zip Code', 'mp'), $order) . '</td> <td>' . esc_attr($order->mp_shipping_info['zip']) . '</td> </tr> <tr> <td align="right">' . apply_filters('mp_order_status_label_country', __('Country', 'mp'), $order) . '</td> <td>' . $mp->countries[$order->mp_shipping_info['country']] . '</td> </tr>'; if ($order->mp_shipping_info['phone']) { $content .= ' <tr> <td align="right">' . apply_filters('mp_order_status_label_phone_number', __('Phone Number', 'mp'), $order) . '</td> <td>' . esc_attr($order->mp_shipping_info['phone']) . '</td> </tr>'; } if (isset($order->mp_shipping_info['tracking_num'])) { $content .= ' <tr> <td align="right">' . apply_filters('mp_order_status_label_tracking_number', __('Tracking Number', 'mp'), $order) . '</td> <td>' . mp_tracking_link($order->mp_shipping_info['tracking_num'], $order->mp_shipping_info['method']) . '</td> </tr>'; } $content .= ' </table>'; } if (isset($order->mp_order_notes)) { $content .= ' <h3>' . apply_filters('mp_order_status_section_title_order_notes', __('Order Notes', 'mp'), $order) . '</h3>' . wpautop($order->mp_order_notes); } $content .= mp_orderstatus_link(false, false, __('« Back', 'mp')); } else { //not valid order id $content .= ' <h3>' . apply_filters('mp_order_status_section_title_invalid_order_id', __('Invalid Order ID. Please try again:', 'mp'), $order) . '</h3> <form action="' . mp_orderstatus_link(true, true) . '" method="get"> <label>' . apply_filters('mp_order_status_label_enter_order_number', __('Enter your 12-digit Order ID number:', 'mp'), $order) . '<br /> <input type="text" name="order_id" id="order_id" class="input" value="" size="20" /></label> <input type="submit" id="order-id-submit" value="' . apply_filters('mp_order_status_label_look_up_button', __('Look Up »', 'mp'), $order) . '" /> </form>'; } } else { //get from usermeta $user_id = get_current_user_id(); if ($user_id) { if (is_multisite()) { global $blog_id; $meta_id = 'mp_order_history_' . $blog_id; } else { $meta_id = 'mp_order_history'; } $orders = get_user_meta($user_id, $meta_id, true); } else { //get from cookie if (is_multisite()) { global $blog_id; $cookie_id = 'mp_order_history_' . $blog_id . '_' . COOKIEHASH; } else { $cookie_id = 'mp_order_history_' . COOKIEHASH; } if (isset($_COOKIE[$cookie_id])) { $orders = unserialize($_COOKIE[$cookie_id]); } } if (is_array($orders) && count($orders)) { krsort($orders); //list orders $content .= '<h3>' . apply_filters('mp_order_status_label_recent_orders', __('Your Recent Orders:', 'mp'), $order) . '</h3>'; $content .= '<ul id="mp-order-list">'; //need to check for removed orders $resave_meta = false; foreach ($orders as $timestamp => $order) { if ($mp->get_order($order['id'])) { $content .= ' <li><strong>' . $mp->format_date($timestamp) . ':</strong> ' . mp_orderstatus_link(false, false, $order['id'], $order['id']) . ' - ' . $mp->format_currency('', $order['total']) . '</li>'; } else { unset($orders[$timestamp]); $resave_meta = true; } } $content .= '</ul>'; //if we need to resave we'll do it here if ($resave_meta) { $_COOKIE[$cookie_id] = serialize($orders); update_user_meta($user_id, $meta_id, $orders); } $content .= ' <form action="' . mp_orderstatus_link(false, true) . '" method="get"> <label>' . apply_filters('mp_order_status_label_or_enter_order_number', __('Or enter your 12-digit Order ID number:', 'mp'), $order) . '<br /> <input type="text" name="order_id" id="order_id" class="input" value="" size="20" /></label> <input type="submit" id="order-id-submit" value="' . apply_filters('mp_order_status_label_look_up_button', __('Look Up »', 'mp'), $order) . '" /> </form>'; } else { if (!is_user_logged_in()) { $content .= ' <table class="mp_cart_login"> <thead><tr> <th class="mp_cart_login" colspan="2">' . apply_filters('mp_order_status_label_login_to_view_order_history', __('Have a User Account? Login To View Your Order History:', 'mp'), $order) . '</th> <th> </th> </tr></thead> <tbody> <tr> <td class="mp_cart_login"> <form name="loginform" id="loginform" action="' . wp_login_url() . '" method="post"> <label>' . apply_filters('mp_order_status_label_username', __('Username', 'mp'), $order) . '<br /> <input type="text" name="log" id="user_login" class="input" value="" size="20" /></label> <br /> <label>' . apply_filters('mp_order_status_label_password', __('Password', 'mp'), $order) . '<br /> <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label> <br /> <input type="submit" name="wp-submit" id="mp_login_submit" value="' . apply_filters('mp_order_status_label_login_button', __('Login »', 'mp'), $order) . '" /> <input type="hidden" name="redirect_to" value="' . mp_orderstatus_link(false, true) . '" /> </form> </td> <td class="mp_cart_or_label">' . apply_filters('mp_order_status_label_or', __('or', 'mp'), $order) . '</td> <td class="mp_cart_checkout"> <form action="' . mp_orderstatus_link(false, true) . '" method="get"> <label>' . apply_filters('mp_order_status_label_enter_order_number', __('Enter your 12-digit Order ID number:', 'mp'), $order) . '<br /> <input type="text" name="order_id" id="order_id" class="input" value="" size="20" /></label> <input type="submit" id="order-id-submit" value="' . apply_filters('mp_order_status_label_look_up_button', __('Look Up »', 'mp'), $order) . '" /> </form> </td> </tr> </tbody> </table>'; } else { $content .= ' <form action="' . mp_orderstatus_link(false, true) . '" method="get"> <label>' . apply_filters('mp_order_status_label_enter_order_number', __('Enter your 12-digit Order ID number:', 'mp'), $order) . '<br /> <input type="text" name="order_id" id="order_id" class="input" value="" size="20" /></label> <input type="submit" id="order-id-submit" value="' . apply_filters('mp_order_status_label_look_up_button', __('Look Up »', 'mp'), $order) . '" /> </form>'; } } } $content = apply_filters('mp_order_status', $content, $order); if ($echo) { echo $content; } else { return $content; } }
/** * Echos the order status page. Use in the mp_orderstatus.php template. * */ function mp_order_status() { global $mp, $wp_query; $settings = get_option('mp_settings'); echo $settings['msg']['order_status']; $order_id = $wp_query->query_vars['order_id'] ? $wp_query->query_vars['order_id'] : $_GET['order_id']; if (!empty($order_id)) { //get order $order = $mp->get_order($order_id); if ($order) { //valid order echo '<h2><em>' . sprintf(__('Order Details (%s):', 'mp'), htmlentities($order_id)) . '</em></h2>'; ?> <h3><?php _e('Current Status', 'mp'); ?> </h3> <ul> <?php //get times $received = date(get_option('date_format') . ' - ' . get_option('time_format'), $order->mp_received_time); if ($order->mp_paid_time) { $paid = date(get_option('date_format') . ' - ' . get_option('time_format'), $order->mp_paid_time); } if ($order->mp_shipped_time) { $shipped = date(get_option('date_format') . ' - ' . get_option('time_format'), $order->mp_shipped_time); } if ($order->post_status == 'order_received') { echo '<li>' . __('Received:', 'mp') . ' <strong>' . $received . '</strong></li>'; } else { if ($order->post_status == 'order_paid') { echo '<li>' . __('Paid:', 'mp') . ' <strong>' . $paid . '</strong></li>'; echo '<li>' . __('Received:', 'mp') . ' <strong>' . $received . '</strong></li>'; } else { if ($order->post_status == 'order_shipped' || $order->post_status == 'order_closed') { echo '<li>' . __('Shipped:', 'mp') . ' <strong>' . $shipped . '</strong></li>'; echo '<li>' . __('Paid:', 'mp') . ' <strong>' . $paid . '</strong></li>'; echo '<li>' . __('Received:', 'mp') . ' <strong>' . $received . '</strong></li>'; } } } $order_paid = $order->post_status != 'order_received'; $max_downloads = intval($settings['max_downloads']) ? intval($settings['max_downloads']) : 5; ?> </ul> <h3><?php _e('Payment Information:', 'mp'); ?> </h3> <ul> <li> <?php _e('Payment Method:', 'mp'); ?> <strong><?php echo $order->mp_payment_info['gateway_public_name']; ?> </strong> </li> <li> <?php _e('Payment Type:', 'mp'); ?> <strong><?php echo $order->mp_payment_info['method']; ?> </strong> </li> <li> <?php _e('Transaction ID:', 'mp'); ?> <strong><?php echo $order->mp_payment_info['transaction_id']; ?> </strong> </li> <li> <?php _e('Payment Total:', 'mp'); ?> <strong><?php echo $mp->format_currency($order->mp_payment_info['currency'], $order->mp_payment_info['total']) . ' ' . $order->mp_payment_info['currency']; ?> </strong> </li> </ul> <h3><?php _e('Order Information:', 'mp'); ?> </h3> <table id="mp-order-product-table" class="mp_cart_contents"> <thead><tr> <th class="mp_cart_col_thumb"> </th> <th class="mp_cart_col_product"><?php _e('Item', 'mp'); ?> </th> <th class="mp_cart_col_quant"><?php _e('Quantity', 'mp'); ?> </th> <th class="mp_cart_col_price"><?php _e('Price', 'mp'); ?> </th> <th class="mp_cart_col_subtotal"><?php _e('Subtotal', 'mp'); ?> </th> <th class="mp_cart_col_downloads"><?php _e('Download', 'mp'); ?> </th> </tr></thead> <tbody> <?php if (is_array($order->mp_cart_info) && count($order->mp_cart_info)) { foreach ($order->mp_cart_info as $product_id => $variations) { //for compatibility for old orders from MP 1.x if (isset($variations['name'])) { $data = $variations; echo '<tr>'; echo ' <td class="mp_cart_col_thumb">' . mp_product_image(false, 'widget', $product_id) . '</td>'; echo ' <td class="mp_cart_col_product"><a href="' . apply_filters('mp_product_url_display_in_cart', $data['url'], $product_id) . '">' . apply_filters('mp_product_name_display_in_cart', $data['name'], $product_id) . '</a>' . '</td>'; // Added WPML (This differs than other code) echo ' <td class="mp_cart_col_quant">' . number_format_i18n($data['quantity']) . '</td>'; echo ' <td class="mp_cart_col_price">' . $mp->format_currency('', $data['price']) . '</td>'; echo ' <td class="mp_cart_col_subtotal">' . $mp->format_currency('', $data['price'] * $data['quantity']) . '</td>'; echo ' <td class="mp_cart_col_downloads"></td>'; echo '</tr>'; } else { foreach ($variations as $variation => $data) { echo '<tr>'; echo ' <td class="mp_cart_col_thumb">' . mp_product_image(false, 'widget', $product_id) . '</td>'; echo ' <td class="mp_cart_col_product"><a href="' . apply_filters('mp_product_url_display_in_cart', $data['url'], $product_id) . '">' . apply_filters('mp_product_name_display_in_cart', $data['name'], $product_id) . '</a>' . '</td>'; // Added WPML (This differs than other code) echo ' <td class="mp_cart_col_quant">' . number_format_i18n($data['quantity']) . '</td>'; echo ' <td class="mp_cart_col_price">' . $mp->format_currency('', $data['price']) . '</td>'; echo ' <td class="mp_cart_col_subtotal">' . $mp->format_currency('', $data['price'] * $data['quantity']) . '</td>'; if (is_array($data['download']) && ($download_url = $mp->get_download_url($product_id, $order->post_title))) { if ($order_paid) { //check for too many downloads if (intval($data['download']['downloaded']) < $max_downloads) { echo ' <td class="mp_cart_col_downloads"><a href="' . $download_url . '">' . __('Download»', 'mp') . '</a></td>'; } else { echo ' <td class="mp_cart_col_downloads">' . __('Limit Reached', 'mp') . '</td>'; } } else { echo ' <td class="mp_cart_col_downloads">' . __('Awaiting Payment', 'mp') . '</td>'; } } else { echo ' <td class="mp_cart_col_downloads"></td>'; } echo '</tr>'; } } } } else { echo '<tr><td colspan="6">' . __('No products could be found for this order', 'mp') . '</td></tr>'; } ?> </tbody> </table> <ul> <?php //coupon line if ($order->mp_discount_info) { ?> <li><?php _e('Coupon Discount:', 'mp'); ?> <strong><?php echo $order->mp_discount_info['discount']; ?> </strong></li> <?php } ?> <?php //shipping line if ($order->mp_shipping_total) { ?> <li><?php _e('Shipping:', 'mp'); ?> <strong><?php echo $mp->format_currency('', $order->mp_shipping_total); ?> </strong></li> <?php } ?> <?php //tax line if ($order->mp_tax_total) { ?> <li><?php _e('Taxes:', 'mp'); ?> <strong><?php echo $mp->format_currency('', $order->mp_tax_total); ?> </strong></li> <?php } ?> <li><?php _e('Order Total:', 'mp'); ?> <strong><?php echo $mp->format_currency('', $order->mp_order_total); ?> </strong></li> </ul> <?php if (!defined('MP_HIDE_ORDERSTATUS_SHIPPING')) { ?> <h3><?php _e('Shipping Information:', 'mp'); ?> </h3> <table> <tr> <td align="right"><?php _e('Full Name:', 'mp'); ?> </td><td> <?php echo esc_attr($order->mp_shipping_info['name']); ?> </td> </tr> <tr> <td align="right"><?php _e('Address:', 'mp'); ?> </td> <td><?php echo esc_attr($order->mp_shipping_info['address1']); ?> </td> </tr> <?php if ($order->mp_shipping_info['address2']) { ?> <tr> <td align="right"><?php _e('Address 2:', 'mp'); ?> </td> <td><?php echo esc_attr($order->mp_shipping_info['address2']); ?> </td> </tr> <?php } ?> <tr> <td align="right"><?php _e('City:', 'mp'); ?> </td> <td><?php echo esc_attr($order->mp_shipping_info['city']); ?> </td> </tr> <?php if ($order->mp_shipping_info['state']) { ?> <tr> <td align="right"><?php _e('State/Province/Region:', 'mp'); ?> </td> <td><?php echo esc_attr($order->mp_shipping_info['state']); ?> </td> </tr> <?php } ?> <tr> <td align="right"><?php _e('Postal/Zip Code:', 'mp'); ?> </td> <td><?php echo esc_attr($order->mp_shipping_info['zip']); ?> </td> </tr> <tr> <td align="right"><?php _e('Country:', 'mp'); ?> </td> <td><?php echo $mp->countries[$order->mp_shipping_info['country']]; ?> </td> </tr> <?php if ($order->mp_shipping_info['phone']) { ?> <tr> <td align="right"><?php _e('Phone Number:', 'mp'); ?> </td> <td><?php echo esc_attr($order->mp_shipping_info['phone']); ?> </td> </tr> <?php } ?> <?php if (isset($order->mp_shipping_info['tracking_num'])) { ?> <tr> <td align="right"><?php _e('Tracking Number:', 'mp'); ?> </td> <td><?php echo mp_tracking_link($order->mp_shipping_info['tracking_num'], $order->mp_shipping_info['method']); ?> </td> </tr> <?php } ?> </table> <?php } ?> <?php if (isset($order->mp_order_notes)) { ?> <h3><?php _e('Order Notes:', 'mp'); ?> </h3> <?php echo wpautop($order->mp_order_notes); ?> <?php } ?> <?php do_action('mp_order_status_output', $order); ?> <?php mp_orderstatus_link(true, false, __('« Back', 'mp')); ?> <?php } else { //not valid order id echo '<h3>' . __('Invalid Order ID. Please try again:', 'mp') . '</h3>'; ?> <form action="<?php mp_orderstatus_link(true, true); ?> " method="get"> <label><?php _e('Enter your 12-digit Order ID number:', 'mp'); ?> <br /> <input type="text" name="order_id" id="order_id" class="input" value="" size="20" /></label> <input type="submit" id="order-id-submit" value="<?php _e('Look Up »', 'mp'); ?> " /> </form> <?php } } else { //get from usermeta $user_id = get_current_user_id(); if ($user_id) { if (is_multisite()) { global $blog_id; $meta_id = 'mp_order_history_' . $blog_id; } else { $meta_id = 'mp_order_history'; } $orders = get_user_meta($user_id, $meta_id, true); } else { //get from cookie if (is_multisite()) { global $blog_id; $cookie_id = 'mp_order_history_' . $blog_id . '_' . COOKIEHASH; } else { $cookie_id = 'mp_order_history_' . COOKIEHASH; } if (isset($_COOKIE[$cookie_id])) { $orders = unserialize($_COOKIE[$cookie_id]); } } if (is_array($orders) && count($orders)) { krsort($orders); //list orders echo '<h3>' . __('Your Recent Orders:', 'mp') . '</h3>'; echo '<ul id="mp-order-list">'; foreach ($orders as $timestamp => $order) { echo ' <li><strong>' . date(get_option('date_format') . ' - ' . get_option('time_format'), $timestamp) . ':</strong> <a href="./' . trailingslashit($order['id']) . '">' . $order['id'] . '</a> - ' . $mp->format_currency('', $order['total']) . '</li>'; } echo '</ul>'; ?> <form action="<?php mp_orderstatus_link(true, true); ?> " method="get"> <label><?php _e('Or enter your 12-digit Order ID number:', 'mp'); ?> <br /> <input type="text" name="order_id" id="order_id" class="input" value="" size="20" /></label> <input type="submit" id="order-id-submit" value="<?php _e('Look Up »', 'mp'); ?> " /> </form> <?php } else { if (!is_user_logged_in()) { ?> <table class="mp_cart_login"> <thead><tr> <th class="mp_cart_login" colspan="2"><?php _e('Have a User Account? Login To View Your Order History:', 'mp'); ?> </th> <th> </th> </tr></thead> <tbody> <tr> <td class="mp_cart_login"> <form name="loginform" id="loginform" action="<?php echo wp_login_url(); ?> " method="post"> <label><?php _e('Username', 'mp'); ?> <br /> <input type="text" name="log" id="user_login" class="input" value="" size="20" /></label> <br /> <label><?php _e('Password', 'mp'); ?> <br /> <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label> <br /> <input type="submit" name="wp-submit" id="mp_login_submit" value="<?php _e('Login »', 'mp'); ?> " /> <input type="hidden" name="redirect_to" value="<?php mp_orderstatus_link(true, true); ?> " /> </form> </td> <td class="mp_cart_or_label"><?php _e('or', 'mp'); ?> </td> <td class="mp_cart_checkout"> <form action="<?php mp_orderstatus_link(true, true); ?> " method="get"> <label><?php _e('Enter your 12-digit Order ID number:', 'mp'); ?> <br /> <input type="text" name="order_id" id="order_id" class="input" value="" size="20" /></label> <input type="submit" id="order-id-submit" value="<?php _e('Look Up »', 'mp'); ?> " /> </form> </td> </tr> </tbody> </table> <?php } else { ?> <form action="<?php mp_orderstatus_link(true, true); ?> " method="get"> <label><?php _e('Enter your 12-digit Order ID number:', 'mp'); ?> <br /> <input type="text" name="order_id" id="order_id" class="input" value="" size="20" /></label> <input type="submit" id="order-id-submit" value="<?php _e('Look Up »', 'mp'); ?> " /> </form> <?php } } } }