function displaymyorders()
    {
        global $wpdb, $eshopoptions;
        global $current_user;
        get_currentuserinfo();
        $user_id = $current_user->ID;
        //these should be global, but it wasn't working *sigh*
        $phpself = esc_url($_SERVER['REQUEST_URI']);
        $dtable = $wpdb->prefix . 'eshop_orders';
        $itable = $wpdb->prefix . 'eshop_order_items';
        $sortby = 'ORDER BY custom_field DESC';
        $max = $wpdb->get_var("SELECT COUNT(id) FROM {$dtable} WHERE id > 0 AND user_id='{$user_id}'");
        if ($max > 0) {
            if ($eshopoptions['records'] != '' && is_numeric($eshopoptions['records'])) {
                $records = $eshopoptions['records'];
            } else {
                $records = '10';
            }
            if (isset($_GET['_p']) && is_numeric($_GET['_p'])) {
                $epage = $_GET['_p'];
            } else {
                $epage = '1';
            }
            if (!isset($_GET['eshopall'])) {
                $page_links = paginate_links(array('base' => add_query_arg('_p', '%#%'), 'format' => '', 'total' => ceil($max / $records), 'current' => $epage, 'type' => 'array'));
                $offset = $epage * $records - $records;
            } else {
                $page_links = paginate_links(array('base' => add_query_arg('_p', '%#%'), 'format' => '', 'total' => ceil($max / $records), 'current' => $epage, 'type' => 'array', 'show_all' => true));
                $offset = '0';
                $records = $max;
            }
            //
            $myrowres = $wpdb->get_results("Select * From {$dtable} where user_id='{$user_id}' {$sortby} LIMIT {$offset}, {$records}");
            $calt = 0;
            echo '<div class="orderlist tablecontainer">';
            echo '<table class="hidealllabels widefat" summary="order listing">
			<caption class="offset">' . __('eshop Order Listing', 'eshop') . '</caption>
			<thead>
			<tr>
			<th id="line" title="' . __('reference number', 'eshop') . '">#</th>
			<th id="date">' . __('Ordered on', 'eshop') . '</th>
			<th id="transid">' . __('Transaction ID', 'eshop') . '</th>
			<th id="items">' . __('Items', 'eshop') . '</th>
			<th id="price">' . __('Price', 'eshop') . '</th>
			<th id="state">' . __('Order Status', 'eshop') . '</th>
			</tr></thead><tbody>' . "\n";
            $move = array();
            $c = 0;
            foreach ($myrowres as $myrow) {
                //total + products
                $c++;
                //count for the  number of results.
                $checkid = $myrow->checkid;
                $itemrowres = $wpdb->get_results("Select * From {$itable} where checkid='{$checkid}'");
                $total = 0;
                $x = -1;
                foreach ($itemrowres as $itemrow) {
                    $value = $itemrow->item_qty * $itemrow->item_amt;
                    $total = $total + $value;
                    $x++;
                }
                //
                $status = $myrow->status;
                if ($status == 'Completed') {
                    $status = __('Awaiting Dispatch', 'eshop');
                }
                if ($status == 'Pending') {
                    $status = __('Pending', 'eshop');
                }
                if ($status == 'Waiting') {
                    $status = __('Awaiting Payment', 'eshop');
                }
                if ($status == 'Sent') {
                    $status = __('Shipped', 'eshop');
                }
                if ($status == 'Deleted') {
                    $status = __('Deleted', 'eshop');
                }
                if ($status == 'Failed') {
                    $status = __('Failed', 'eshop');
                }
                if ($x > 0) {
                    $thisdate = eshop_real_date($myrow->custom_field);
                    $calt++;
                    $alt = $calt % 2 ? '' : ' class="alternate"';
                    if ($myrow->company != '') {
                        $company = __(' of ', 'eshop') . $myrow->company;
                    } else {
                        $company = '';
                    }
                    $currsymbol = $eshopoptions['currency_symbol'];
                    echo '<tr' . $alt . '>
					<td headers="line" id="numb' . $c . '">' . $myrow->id . '</td>
					<td headers="date numb' . $c . '">' . $thisdate . '</td>
					<td headers="transid numb' . $c . '"><a href="' . $phpself . '&amp;view=' . $myrow->id . '" title="' . __('View complete order details', 'eshop') . '">' . $myrow->transid . '</a></td>
					<td headers="items numb' . $c . '">' . $x . '</td>
					<td headers="price numb' . $c . '" class="right">' . sprintf(__('%1$s%2$s', 'eshop'), $currsymbol, number_format_i18n($total, __('2', 'eshop'))) . '</td>
					<td headers="state numb' . $c . '" class="right">' . $status . '</td>
					</tr>';
                }
            }
            echo "</tbody></table></div>\n";
            //paginate
            echo '<div class="paginate tablenav-pages stuffbox">';
            if ($records != $max) {
                $eecho = $page_links;
            }
            echo sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>', number_format_i18n(($epage - 1) * $records + 1), number_format_i18n(min($epage * $records, $max)), number_format_i18n($max));
            if (isset($eecho)) {
                $thispage = esc_url(add_query_arg('eshopall', 'yes', $_SERVER['REQUEST_URI']));
                echo "<ul class='page-numbers'>\n\t<li>" . join("</li>\n\t<li>", $eecho) . "</li>\n<li>" . '<a href="' . $thispage . '">' . __('View All', 'eshop') . '</a>' . "</li>\n</ul>\n";
            }
            echo '<br /></div>';
            //end
        } else {
            echo '<p class="notice">' . __('There are no orders to display.', 'eshop') . ".</p>";
        }
    }
 function eshop_rtn_order_details($checkid)
 {
     global $wpdb, $eshopoptions;
     $dtable = $wpdb->prefix . 'eshop_orders';
     $itable = $wpdb->prefix . 'eshop_order_items';
     $stable = $wpdb->prefix . 'eshop_states';
     $ctable = $wpdb->prefix . 'eshop_countries';
     $dquery = $wpdb->get_results("Select * From {$dtable} where checkid='{$checkid}' limit 1");
     foreach ($dquery as $drow) {
         $status = $drow->status;
         $checkid = $drow->checkid;
         $custom = $drow->custom_field;
         $transid = $drow->transid;
         $edited = $drow->edited;
         $affiliate = $drow->affiliate;
         $paidvia = $drow->paidvia;
         $dbid = $drow->id;
     }
     if ($status == 'Completed') {
         $status = __('Order Received', 'eshop');
     }
     if ($status == 'Pending' || $status == 'Waiting') {
         $status = __('Pending Payment', 'eshop');
     }
     $contact = $cart = $address = $extras = '';
     $result = $wpdb->get_results("Select * From {$itable} where checkid='{$checkid}' ORDER BY id ASC");
     $total = 0;
     $taxtotal = 0;
     $currsymbol = $eshopoptions['currency_symbol'];
     $cart .= __('Transaction id:', 'eshop') . ' ' . $transid . "\n";
     $containsdownloads = 0;
     $prod_ids = array();
     foreach ($result as $myrow) {
         //default
         if (isset($myrow->post_id) && $myrow->post_id > 0) {
             $prod_ids[] = $myrow->post_id;
         }
         $value = $myrow->item_qty * $myrow->item_amt;
         $shipping_charge = 0;
         $itemid = $myrow->item_id . ' ' . $myrow->optsets;
         // add in a check if postage here as well as a link to the product
         if (trim($itemid) == 'postage' || trim($itemid) == __('Shipping', 'eshop')) {
             $cart .= __('Shipping Charge:', 'eshop') . ' ' . sprintf(__('%1$s%2$s', 'eshop'), $currsymbol, number_format_i18n($value, __('2', 'eshop')));
             if (isset($myrow->tax_amt) && $myrow->tax_amt != '') {
                 $taxvalue = $myrow->tax_amt;
                 $value += $taxvalue;
                 $cart .= "\n" . __('Sales Tax:', 'eshop') . ' ' . sprintf(__('%1$s%2$s', 'eshop'), $currsymbol, number_format_i18n($taxvalue, __('2', 'eshop')));
             }
             $shipping_charge = number_format_i18n($value, __('2', 'eshop'));
             $cart .= "\n\n";
         } else {
             $cart .= $myrow->optname . " " . strip_tags($itemid) . "\n\n" . __('Quantity:', 'eshop') . " " . $myrow->item_qty . "\n" . __('Price:', 'eshop') . " " . sprintf(__('%1$s%2$s', 'eshop'), $currsymbol, number_format_i18n($value, __('2', 'eshop')));
             if (isset($myrow->tax_amt) && $myrow->tax_amt != '') {
                 $taxvalue = $myrow->tax_amt;
                 $value += $taxvalue;
                 $cart .= "\n" . __('Sales Tax:', 'eshop') . ' ' . sprintf(__('%1$s%2$s', 'eshop'), $currsymbol, number_format_i18n($taxvalue, __('2', 'eshop')));
             }
             $cart .= "\n\n";
         }
         if (isset($taxvalue)) {
             $taxtotal += $taxvalue;
         }
         $total += $value;
         //check if downloadable product
         if ($myrow->down_id != '0') {
             $containsdownloads++;
         }
     }
     $arrtotal = number_format_i18n($total, __('2', 'eshop'));
     $arrtaxtotal = number_format_i18n($taxtotal, __('2', 'eshop'));
     $cart .= __('Total', 'eshop') . ' ' . sprintf(__('%1$s%2$s', 'eshop'), $currsymbol, number_format_i18n($total, __('2', 'eshop'))) . "\n";
     $thisdate = eshop_real_date($custom);
     $cart .= "\n" . __('Order placed on', 'eshop') . " " . $thisdate . "\n";
     foreach ($dquery as $drow) {
         $address .= "\n" . __('Mailing Address:', 'eshop') . "\n" . $drow->address1 . ", " . $drow->address2 . "\n";
         $address .= $drow->city . "\n";
         $qcode = $wpdb->escape($drow->state);
         $qstate = $wpdb->get_var("SELECT stateName FROM {$stable} WHERE id='{$qcode}' limit 1");
         if ($qstate == '') {
             $qstate = $drow->state;
         }
         $address .= $qstate . "\n";
         $address .= $drow->zip . "\n";
         $qccode = $wpdb->escape($drow->country);
         $qcountry = $wpdb->get_var("SELECT country FROM {$ctable} WHERE code='{$qccode}' limit 1");
         $address .= $qcountry . "\n";
         $contact .= __('Phone:', 'eshop') . ' ' . $drow->phone . "\n";
         $contact .= __('Email:', 'eshop') . ' ' . $drow->email . "\n";
         if ($drow->ship_name != '' && $drow->ship_address != '' && $drow->ship_city != '' && $drow->ship_postcode != '') {
             $address .= "\n" . __('Shipping Address:', 'eshop') . "\n";
             $address .= $drow->ship_name . "\n";
             $address .= $drow->ship_company . "\n";
             if ($drow->ship_phone != $drow->phone && $drow->ship_phone != '') {
                 $contact .= __('Shipping address phone number:', 'eshop') . "\n" . $drow->ship_phone . "\n";
             }
             $address .= $drow->ship_address . "\n";
             $address .= $drow->ship_city . "\n";
             $qcode = $wpdb->escape($drow->ship_state);
             $sqstate = $wpdb->get_var("SELECT stateName FROM {$stable} WHERE id='{$qcode}' limit 1");
             if ($sqstate == '') {
                 $sqstate = $drow->ship_state;
             }
             $address .= $sqstate . "\n";
             $address .= $drow->ship_postcode . "\n";
             $qccode = $wpdb->escape($drow->ship_country);
             $sqcountry = $wpdb->get_var("SELECT country FROM {$ctable} WHERE code='{$qccode}' limit 1");
             $address .= $sqcountry . "\n";
         }
         if ($drow->thememo != '') {
             $extras .= __('Paypal memo:', 'eshop') . "\n" . $drow->thememo . "\n";
         }
         if ($drow->reference != '') {
             $extras .= __('Reference/PO:', 'eshop') . "\n" . $drow->reference . "\n";
         }
         if ($drow->comments != '') {
             $extras .= __('Order comments:', 'eshop') . "\n" . $drow->comments . "\n";
         }
     }
     if ($drow->company != '') {
         $ename = $drow->first_name . " " . $drow->last_name . ' ' . __('of', 'eshop') . ' ' . $drow->company;
     } else {
         $ename = $drow->first_name . " " . $drow->last_name;
     }
     $user_id = $drow->user_id;
     $firstname = $drow->first_name;
     $eemail = $drow->email;
     $downloads = '';
     if ($containsdownloads > 0) {
         $downtable = $wpdb->prefix . 'eshop_download_orders';
         $chkcode = $wpdb->get_var("SELECT code FROM {$downtable} WHERE checkid='{$drow->checkid}' && email='{$drow->email}'");
         $downloads = get_permalink($eshopoptions['show_downloads']) . "\n";
         $downloads .= __('Email:', 'eshop') . ' ' . $drow->email . "\n";
         $downloads .= __('Code:', 'eshop') . ' ' . $chkcode . "\n";
     }
     $cart = html_entity_decode($cart);
     $extras = html_entity_decode($extras);
     $firstname = html_entity_decode($firstname);
     $ename = html_entity_decode($ename);
     $address = html_entity_decode($address);
     $array = array("status" => $status, "firstname" => $firstname, "ename" => $ename, "eemail" => $eemail, "cart" => $cart, "downloads" => $downloads, "address" => $address, "extras" => $extras, "contact" => $contact, "date" => $edited, "affiliate" => $affiliate, "user_id" => $user_id, "transid" => $transid, "total" => $arrtotal, "taxtotal" => $arrtaxtotal, "dbid" => $dbid, 'shipping_charge' => $shipping_charge, 'prod_ids' => $prod_ids, 'paidvia' => $paidvia);
     $secarray = apply_filters('eshoprtndetails', $dquery);
     $retarray = array_merge($array, $secarray);
     return $retarray;
 }
     $downloadable = $wpdb->get_var("SELECT title FROM {$dltable} WHERE id='{$fileid}'");
 } else {
     $downloadable = __('No', 'eshop');
 }
 // add in a check if postage here as well as a link to the product
 if ($itemid == 'postage') {
     $showit = __('Shipping', 'eshop');
     $thetotal = $total;
 } else {
     $showit = $myrow->optname;
     $thetotal = "";
 }
 $data .= '"' . $drow->id . $delim . eshopcleanit($drow->status) . $delim . eshopcleanit($drow->transid) . $delim;
 $data .= eshopcleanit($showit) . $delim . eshopcleanit($itemid) . $delim . eshopcleanit($downloadable) . $delim . eshopcleanit($myrow->item_qty) . $delim . eshopcleanit($value) . $delim . eshopcleanit($thetotal) . $delim;
 //date
 $thisdate = eshop_real_date($custom);
 $data .= eshopcleanit($thisdate) . $delim;
 $data .= eshopcleanit($drow->first_name) . " " . eshopcleanit($drow->last_name) . $delim . eshopcleanit($drow->company) . $delim . eshopcleanit($drow->phone) . $delim . eshopcleanit($drow->email) . $delim;
 //address
 $theaddress = $drow->address1 . "\n" . $drow->address2;
 if (is_numeric($drow->state)) {
     $qcode = esc_sql($drow->state);
     $qstate = $wpdb->get_var("SELECT stateName FROM {$stable} WHERE id='{$qcode}' limit 1");
     $statezone = $wpdb->get_var("SELECT zone FROM {$stable} WHERE id='{$qcode}' limit 1");
     $thestate = $qstate;
 } else {
     $thestate = $drow->state;
 }
 $qcode = esc_sql($drow->country);
 $qcountry = $wpdb->get_var("SELECT country FROM {$ctable} WHERE code='{$qcode}' limit 1");
 $countryzone = $wpdb->get_var("SELECT zone FROM {$ctable} WHERE code='{$qcode}' limit 1");
Example #4
0
    function displayorders($type, $default)
    {
        global $wpdb, $eshopoptions;
        //these should be global, but it wasn't working *sigh*
        $phpself = esc_url($_SERVER['REQUEST_URI']);
        $dtable = $wpdb->prefix . 'eshop_orders';
        $itable = $wpdb->prefix . 'eshop_order_items';
        if (!isset($_GET['by'])) {
            $_GET['by'] = $default;
        }
        $cda = $cdd = $ctn = $cca = $cna = '';
        if (isset($_GET['by'])) {
            switch ($_GET['by']) {
                case 'dd':
                    //date descending
                    $sortby = 'ORDER BY custom_field DESC';
                    $cdd = ' class="current"';
                    break;
                case 'tn':
                    //transaction id numerically
                    $sortby = 'ORDER BY transid ASC';
                    $ctn = ' class="current"';
                    break;
                case 'na':
                    //name alphabetically (last name)
                    $sortby = 'ORDER BY last_name ASC';
                    $cna = ' class="current"';
                    break;
                case 'ca':
                    //company name alphabetically
                    $sortby = 'ORDER BY company ASC';
                    $cca = ' class="current"';
                    break;
                case 'da':
                    //date ascending
                //date ascending
                default:
                    $sortby = 'ORDER BY custom_field ASC';
                    $cda = ' class="current"';
            }
        } else {
            $cda = ' class="current"';
            $sortby = 'ORDER BY custom_field ASC';
        }
        $max = $wpdb->get_var("SELECT COUNT(id) FROM {$dtable} WHERE id > 0 AND status='{$type}'");
        if ($max > 0) {
            if ($eshopoptions['records'] != '' && is_numeric($eshopoptions['records'])) {
                $records = $eshopoptions['records'];
            } else {
                $records = '10';
            }
            if (isset($_GET['_p']) && is_numeric($_GET['_p'])) {
                $epage = $_GET['_p'];
            } else {
                $epage = '1';
            }
            if (!isset($_GET['eshopall'])) {
                $page_links = paginate_links(array('base' => add_query_arg('_p', '%#%'), 'format' => '', 'total' => ceil($max / $records), 'current' => $epage, 'type' => 'array'));
                $offset = $epage * $records - $records;
            } else {
                $page_links = paginate_links(array('base' => add_query_arg('_p', '%#%'), 'format' => '', 'total' => ceil($max / $records), 'current' => $epage, 'type' => 'array', 'show_all' => true));
                $offset = '0';
                $records = $max;
            }
            //
            $myrowres = $wpdb->get_results("Select * From {$dtable} where status='{$type}' {$sortby} LIMIT {$offset}, {$records}");
            $calt = 0;
            $apge = get_admin_url() . 'admin.php?page=' . $_GET['page'] . '&amp;action=' . $_GET['action'];
            echo '<ul id="eshopsubmenu" class="stuffbox">';
            echo '<li><span>' . __('Sort Orders by &raquo;', 'eshop') . '</span></li>';
            echo '<li><a href="' . $apge . '&amp;by=da"' . $cda . '>' . __('Date Ascending', 'eshop') . '</a></li>';
            echo '<li><a href="' . $apge . '&amp;by=dd"' . $cdd . '>' . __('Date Descending', 'eshop') . '</a></li>';
            echo '<li><a href="' . $apge . '&amp;by=tn"' . $ctn . '>' . __('ID Number', 'eshop') . '</a></li>';
            echo '<li><a href="' . $apge . '&amp;by=ca"' . $cca . '>' . __('Company', 'eshop') . '</a></li>';
            echo '<li><a href="' . $apge . '&amp;by=na"' . $cna . '>' . __('Customer', 'eshop') . '</a></li>';
            echo '</ul>';
            echo "<form id=\"orderstatus\" action=\"" . $phpself . "\" method=\"post\">";
            echo '<div class="orderlist tablecontainer">';
            echo '<table class="hidealllabels widefat" summary="order listing">
			<caption class="offset">' . __('eshop Order Listing', 'eshop') . '</caption>
			<thead>
			<tr>
			<th id="line" title="' . __('reference number', 'eshop') . '">#</th>
			<th id="date">' . __('Date/Time', 'eshop') . '</th>
			<th id="customer">' . __('Customer', 'eshop') . '</th>
			<th id="items">' . __('Items', 'eshop') . '</th>
			<th id="price">' . __('Price', 'eshop') . '</th>
			<th id="downloads">' . __('Contains Downloads', 'eshop') . '</th>
			<th id="transid">' . __('Transaction ID', 'eshop') . '</th>
			<th id="shippingid">' . __('Shipping id', 'eshop') . '</th>
			<th id="bulk"><input type="checkbox" value="" name="checkAllAuto" id="checkAllAuto" /><label for="checkAllAuto">' . __('Bulk', 'eshop') . '</label></th>			
			</tr></thead><tbody>' . "\n";
            $move = array();
            $c = 0;
            foreach ($myrowres as $myrow) {
                //total + products
                $c++;
                //count for the  number of results.
                $checkid = $myrow->checkid;
                if ($myrow->shipid == '') {
                    $myrow->shipid = 'N/A';
                }
                $itemrowres = $wpdb->get_results("Select * From {$itable} where checkid='{$checkid}'");
                $total = 0;
                $x = 0;
                foreach ($itemrowres as $itemrow) {
                    $value = $itemrow->item_qty * $itemrow->item_amt;
                    if ($itemrow->tax_amt !== '' && is_numeric($itemrow->tax_amt)) {
                        $value = $value + $itemrow->tax_amt;
                    }
                    $total = $total + $value;
                    $x++;
                }
                //
                $status = $type;
                //if($x>0){
                $thisdate = eshop_real_date($myrow->custom_field);
                $calt++;
                $alt = $calt % 2 ? '' : ' class="alternate"';
                if ($myrow->company != '') {
                    $company = __(' of ', 'eshop') . $myrow->company;
                } else {
                    $company = '';
                }
                $currsymbol = $eshopoptions['currency_symbol'];
                $ic = $x - 1;
                $userlink = '';
                if (isset($myrow->user_id) && $myrow->user_id != '0') {
                    $userlink = ' (<a href="user-edit.php?user_id=' . $myrow->user_id . '" title="' . esc_attr(sprintf(__('Profile for %1$s', 'eshop'), $myrow->first_name . ' ' . $myrow->last_name)) . '" class="eshop-userlink">*</a>)';
                }
                echo '<tr' . $alt . '>
					<td headers="line" id="numb' . $c . '">' . $myrow->id . '</td>
					<td headers="date numb' . $c . '">' . $thisdate . '</td>
					<td headers="customer numb' . $c . '"><a href="' . $phpself . '&amp;view=' . $myrow->id . '" title="' . __('View complete order details', 'eshop') . '">' . $myrow->first_name . ' ' . $myrow->last_name . $company . '</a>' . $userlink . '</td>
					<td headers="items numb' . $c . '">' . $ic . '</td>
					<td headers="price numb' . $c . '" class="right">' . sprintf(__('%1$s%2$s', 'eshop'), $currsymbol, number_format_i18n($total, __('2', 'eshop'))) . '</td>
					<td headers="downloads numb' . $c . '" class="right">' . $myrow->downloads . '</td>
					<td headers="transid numb' . $c . '">' . $myrow->transid . '</td>' . '<td headers=Shipping id"' . $c . '"><label for="shippingid' . $c . '">Shipping #' . $c . '</label><input type="text" value="' . $myrow->shipid . '" name="shipping[' . $checkid . ']" id="shipping' . $c . '" />' . '<td headers="bulk numb' . $c . '"><label for="move' . $c . '">Move #' . $c . '</label><input type="checkbox" value="' . $checkid . '" name="move[]" id="move' . $c . '" /></td>' . "</td></tr>\n";
                //}
            }
            echo "</tbody></table></div>\n";
            //paginate
            echo '<div class="paginate tablenav-pages stuffbox">';
            if ($records != $max) {
                $eecho = $page_links;
            }
            echo sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>', number_format_i18n(($epage - 1) * $records + 1), number_format_i18n(min($epage * $records, $max)), number_format_i18n($max));
            if (isset($eecho)) {
                $thispage = esc_url(add_query_arg('eshopall', 'yes', $_SERVER['REQUEST_URI']));
                echo "<ul class='page-numbers'>\n\t<li>" . join("</li>\n\t<li>", $eecho) . "</li>\n<li>" . '<a href="' . $thispage . '">' . __('View All', 'eshop') . '</a>' . "</li>\n</ul>\n";
            }
            echo '<br /></div>';
            //end
            //moved order status box
            ?>
				<fieldset id="changestat"><legend><?php 
            _e('Change Orders Status', 'eshop');
            ?>
</legend>
				<p class="submit eshop"><label for="mark"><?php 
            _e('Mark orders as:', 'eshop');
            ?>
</label>
				<select name="mark" id="mark">
				<option value="Sent"><?php 
            _e('Shipped', 'eshop');
            ?>
</option>
				<option value="Completed"><?php 
            _e('Active', 'eshop');
            ?>
</option>
				<option value="Pending"><?php 
            _e('Pending', 'eshop');
            ?>
</option>
				<option value="Waiting"><?php 
            _e('Awaiting Payment', 'eshop');
            ?>
</option>
				<option value="Failed"><?php 
            _e('Failed', 'eshop');
            ?>
</option>
				<option value="Deleted"><?php 
            _e('Deleted', 'eshop');
            ?>
</option>
				</select>
				<input type="hidden" name="action" value="<?php 
            echo $_GET['action'];
            ?>
" />
				<input type="hidden" name="change" value="yes" />
				<input type="submit" id="submit1" name = "changesub" value="<?php 
            _e('Change', 'eshop');
            ?>
" /></p>
				</fieldset>
				<!--order status box code end-->
				<?php 
            if ($_GET['action'] == 'Sent') {
                ?>
				<!--generate invoice-->
				<div class = "submit">
					<fieldset class="dazake">
						<legend><?php 
                _e('Invoice', 'eshop');
                ?>
</legend>
						<input type="hidden" name="action" value="<?php 
                echo $_GET['action'];
                ?>
" />
						<input type="hidden" name="generateinvoice" value="yes" />
						<input type="submit" id="invoice" name="invoicesub" value="<?php 
                _e('Generate', 'eshop');
                ?>
" /></p>
					</fieldset>
				<!--endgenerate invoice-->

				<!--updat shipping id-->
					<fieldset class="dazake">
						<legend><?php 
                _e('Shipping Id', 'eshop');
                ?>
</legend>
						<input type="hidden" name="action" value="<?php 
                echo $_GET['action'];
                ?>
" />
						<input type="hidden" name="shippingid" value="yes" />
						<input type="submit" id="shipping"  name = "shipsub" value="<?php 
                _e('Update', 'eshop');
                ?>
" /></p>
					</fieldset>
				<!--endupdat shipping id-->

				<!--sentemail -->
					<fieldset class="dazake">
						<legend><?php 
                _e('Email', 'eshop');
                ?>
</legend>
						<input type="hidden" name="action" value="<?php 
                echo $_GET['action'];
                ?>
" />
						<input type="hidden" name="sentemail" value="yes" />
						<input type="submit" id="sentemail"  name = "emailsub" value="<?php 
                _e('Send', 'eshop');
                ?>
" /></p>
					</fieldset>
				<!--end sent email-->

				<!--export csv -->
					<fieldset class="dazake">
						<legend><?php 
                _e('Csv', 'eshop');
                ?>
</legend>
						<input type="hidden" name="action" value="<?php 
                echo $_GET['action'];
                ?>
" />
						<input type="hidden" name="csvexport" value="yes" />
						<input type="submit" id="csvexport"  name = "csvsub" value="<?php 
                _e('Generate', 'eshop');
                ?>
" /></p>
					</fieldset>
				<!--end export csv-->
				</div>
				<?php 
            } else {
            }
            ?>
				</form>
			<?php 
            if ($type == 'Deleted') {
                ?>
				<div id="eshopformleft"><form id="ordersdelete" action="<?php 
                echo esc_url($_SERVER['REQUEST_URI']);
                ?>
" method="post">
				<fieldset><legend><?php 
                _e('Complete Order Deletion', 'eshop');
                ?>
</legend>
				<p class="submit eshop"><label for="dhours"><?php 
                _e('Orders that are ', 'eshop');
                ?>
				<select name="dhours" id="dhours">
				<option value="72" selected="selected">72</option>
				<option value="36">48</option>
				<option value="24">24</option>
				<option value="16">16</option>
				<option value="8">8</option>
				<option value="4">4</option>
				<option value="0">0</option>
				</select> <?php 
                _e('hours old', 'eshop');
                ?>
</label>
				<input type="hidden" name="dall" value="yes" />
				<input type="submit" id="submit2" value="Delete" /></p>
				</fieldset></form></div>
			<?php 
            }
        } else {
            if ($type == 'Completed') {
                $disptype = __('Active', 'eshop');
            }
            if ($type == 'Sent') {
                $disptype = __('Shipped', 'eshop');
            }
            if ($type == 'Waiting') {
                $disptype = __('Awaiting Payment', 'eshop');
            }
            if ($type == 'Pending') {
                $disptype = __('Pending', 'eshop');
            }
            if ($type == 'Deleted') {
                $disptype = __('Deleted', 'eshop');
            }
            if ($type == 'Failed') {
                $disptype = __('Failed', 'eshop');
            }
            echo "<p class=\"notice\">";
            printf(__('There are no %s orders.', 'eshop'), "<span>" . __($disptype, 'eshop') . "</span>");
            echo "</p>";
        }
    }