예제 #1
0
function foxyshop_customer_management()
{
    global $foxyshop_settings, $wp_version;
    //Setup Fields and Defaults
    $foxy_data_defaults = array("customer_id_filter" => "", "customer_email_filter" => "", "customer_first_name_filter" => "", "customer_last_name_filter" => "", "customer_state_filter" => "");
    if (version_compare($foxyshop_settings['version'], '0.7.2', ">=")) {
        $foxy_data_defaults["custom_field_name_filter"] = "";
        $foxy_data_defaults["custom_field_value_filter"] = "";
    }
    $foxy_data = wp_parse_args(array("api_action" => "customer_list"), apply_filters('foxyshop_customer_filter_defaults', $foxy_data_defaults));
    $foxyshop_querystring = "?post_type=foxyshop_product&page=foxyshop_customer_management&foxyshop_search=1";
    $foxyshop_hidden_input = "";
    if (isset($_GET['foxyshop_search'])) {
        $fields = array("customer_id_filter", "customer_email_filter", "customer_first_name_filter", "customer_last_name_filter", "customer_state_filter", "custom_field_name_filter", "custom_field_value_filter");
        foreach ($fields as $field) {
            if (isset($_GET[$field])) {
                $foxy_data[$field] = $_GET[$field];
                $foxyshop_querystring .= "&{$field}=" . urlencode($_GET[$field]);
                $foxyshop_hidden_input .= '<input type="hidden" name="' . $field . '" value="' . htmlspecialchars($_GET[$field]) . '" />' . "\n";
            }
        }
        $foxy_data['pagination_start'] = isset($_GET['pagination_start']) ? $_GET['pagination_start'] : 0;
        $p = (int) (version_compare($foxyshop_settings['version'], '0.7.1', "<") ? 50 : FOXYSHOP_API_ENTRIES_PER_PAGE);
        if (version_compare($foxyshop_settings['version'], '0.7.0', ">")) {
            $foxy_data['entries_per_page'] = $p;
        }
        $start_offset = (int) (version_compare($foxyshop_settings['version'], '0.7.1', "<=") ? -1 : 0);
        if (isset($_GET['paged-top']) || isset($_GET['paged-bottom'])) {
            if ($_GET['paged-top'] != $_GET['paged-top-original']) {
                $foxy_data['pagination_start'] = $p * ((int) $_GET['paged-top'] - 1) + 1 + $start_offset;
            }
            if ($_GET['paged-bottom'] != $_GET['paged-bottom-original']) {
                $foxy_data['pagination_start'] = $p * ((int) $_GET['paged-bottom'] - 1) + 1 + $start_offset;
            }
        }
    }
    ?>
	<div class="wrap">
		<div class="icon32" id="icon-users"><br></div>
		<h2><?php 
    _e('Manage Customers', 'foxyshop');
    ?>
</h2>

		<form action="edit.php" method="get" id="foxyshop_searchform" name="foxyshop_searchform" style="display: block; margin: 14px 0 20px 0;">
		<input type="hidden" name="foxyshop_search" value="1" />
		<input type="hidden" name="post_type" value="foxyshop_product" />
		<input type="hidden" name="page" value="foxyshop_customer_management" />

		<table class="widefat">
		<thead><tr><th colspan="2"><img src="<?php 
    echo FOXYSHOP_DIR;
    ?>
/images/search-icon.png" alt="" /><?php 
    _e('Search Options', 'foxyshop');
    ?>
</th></tr></thead>
		<tbody><tr><td>

			<div class="foxyshop_field_control">
				<label for="customer_id_filter"><?php 
    _e('Customer ID', 'foxyshop');
    ?>
</label><input type="text" name="customer_id_filter" id="customer_id_filter" value="<?php 
    echo $foxy_data['customer_id_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="customer_first_name_filter"><?php 
    _e('Customer First Name', 'foxyshop');
    ?>
</label><input type="text" name="customer_first_name_filter" id="customer_first_name_filter" value="<?php 
    echo $foxy_data['customer_first_name_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="customer_last_name_filter"><?php 
    _e('Customer Last Name', 'foxyshop');
    ?>
</label><input type="text" name="customer_last_name_filter" id="customer_last_name_filter" value="<?php 
    echo $foxy_data['customer_last_name_filter'];
    ?>
" />
			</div>
			<?php 
    if (version_compare($foxyshop_settings['version'], '0.7.2', ">=")) {
        ?>
			<div class="foxyshop_field_control">
				<label for="custom_field_name_filter"><?php 
        _e('Custom Field Name', 'foxyshop');
        ?>
</label><input type="text" name="custom_field_name_filter" id="custom_field_name_filter" value="<?php 
        echo $foxy_data['custom_field_name_filter'];
        ?>
" />
				<label for="custom_field_value_filter" style="margin-left: 15px; margin-top: 4px; width: 34px;"><?php 
        _e('Value', 'foxyshop');
        ?>
</label><input type="text" name="custom_field_value_filter" id="custom_field_value_filter" value="<?php 
        echo $foxy_data['custom_field_value_filter'];
        ?>
" />
			</div>
			<?php 
    }
    ?>
		</td><td>
			<div class="foxyshop_field_control">
				<label for="customer_email_filter"><?php 
    _e('Customer Email', 'foxyshop');
    ?>
</label><input type="text" name="customer_email_filter" id="customer_email_filter" value="<?php 
    echo $foxy_data['customer_email_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="customer_state_filter"><?php 
    _e('Customer State', 'foxyshop');
    ?>
</label><input type="text" name="customer_state_filter" id="customer_state_filter" value="<?php 
    echo $foxy_data['customer_state_filter'];
    ?>
" />
			</div>

			<div style="clear: both;"></div>
			<button type="submit" id="foxyshop_search_submit" name="foxyshop_search_submit" class="button-primary" style="clear: left; margin: 10px 0 6px 0;"><?php 
    _e('Search Records Now', 'foxyshop');
    ?>
</button>
			<button type="button" class="button" style="margin-left: 15px; margin-top: 10px;" onclick="document.location.href = 'edit.php?post_type=foxyshop_product&page=foxyshop_customer_management';"><?php 
    _e('Reset Form', 'foxyshop');
    ?>
</button>

		</td></tr></tbody></table>
		</form>

	<?php 
    if (!isset($_GET['foxyshop_search'])) {
        return;
    }
    $foxy_response = foxyshop_get_foxycart_data($foxy_data);
    $xml = simplexml_load_string($foxy_response, NULL, LIBXML_NOCDATA);
    //print_r($foxy_data);
    //echo "<pre>" . substr($foxy_response,1,2000) . "</pre>";
    if ((string) $xml->result == "ERROR") {
        echo '<h3>' . (string) $xml->messages->message . '</h3>';
        return;
    } else {
        ?>

		<form action="edit.php" method="get">
		<input type="hidden" name="foxyshop_search" value="1" />
		<input type="hidden" name="post_type" value="foxyshop_product" />
		<input type="hidden" name="page" value="foxyshop_customer_management" />

		<?php 
        echo $foxyshop_hidden_input;
        foxyshop_api_paging_nav('customers', 'top', $xml, $foxyshop_querystring);
        ?>


		<table cellpadding="0" cellspacing="0" border="0" class="wp-list-table widefat foxyshop-list-table" id="customer_table">
			<thead>
				<tr>
					<th><span><?php 
        _e('Customer ID', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<th><span><?php 
        _e('Last Name', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<th><span><?php 
        _e('First Name', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<th><span><?php 
        _e('Email', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<th><span><?php 
        _e('Orders', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<?php 
        if ($foxyshop_settings['enable_subscriptions']) {
            echo "<th><span>" . __('Subscriptions', 'foxyshop') . "</span><span class=\"sorting-indicator\"></span></th>\n";
        }
        ?>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<th><?php 
        _e('Customer ID', 'foxyshop');
        ?>
</th>
					<th><?php 
        _e('Last Name', 'foxyshop');
        ?>
</th>
					<th><?php 
        _e('First Name', 'foxyshop');
        ?>
</th>
					<th><?php 
        _e('Email', 'foxyshop');
        ?>
</th>
					<th><?php 
        _e('Orders', 'foxyshop');
        ?>
</th>
					<?php 
        if ($foxyshop_settings['enable_subscriptions']) {
            echo "<th>" . __('Subscriptions', 'foxyshop') . "</th>\n";
        }
        ?>
				</tr>
			</tfoot>
			<tbody id="the-list">

		<?php 
        $holder = "";
        foreach ($xml->customers->customer as $customer) {
            $customer_id = (string) $customer->customer_id;
            $customer_first_name = (string) $customer->customer_first_name;
            $customer_last_name = (string) $customer->customer_last_name;
            $customer_email = (string) $customer->customer_email;
            $last_modified_date = (string) $customer->last_modified_date;
            $last_modified_date = date(apply_filters("foxyshop_date_time_format", "Y-m-d H:i"), strtotime($last_modified_date));
            echo '<tr rel="' . $customer_id . '">';
            echo '<td><strong><a href="#" class="view_detail">' . (string) $customer_id . '</a></strong></td>';
            echo '<td>' . (string) $customer_last_name . '</td>';
            echo '<td>' . (string) $customer_first_name . '</td>';
            echo '<td>' . (string) $customer_email . '</td>';
            echo '<td><a href="edit.php?post_type=foxyshop_product&page=foxyshop_order_management&customer_id_filter=' . (string) $customer->customer_id . '&transaction_date_filter_begin=&transaction_date_filter_end=&hide_transaction_filter=&foxyshop_search=1">' . __('Orders', 'foxyshop') . '</a></td>';
            if ($foxyshop_settings['enable_subscriptions']) {
                echo '<td><a href="edit.php?post_type=foxyshop_product&page=foxyshop_subscription_management&customer_id_filter=' . (string) $customer->customer_id . '&start_date_filter_begin=&start_date_filter_end=&&foxyshop_search=1">' . __('Subscriptions', 'foxyshop') . '</a></td>';
            }
            echo '</tr>' . "\n";
            $holder .= '<div class="detail_holder" id="holder_' . $customer_id . '">' . "\n";
            //Customer Details
            $holder .= '<div class="foxyshop_list_col">';
            $holder .= '<h4>' . __('Customer Details', 'foxyshop') . '</h4>';
            $holder .= '<ul>';
            if ((string) $customer->customer_phone != "") {
                $holder .= '<li>' . (string) $customer->customer_phone . '</li>';
            }
            $holder .= '<li><a href="mailto:' . $customer->customer_email . '">' . (string) $customer->customer_email . '</a></li>';
            if ((string) $customer->cc_number != "") {
                $holder .= '<li>' . __('Card', 'foxyshop') . ': ' . (string) $customer->cc_number . '</li>';
            }
            // 0.7.1 and lower
            if ((string) $customer->cc_number_masked != "") {
                $holder .= '<li>' . __('Card', 'foxyshop') . ': ' . (string) $customer->cc_number_masked . '</li>';
            }
            //0.7.2+
            if ((string) $customer->cc_exp_month != "") {
                $holder .= '<li>' . __('Exp', 'foxyshop') . ': ' . (string) $customer->cc_exp_month . '-' . (string) $customer->cc_exp_year . '</li>';
            }
            $holder .= '<li>' . __('Last Modified', 'foxyshop') . ': ' . $last_modified_date . '</li>';
            $holder .= '<li>&nbsp;</li>';
            $holder .= '</ul>';
            $holder .= '</div>';
            //Customer Address
            $holder .= '<div class="foxyshop_list_col">';
            $holder .= '<h4>' . __('Customer Address', 'foxyshop') . '</h4>';
            $holder .= '<ul>';
            $holder .= '<li>' . (string) $customer->customer_first_name . ' ' . (string) $customer->customer_last_name . '</li>';
            if ((string) $customer->customer_company != "") {
                $holder .= '<li>' . (string) $customer->customer_company . '</li>';
            }
            if ((string) $customer->customer_address1 != "") {
                $holder .= '<li>' . (string) $customer->customer_address1 . '</li>';
            }
            if ((string) $customer->customer_address2 != "") {
                $holder .= '<li>' . (string) $customer->customer_address2 . '</li>';
            }
            if ((string) $customer->customer_city != "") {
                $holder .= '<li>' . (string) $customer->customer_city . ', ' . (string) $customer->customer_state . ' ' . (string) $customer->customer_postal_code . '</li>';
            }
            if ((string) $customer->customer_country != "") {
                $holder .= '<li>' . (string) $customer->customer_country . '</li>';
            }
            $holder .= '</ul>';
            $holder .= '</div>';
            //Shipping Addresses (if entered)
            if ((string) $customer->shipping_first_name != "") {
                $holder .= '<div class="foxyshop_list_col">';
                $holder .= '<h4>' . __('Shipping Details', 'foxyshop') . '</h4>';
                $holder .= '<ul>';
                $holder .= '<li>' . (string) $customer->shipping_first_name . ' ' . (string) $customer->shipping_last_name . '</li>';
                if ((string) $customer->shipping_company != "") {
                    $holder .= '<li>' . (string) $customer->shipping_company . '</li>';
                }
                if ((string) $customer->shipping_address1 != "") {
                    $holder .= '<li>' . $customer->shipping_address1 . '</li>';
                }
                if ((string) $customer->shipping_address2 != "") {
                    $holder .= '<li>' . (string) $customer->shipping_address2 . '</li>';
                }
                if ((string) $customer->shipping_city != "") {
                    $holder .= '<li>' . (string) $customer->shipping_city . ', ' . (string) $customer->shipping_state . ' ' . (string) $customer->shipping_postal_code . '</li>';
                }
                if ((string) $customer->shipping_country != "") {
                    $holder .= '<li>' . (string) $customer->shipping_country . '</li>';
                }
                if ((string) $customer->shipping_phone != "") {
                    $holder .= '<li>' . (string) $customer->shipping_phone . '</li>';
                }
                $holder .= '</ul>';
                $holder .= '</div>';
            }
            //Multi-ship Addresses
            foreach ($customer->shipto_addresses->shipto_address as $shipto_address) {
                $holder .= '<div class="foxyshop_list_col">';
                $holder .= '<h4>' . __('Shipping Details', 'foxyshop') . ': ' . $shipto_address->address_name . '</h4>';
                $holder .= '<ul>';
                $holder .= '<li>' . (string) $shipto_address->shipto_first_name . ' ' . (string) $shipto_address->shipto_last_name . '</li>';
                if ((string) $shipto_address->shipto_company != "") {
                    $holder .= '<li>' . (string) $shipto_address->shipto_company . '</li>';
                }
                $holder .= '<li>' . (string) $shipto_address->shipto_address1 . '</li>';
                if ((string) $shipto_address->shipto_address2 != "") {
                    $holder .= '<li>' . (string) $shipto_address->shipto_address2 . '</li>';
                }
                $holder .= '<li>' . (string) $shipto_address->shipto_city . ', ' . (string) $shipto_address->shipto_state . ' ' . (string) $shipto_address->shipto_postal_code . '</li>';
                $holder .= '<li>' . (string) $shipto_address->shipto_country . '</li>';
                if ((string) $shipto_address->shipto_phone != "") {
                    $holder .= '<li>' . (string) $shipto_address->shipto_phone . '</li>';
                }
                $holder .= '</ul>';
                $holder .= '</div>';
            }
            //Custom Attributes
            $holder .= foxyshop_manage_attributes($customer->attributes, $customer_id, "customer");
            $holder .= '<div style="clear: both; height: 20px;"></div>';
            $holder .= "</div>\n";
        }
        echo '</tbody></table>';
        foxyshop_api_paging_nav('customers', 'bottom', $xml, $foxyshop_querystring);
        ?>
		</form>
	<?php 
    }
    ?>

	<div id="details_holder"><?php 
    echo $holder;
    ?>
</div>

	<script type="text/javascript" src="<?php 
    echo FOXYSHOP_DIR;
    ?>
/js/jquery.tablesorter.js"></script>
	<script type="text/javascript">
	jQuery(document).ready(function($){
		$(".foxyshop-list-table thead th").click(function() {
			$("#foxyshop-list-inline .detail_holder").appendTo("#details_holder");
			$("#foxyshop-list-inline").remove();
		});
		$(".foxyshop-list-table").tablesorter({
			'cssDesc': 'asc sorted',
			'cssAsc': 'desc sorted'
		});
		$(".view_detail").click(function() {
			var id = $(this).parents("tr").attr("rel");

			if ($("#foxyshop-list-inline #holder_" + id).length > 0) {
				$("#foxyshop-list-inline .detail_holder").appendTo("#details_holder");
				$("#foxyshop-list-inline").remove();
			} else {
				$("#foxyshop-list-inline .detail_holder").appendTo("#details_holder");
				$("#foxyshop-list-inline").remove();

				$(this).parents("tr").after('<tr id="foxyshop-list-inline"><td colspan="7"></td></tr>');
				$("#holder_"+id).appendTo("#foxyshop-list-inline td");
			}

			return false;
		});


		<?php 
    foxyshop_manage_attributes_jquery('customer');
    ?>

	});
	</script>


	<?php 
    echo '</div>';
}
예제 #2
0
function foxyshop_subscription_management()
{
    global $foxyshop_settings, $wp_version, $product;
    //Setup Fields and Defaults
    $foxy_data_defaults = array("is_active_filter" => "", "frequency_filter" => "", "past_due_amount_filter" => "", "start_date_filter_begin" => date("Y-m-d", strtotime("-10 days")), "start_date_filter_end" => date("Y-m-d"), "next_transaction_date_filter_begin" => "", "next_transaction_date_filter_end" => "", "end_date_filter_begin" => "", "end_date_filter_end" => "", "third_party_id_filter" => "", "last_transaction_id_filter" => "", "customer_id_filter" => "", "customer_email_filter" => "", "customer_first_name_filter" => "", "customer_last_name_filter" => "", "product_code_filter" => "", "product_name_filter" => "", "product_option_name_filter" => "", "product_option_value_filter" => "");
    if (version_compare($foxyshop_settings['version'], '0.7.2', ">=")) {
        $foxy_data_defaults["custom_field_name_filter"] = "";
        $foxy_data_defaults["custom_field_value_filter"] = "";
    }
    $foxy_data = wp_parse_args(array("api_action" => "subscription_list"), apply_filters('foxyshop_subscription_filter_defaults', $foxy_data_defaults));
    $foxyshop_querystring = "?post_type=foxyshop_product&amp;page=foxyshop_subscription_management&amp;foxyshop_search=1";
    $foxyshop_hidden_input = "";
    if (isset($_GET['foxyshop_search']) || !defined('FOXYSHOP_AUTO_API_DISABLED')) {
        $fields = array("is_active_filter", "frequency_filter", "past_due_amount_filter", "start_date_filter_begin", "start_date_filter_end", "next_transaction_date_filter_begin", "next_transaction_date_filter_end", "end_date_filter_begin", "end_date_filter_end", "third_party_id_filter", "last_transaction_id_filter", "customer_id_filter", "customer_email_filter", "customer_first_name_filter", "customer_last_name_filter", "product_code_filter", "product_name_filter", "product_option_name_filter", "product_option_value_filter", "custom_field_name_filter", "custom_field_value_filter");
        foreach ($fields as $field) {
            if (isset($_GET[$field])) {
                $foxy_data[$field] = $_GET[$field];
                $foxyshop_querystring .= "&amp;{$field}=" . urlencode($_GET[$field]);
                $foxyshop_hidden_input .= '<input type="hidden" name="' . $field . '" value="' . htmlspecialchars($_GET[$field]) . '" />' . "\n";
            }
        }
        $foxy_data['pagination_start'] = isset($_GET['pagination_start']) ? $_GET['pagination_start'] : 0;
        $p = (int) (version_compare($foxyshop_settings['version'], '0.7.1', "<") ? 50 : FOXYSHOP_API_ENTRIES_PER_PAGE);
        if (version_compare($foxyshop_settings['version'], '0.7.0', ">")) {
            $foxy_data['entries_per_page'] = $p;
        }
        $start_offset = (int) (version_compare($foxyshop_settings['version'], '0.7.1', "<=") ? -1 : 0);
        if (isset($_GET['paged-top']) || isset($_GET['paged-bottom'])) {
            if ($_GET['paged-top'] != $_GET['paged-top-original']) {
                $foxy_data['pagination_start'] = $p * ((int) $_GET['paged-top'] - 1) + 1 + $start_offset;
            }
            if ($_GET['paged-bottom'] != $_GET['paged-bottom-original']) {
                $foxy_data['pagination_start'] = $p * ((int) $_GET['paged-bottom'] - 1) + 1 + $start_offset;
            }
        }
    }
    $subscription_products = get_posts(array('post_type' => 'foxyshop_product', "meta_key" => "_sub_frequency", "meta_value" => "", 'meta_compare' => '!=', "_sub_frequency", 'numberposts' => -1));
    $subscription_product_array = array();
    foreach ($subscription_products as $subscription_product) {
        $product = foxyshop_setup_product($subscription_product);
        $subscription_product_array[] = array("id" => $product['id'], "name" => $product['name'], "price" => $product['price']);
    }
    ?>

	<div class="wrap">
		<div class="icon32 icon32-posts-page" id="icon-edit-pages"><br></div>
		<h2><?php 
    _e('Manage Subscriptions', 'foxyshop');
    ?>
</h2>

		<form action="edit.php" method="get" id="foxyshop_searchform" name="foxyshop_searchform" style="display: block; margin: 14px 0 20px 0;">
		<input type="hidden" name="foxyshop_search" value="1" />
		<input type="hidden" name="post_type" value="foxyshop_product" />
		<input type="hidden" name="page" value="foxyshop_subscription_management" />

		<table class="widefat">
		<thead><tr><th colspan="2"><img src="<?php 
    echo FOXYSHOP_DIR;
    ?>
/images/search-icon.png" alt="" /><?php 
    _e('Search Options', 'foxyshop');
    ?>
</th></tr></thead>
		<tbody><tr><td>
			<div class="foxyshop_field_control">
				<label for="is_active_filter"><?php 
    _e('Subscription Type', 'foxyshop');
    ?>
</label>
				<select name="is_active_filter" id="is_active_filter">
				<?php 
    $selectArray = array("0" => __("Disabled", 'foxyshop'), "1" => __("Active", 'foxyshop'), "" => __("Both", 'foxyshop'));
    foreach ($selectArray as $selectKey => $selectOption) {
        echo '<option value="' . $selectKey . '"' . ($foxy_data['is_active_filter'] == $selectKey ? ' selected="selected"' : '') . '>' . $selectOption . '</option>' . "\n";
    }
    ?>
				</select>
			</div>
			<div class="foxyshop_field_control">
				<label for="past_due_amount_filter"><?php 
    _e('Past Due Status', 'foxyshop');
    ?>
</label>
				<select name="past_due_amount_filter" id="past_due_amount_filter">
				<?php 
    $selectArray = array("" => __('Show All', 'foxyshop'), "1" => __('Show Past Due Only', 'foxyshop'));
    foreach ($selectArray as $selectKey => $selectOption) {
        echo '<option value="' . $selectKey . '"' . ($foxy_data['past_due_amount_filter'] == $selectKey ? ' selected="selected"' : '') . '>' . $selectOption . '</option>' . "\n";
    }
    ?>
				</select>
			</div>
			<div class="foxyshop_field_control">
				<label for="frequency_filter"><?php 
    _e('Frequency', 'foxyshop');
    ?>
</label><input type="text" name="frequency_filter" id="frequency_filter" value="<?php 
    echo $foxy_data['frequency_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="third_party_id_filter"><?php 
    _e('Third Party ID', 'foxyshop');
    ?>
</label><input type="text" name="third_party_id_filter" id="third_party_id_filter" value="<?php 
    echo $foxy_data['third_party_id_filter'];
    ?>
" />
				<span>PayPal</span>
			</div>
			<div class="foxyshop_field_control">
				<label for="last_transaction_id_filter"><?php 
    _e('Last Transaction ID', 'foxyshop');
    ?>
</label><input type="text" name="last_transaction_id_filter" id="last_transaction_id_filter" value="<?php 
    echo $foxy_data['last_transaction_id_filter'];
    ?>
" />
			</div>

			<div class="foxyshop_field_control">
				<label for="product_code_filter"><?php 
    echo FOXYSHOP_PRODUCT_NAME_SINGULAR . ' ' . __('Code', 'foxyshop');
    ?>
</label><input type="text" name="product_code_filter" id="product_code_filter" value="<?php 
    echo $foxy_data['product_code_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="product_name_filter"><?php 
    echo FOXYSHOP_PRODUCT_NAME_SINGULAR . ' ' . __('Name', 'foxyshop');
    ?>
</label><input type="text" name="product_name_filter" id="product_name_filter" value="<?php 
    echo $foxy_data['product_name_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="product_option_name_filter"><?php 
    echo FOXYSHOP_PRODUCT_NAME_SINGULAR . ' ' . __('Option Name', 'foxyshop');
    ?>
</label><input type="text" name="product_option_name_filter" id="product_option_name_filter" value="<?php 
    echo $foxy_data['product_option_name_filter'];
    ?>
" />
				<label for="product_option_value_filter" style="margin-left: 15px; margin-top: 4px; width: 38px;"><?php 
    _e('Value', 'foxyshop');
    ?>
</label><input type="text" name="product_option_value_filter" id="product_option_value_filter" value="<?php 
    echo $foxy_data['product_option_value_filter'];
    ?>
" />
			</div>
			<?php 
    if (version_compare($foxyshop_settings['version'], '0.7.2', ">=")) {
        ?>
			<div class="foxyshop_field_control">
				<label for="custom_field_name_filter"><?php 
        _e('Custom Field Name', 'foxyshop');
        ?>
</label><input type="text" name="custom_field_name_filter" id="custom_field_name_filter" value="<?php 
        echo $foxy_data['custom_field_name_filter'];
        ?>
" />
				<label for="custom_field_value_filter" style="margin-left: 15px; margin-top: 4px; width: 38px;"><?php 
        _e('Value', 'foxyshop');
        ?>
</label><input type="text" name="custom_field_value_filter" id="custom_field_value_filter" value="<?php 
        echo $foxy_data['custom_field_value_filter'];
        ?>
" />
			</div>
			<?php 
    }
    ?>

		</td><td>

			<div class="foxyshop_field_control">
				<label for="start_date_filter_begin"><?php 
    _e('Start Date', 'foxyshop');
    ?>
</label>
				<input type="text" name="start_date_filter_begin" id="start_date_filter_begin" value="<?php 
    echo $foxy_data['start_date_filter_begin'];
    ?>
" class="foxyshop_date_field" />
				<span><?php 
    _e('to', 'foxyshop');
    ?>
</span>
				<input type="text" name="start_date_filter_end" id="start_date_filter_end" value="<?php 
    echo $foxy_data['start_date_filter_end'];
    ?>
" class="foxyshop_date_field" />
			</div>
			<div class="foxyshop_field_control">
				<label for="next_transaction_date_filter_begin"><?php 
    _e('Next Transaction Date', 'foxyshop');
    ?>
</label>
				<input type="text" name="next_transaction_date_filter_begin" id="next_transaction_date_filter_begin" value="<?php 
    echo $foxy_data['next_transaction_date_filter_begin'];
    ?>
" class="foxyshop_date_field" />
				<span><?php 
    _e('to', 'foxyshop');
    ?>
</span>
				<input type="text" name="next_transaction_date_filter_end" id="next_transaction_date_filter_end" value="<?php 
    echo $foxy_data['next_transaction_date_filter_end'];
    ?>
" class="foxyshop_date_field" />
			</div>
			<div class="foxyshop_field_control">
				<label for="end_date_filter_begin"><?php 
    _e('End Date', 'foxyshop');
    ?>
</label>
				<input type="text" name="end_date_filter_begin" id="end_date_filter_begin" value="<?php 
    echo $foxy_data['end_date_filter_begin'];
    ?>
" class="foxyshop_date_field" />
				<span><?php 
    _e('to', 'foxyshop');
    ?>
</span>
				<input type="text" name="end_date_filter_end" id="end_date_filter_end" value="<?php 
    echo $foxy_data['end_date_filter_end'];
    ?>
" class="foxyshop_date_field" />
			</div>

			<div class="foxyshop_field_control">
				<label for="customer_id_filter"><?php 
    _e('Customer ID', 'foxyshop');
    ?>
</label><input type="text" name="customer_id_filter" id="customer_id_filter" value="<?php 
    echo $foxy_data['customer_id_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="customer_email_filter"><?php 
    _e('Customer Email', 'foxyshop');
    ?>
</label><input type="text" name="customer_email_filter" id="customer_email_filter" value="<?php 
    echo $foxy_data['customer_email_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="customer_first_name_filter"><?php 
    _e('Customer First Name', 'foxyshop');
    ?>
</label><input type="text" name="customer_first_name_filter" id="customer_first_name_filter" value="<?php 
    echo $foxy_data['customer_first_name_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="customer_last_name_filter"><?php 
    _e('Customer Last Name', 'foxyshop');
    ?>
</label><input type="text" name="customer_last_name_filter" id="customer_last_name_filter" value="<?php 
    echo $foxy_data['customer_last_name_filter'];
    ?>
" />
			</div>

			<div style="clear: both;"></div>
			<button type="submit" id="foxyshop_search_submit" name="foxyshop_search_submit" class="button-primary" style="clear: both; margin-top: 10px;"><?php 
    _e('Search Records Now', 'foxyshop');
    ?>
</button>
			<button type="button" class="button" style="margin-left: 15px; margin-top: 10px;" onclick="document.location.href = 'edit.php?post_type=foxyshop_product&page=foxyshop_subscription_management';"><?php 
    _e('Reset Form', 'foxyshop');
    ?>
</button>

		</td></tr></tbody></table>


		</form>
		<script type="text/javascript" charset="utf-8">
		jQuery(document).ready(function($) {
			$(".foxyshop_date_field").datepicker({ dateFormat: 'yy-mm-dd' });
		});
		</script>

	<?php 
    if (!isset($_GET['foxyshop_search']) && defined('FOXYSHOP_AUTO_API_DISABLED')) {
        return;
    }
    $foxy_response = foxyshop_get_foxycart_data($foxy_data);
    $xml = simplexml_load_string($foxy_response, NULL, LIBXML_NOCDATA);
    if ((string) $xml->result == __('ERROR', 'foxyshop')) {
        echo '<h3>' . (string) $xml->messages->message . '</h3>';
        return;
    } else {
        ?>



		<form action="edit.php" method="get">
		<input type="hidden" name="foxyshop_search" value="1" />
		<input type="hidden" name="post_type" value="foxyshop_product" />
		<input type="hidden" name="page" value="foxyshop_subscription_management" />

		<?php 
        echo $foxyshop_hidden_input;
        foxyshop_api_paging_nav('subscriptions', 'top', $xml, $foxyshop_querystring);
        ?>

		<table cellpadding="0" cellspacing="0" border="0" class="wp-list-table widefat foxyshop-list-table" id="subscription_table">
			<thead>
				<tr>
					<th><span><?php 
        _e('Customer', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<th><span><?php 
        _e('Start Date', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<th><span><?php 
        _e('Next Date', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<th><span><?php 
        _e('End Date', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<th><span><?php 
        _e('Past Due', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<th><span><?php 
        _e('Details', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<th><span><?php 
        _e('Frequency', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<th><?php 
        _e('Customer', 'foxyshop');
        ?>
</th>
					<th><?php 
        _e('Start Date', 'foxyshop');
        ?>
</th>
					<th><?php 
        _e('Next Date', 'foxyshop');
        ?>
</th>
					<th><?php 
        _e('End Date', 'foxyshop');
        ?>
</th>
					<th><?php 
        _e('Past Due', 'foxyshop');
        ?>
</th>
					<th><?php 
        _e('Details', 'foxyshop');
        ?>
</th>
					<th><?php 
        _e('Frequency', 'foxyshop');
        ?>
</th>
				</tr>
			</tfoot>
			<tbody id="the-list">

		<?php 
        $holder = "";
        foreach ($xml->subscriptions->subscription as $subscription) {
            $sub_token = (string) $subscription->sub_token;
            $customer_id = (string) $subscription->customer_id;
            $customer_first_name = (string) $subscription->customer_first_name;
            $customer_last_name = (string) $subscription->customer_last_name;
            $start_date = (string) $subscription->start_date;
            $next_transaction_date = (string) $subscription->next_transaction_date;
            $end_date = (string) $subscription->end_date;
            $frequency = (string) $subscription->frequency;
            $past_due_amount = (string) $subscription->past_due_amount;
            $is_active = (string) $subscription->is_active;
            $product_name = "";
            if (version_compare($foxyshop_settings['version'], '0.7.0', ">")) {
                foreach ($subscription->transaction_template->transaction_details->transaction_detail as $transaction_detail) {
                    if ($product_name) {
                        $product_name .= "<br />";
                    }
                    $product_price = (double) $transaction_detail->product_price;
                    foreach ($transaction_detail->transaction_detail_options->transaction_detail_option as $transaction_detail_option) {
                        $product_price += (double) $transaction_detail_option->price_mod;
                    }
                    $product_name .= (string) $transaction_detail->product_name . ' ' . foxyshop_currency($product_price);
                }
            } else {
                // The 0.7.0 code had an extra transaction_template node which was removed in subsequent versions
                foreach ($subscription->transaction_template->transaction_template->transaction_details->transaction_detail as $transaction_detail) {
                    if ($product_name) {
                        $product_name .= "<br />";
                    }
                    $product_price = (double) $transaction_detail->product_price;
                    foreach ($transaction_detail->transaction_detail_options->transaction_detail_option as $transaction_detail_option) {
                        $product_price += (double) $transaction_detail_option->price_mod;
                    }
                    $product_name .= (string) $transaction_detail->product_name . ' ' . foxyshop_currency($product_price);
                }
            }
            if ($customer_first_name != "") {
                $customer_name = $customer_last_name . ', ' . $customer_first_name;
            } else {
                $customer_name = $customer_id;
            }
            echo '<tr rel="' . $sub_token . '">';
            echo '<td class="customer_name">';
            echo '<strong' . ($is_active == "0" ? ' class="strikethrough"' : '') . '><a href="#" class="view_detail">' . $customer_name . '</a></strong>';
            echo '<div class="row-actions">';
            echo '<span class="edit"><a title="' . __('Edit') . '" href="#" class="view_detail">' . __('Edit') . '</a> | </span>';
            echo '<span class="view_customer"><a href="edit.php?post_type=foxyshop_product&page=foxyshop_customer_management&customer_id_filter=' . $customer_id . '&foxyshop_search=1" title="' . __('Customer') . '">' . __('Customer') . '</a></span>';
            do_action('foxyshop_subscription_action_line', $subscription);
            echo '</div>';
            echo '</td>';
            echo '<td class="start_date">' . $start_date . '</td>';
            echo '<td class="next_transaction_date">' . $next_transaction_date . '</td>';
            echo '<td class="end_date">' . $end_date . '</td>';
            echo '<td class="past_due_amount">' . $past_due_amount . '</td>';
            echo '<td class="product_description">' . $product_name . '</td>';
            echo '<td class="frequency">' . $frequency . '</td>';
            echo "</tr>\n";
            $holder .= '<div class="detail_holder" id="holder_' . $sub_token . '">' . "\n";
            $holder .= '<form class="subscription_update_form" name="subscription_update_form_' . $sub_token . '" id="subscription_update_form_' . $sub_token . '" onsubmit="return false;">' . "\n";
            $holder .= '<div class="foxyshop_field_control">' . "\n";
            $holder .= '<label>' . __('Subscription Status', 'foxyshop') . '</label>' . "\n";
            $holder .= '<input type="radio" name="is_active" id="is_active_1_' . $sub_token . '" value="1"' . ($is_active == "1" ? ' checked="checked"' : '') . ' style="float: left; margin-top: 7px;" />' . "\n";
            $holder .= '<label for="is_active_1_' . $sub_token . '" style="width: 55px;">' . __('Active', 'foxyshop') . '</label>' . "\n";
            $holder .= '<input type="radio" name="is_active" id="is_active_0_' . $sub_token . '" value="0"' . ($is_active == "0" ? ' checked="checked"' : '') . ' style="float: left; margin-top: 7px;" />' . "\n";
            $holder .= '<label for="is_active_0_' . $sub_token . '">' . __('In-active', 'foxyshop') . '</label>' . "\n";
            $holder .= '</div>' . "\n";
            $holder .= '<div class="foxyshop_field_control">' . "\n";
            $holder .= '<label for="start_date_' . $sub_token . '">' . __('Start Date', 'foxyshop') . '</label>' . "\n";
            $holder .= '<input type="text" name="start_date" id="start_date_' . $sub_token . '" class="foxyshop_date_field" value="' . (string) $subscription->start_date . '" /><span>(YYYY-MM-DD)</span>' . "\n";
            $holder .= '</div>' . "\n";
            $holder .= '<div class="foxyshop_field_control">' . "\n";
            $holder .= '<label for="next_transaction_date_' . $sub_token . '">' . __('Next Transaction Date', 'foxyshop') . '</label>' . "\n";
            $holder .= '<input type="text" name="next_transaction_date" id="next_transaction_date_' . $sub_token . '" value="' . (string) $subscription->next_transaction_date . '" class="foxyshop_date_field" /><span>(YYYY-MM-DD)</span>' . "\n";
            $holder .= '</div>' . "\n";
            $holder .= '<div class="foxyshop_field_control">' . "\n";
            $holder .= '<label for="end_date_' . $sub_token . '">' . __('End Date', 'foxyshop') . '</label>' . "\n";
            $holder .= '<input type="text" name="end_date" id="end_date_' . $sub_token . '" value="' . $end_date . '" class="foxyshop_date_field" /><span>(YYYY-MM-DD)</span> <a href="#" onclick="jQuery(\'#end_date_' . $sub_token . '\').val(\'0000-00-00\'); this.blur(); return false;" class="button" style="margin: 5px 0 0 5px; float: left;">Never</a> <a href="#" onclick="jQuery(\'#end_date_' . $sub_token . '\').val(\'' . date("Y-m-d", strtotime("+1 day")) . '\'); this.blur(); return false;" class="button" style="margin: 5px 0 0 5px; float: left;">Tomorrow</a>' . "\n";
            $holder .= '</div>' . "\n";
            $holder .= '<div class="foxyshop_field_control">' . "\n";
            $holder .= '<label for="frequency_' . $sub_token . '">' . __('Frequency', 'foxyshop') . '</label>' . "\n";
            $holder .= '<input type="text" name="frequency" id="frequency_' . $sub_token . '" value="' . $frequency . '" /><span>(60d, 2w, 1m, 1y, .5m)</span>' . "\n";
            $holder .= '</div>' . "\n";
            $holder .= '<div class="foxyshop_field_control">' . "\n";
            $holder .= '<label for="past_due_amount_' . $sub_token . '">' . __('Past Due Amount', 'foxyshop') . '</label>' . "\n";
            $holder .= '<input type="text" name="past_due_amount" id="past_due_amount_' . $sub_token . '" value="' . $past_due_amount . '" onblur="foxyshop_check_number(this);" /><span>(0.00)</span>' . "\n";
            $holder .= '</div>' . "\n";
            $holder .= '<div class="foxyshop_field_control">' . "\n";
            $holder .= '<label for="update_url_' . $sub_token . '">' . __('Update URL', 'foxyshop') . '</label>' . "\n";
            $holder .= '<input type="text" name="update_url" id="update_url_' . $sub_token . '" value="https://' . $foxyshop_settings['domain'] . '/cart?sub_token=' . $sub_token . '&amp;empty=true&amp;cart=checkout" style="width: 390px;" onclick="this.select();" />' . "\n";
            $holder .= '</div>' . "\n";
            $holder .= '<div class="foxyshop_field_control">' . "\n";
            $holder .= '<label for="cancel_url_' . $sub_token . '">' . __('Cancellation URL', 'foxyshop') . '</label>' . "\n";
            $holder .= '<input type="text" name="cancel_url" id="cancel_url_' . $sub_token . '" value="https://' . $foxyshop_settings['domain'] . '/cart?sub_token=' . $sub_token . '&amp;empty=true&amp;cart=checkout&amp;sub_cancel=true" style="width: 390px;" onclick="this.select();" />' . "\n";
            $holder .= '</div>' . "\n";
            $holder .= '<div class="foxyshop_field_control">' . "\n";
            $holder .= '<label for="transaction_template_id_' . $sub_token . '">' . __('Transaction Template') . '</label>' . "\n";
            $holder .= '<select name="transaction_template_id" id="transaction_template_id_' . $sub_token . '">' . "\n";
            $holder .= '<option value="0">- - ' . __('Select Option Below', 'foxyshop') . ' - -</option>' . "\n";
            foreach ($subscription_product_array as $key => $val) {
                $holder .= '<option value="' . $val['id'] . '">' . $val['name'] . ' ' . foxyshop_currency($val['price']) . '</option>' . "\n";
            }
            $holder .= '</select>' . "\n";
            $holder .= '</div>' . "\n";
            $holder .= '<p style="padding-top: 5px; clear: both"><a href="#" class="subscription_save button-primary">' . __('Save Changes', 'foxyshop') . '</a> <a href="#" class="detail_close button">' . __('Cancel', 'foxyshop') . '</a></p>' . "\n";
            $holder .= '<input type="hidden" name="sub_token" value="' . $sub_token . '" />' . "\n";
            $holder .= '<input type="hidden" name="action" value="foxyshop_display_list_ajax_action" />' . "\n";
            $holder .= '<input type="hidden" name="foxyshop_action" value="subscription_modify" />' . "\n";
            $holder .= '<input type="hidden" name="security" value="' . wp_create_nonce("foxyshop-display-list-function") . '" />' . "\n";
            //Custom Attributes
            $holder .= foxyshop_manage_attributes($subscription->attributes, $sub_token, "subscription");
            $holder .= '</form>' . "\n";
            $holder .= '</div>' . "\n";
        }
        ?>
		</tbody>
		</table>

		<?php 
        foxyshop_api_paging_nav('subscriptions', 'bottom', $xml, $foxyshop_querystring);
        ?>
		</form>
	<?php 
    }
    ?>

	<div id="details_holder"><?php 
    echo $holder;
    ?>
</div>

	<script type="text/javascript" src="<?php 
    echo FOXYSHOP_DIR;
    ?>
/js/jquery.tablesorter.js"></script>
	<script type="text/javascript">
	jQuery(document).ready(function($){
		$(".foxyshop-list-table thead th").click(function() {
			$("#foxyshop-list-inline .detail_holder").appendTo("#details_holder");
			$("#foxyshop-list-inline").remove();
		});
		$(".foxyshop-list-table").tablesorter({
			'cssDesc': 'asc sorted',
			'cssAsc': 'desc sorted'
		});
		$(".view_detail").click(function() {
			var id = $(this).parents("tr").attr("rel");

			if ($("#foxyshop-list-inline #holder_" + id).length > 0) {
				$("#foxyshop-list-inline .detail_holder").appendTo("#details_holder");
				$("#foxyshop-list-inline").remove();
			} else {
				$("#details_holder select").prop('selectedIndex', 0);
				$("#foxyshop-list-inline .detail_holder").appendTo("#details_holder");
				$("#foxyshop-list-inline").remove();

				$(this).parents("tr").after('<tr id="foxyshop-list-inline"><td colspan="7"></td></tr>');
				$("#holder_"+id).appendTo("#foxyshop-list-inline td");
			}

			return false;
		});
		$(".detail_close").click(function() {
			$("#foxyshop-list-inline .detail_holder").appendTo("#details_holder");
			$("#foxyshop-list-inline").remove();
			return false;
		});
		$(".subscription_save").click(function() {
			var id = $(this).parents("form").children("input[name='sub_token']").val();
			$.post(ajaxurl, $(this).parents("form").serialize(), function(response) {

				$("#foxyshop-list-inline .detail_holder").appendTo("#details_holder");
				$("#foxyshop-list-inline").remove();

				if (response.indexOf("ERROR") < 0) {
					$("tr[rel='" + id + "']").css("background-color", "#FFFFE0").delay(500).animate({ backgroundColor: 'transparent' }, 500);
					if ($("#is_active_0_" + id).is(":checked")) {
						$("tr[rel='" + id + "'] td.customer_name strong").addClass("strikethrough");
					} else {
						$("tr[rel='" + id + "'] td.customer_name strong").removeClass("strikethrough");
					}
					$("tr[rel='" + id + "'] td.start_date").text($("#start_date" + id).val());
					$("tr[rel='" + id + "'] td.next_transaction_date").text($("#next_transaction_date_" + id).val());
					$("tr[rel='" + id + "'] td.end_date").text($("#end_date_" + id).val());
					$("tr[rel='" + id + "'] td.past_due_amount").text($("#past_due_amount_" + id).val());
					$("tr[rel='" + id + "'] td.frequency").text($("#frequency_" + id).val());
					if ($("#transaction_template_id_" + id).prop("selectedIndex") > 0) {
						$("tr[rel='" + id + "'] td.product_description").text($("#transaction_template_id_" + id + " option:selected").text());
					}
				} else {
					alert(response);
				}
			});
			return false;
		});

		<?php 
    foxyshop_manage_attributes_jquery('subscription');
    ?>

	});

	function foxyshop_format_number(num) { num = num.toString().replace(/\$|\,/g,''); if(isNaN(num)) num = "0"; sign = (num == (num = Math.abs(num))); num = Math.floor(num*100+0.50000000001); cents = num%100; num = Math.floor(num/100).toString(); if(cents<10) cents = "0" + cents; for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3)); return (((sign)?'':'-') + num + '.' + cents); }
	function foxyshop_check_number(el) { el.value = foxyshop_format_number(el.value); }

	</script>
	<?php 
    echo '</div>';
}
예제 #3
0
function foxyshop_order_management()
{
    global $foxyshop_settings, $wp_version;
    //Setup Fields and Defaults
    $foxy_data_defaults = array("is_test_filter" => "0", "hide_transaction_filter" => "0", "data_is_fed_filter" => "", "id_filter" => "", "order_total_filter" => "", "coupon_code_filter" => "", "transaction_date_filter_begin" => date("Y-m-d", strtotime("-10 days")), "transaction_date_filter_end" => date("Y-m-d"), "customer_id_filter" => "", "customer_email_filter" => "", "customer_first_name_filter" => "", "customer_last_name_filter" => "", "customer_state_filter" => "", "shipping_state_filter" => "", "customer_ip_filter" => "", "product_code_filter" => "", "product_name_filter" => "", "product_option_name_filter" => "", "product_option_value_filter" => "");
    if (version_compare($foxyshop_settings['version'], '0.7.2', ">=")) {
        $foxy_data_defaults["custom_field_name_filter"] = "";
        $foxy_data_defaults["custom_field_value_filter"] = "";
    }
    $foxy_data = wp_parse_args(array("api_action" => "transaction_list"), apply_filters('foxyshop_transaction_filter_defaults', $foxy_data_defaults));
    $foxyshop_querystring = "?post_type=foxyshop_product&amp;page=foxyshop_order_management&amp;foxyshop_search=1";
    $foxyshop_hidden_input = "";
    if (isset($_GET['foxyshop_search']) || !defined('FOXYSHOP_AUTO_API_DISABLED')) {
        $fields = array("is_test_filter", "hide_transaction_filter", "data_is_fed_filter", "id_filter", "order_total_filter", "coupon_code_filter", "transaction_date_filter_begin", "transaction_date_filter_end", "customer_id_filter", "customer_email_filter", "customer_first_name_filter", "customer_last_name_filter", "customer_state_filter", "shipping_state_filter", "customer_ip_filter", "product_code_filter", "product_name_filter", "product_option_name_filter", "product_option_value_filter", "custom_field_name_filter", "custom_field_value_filter");
        foreach ($fields as $field) {
            if (isset($_GET[$field])) {
                $foxy_data[$field] = $_GET[$field];
                $foxyshop_querystring .= "&amp;{$field}=" . urlencode($_GET[$field]);
                $foxyshop_hidden_input .= '<input type="hidden" name="' . $field . '" value="' . htmlspecialchars($_GET[$field]) . '" />' . "\n";
            }
        }
        $foxy_data['pagination_start'] = isset($_GET['pagination_start']) ? $_GET['pagination_start'] : 0;
        $p = (int) (version_compare($foxyshop_settings['version'], '0.7.1', "<") ? 50 : FOXYSHOP_API_ENTRIES_PER_PAGE);
        if (version_compare($foxyshop_settings['version'], '0.7.0', ">")) {
            $foxy_data['entries_per_page'] = $p;
        }
        $start_offset = (int) (version_compare($foxyshop_settings['version'], '0.7.1', "<=") ? -1 : 0);
        if (isset($_GET['paged-top']) || isset($_GET['paged-bottom'])) {
            if ($_GET['paged-top'] != $_GET['paged-top-original']) {
                $foxy_data['pagination_start'] = $p * ((int) $_GET['paged-top'] - 1) + 1 + $start_offset;
            }
            if ($_GET['paged-bottom'] != $_GET['paged-bottom-original']) {
                $foxy_data['pagination_start'] = $p * ((int) $_GET['paged-bottom'] - 1) + 1 + $start_offset;
            }
        }
    }
    $transaction_search_type = isset($_GET['transaction_search_type']) ? $_GET['transaction_search_type'] : '';
    if ($foxyshop_settings["orderdesk_url"]) {
        $orderdesk_link = ' <a class="' . (version_compare(get_bloginfo('version'), '3.2', "<") ? "button " : '') . 'add-new-h2" href="https://app.orderdesk.me/" target="_blank">' . __('Launch Order Desk', 'foxyshop') . '</a>';
    } else {
        $orderdesk_link = "";
    }
    ?>

	<div class="wrap">
		<div class="icon32 icon32-posts-page" id="icon-edit-pages"><br></div>
		<h2><?php 
    _e('Manage Orders', 'foxyshop');
    echo $orderdesk_link;
    ?>
</h2>


		<form action="edit.php" method="get" id="foxyshop_searchform" name="foxyshop_searchform" style="display: block; margin: 14px 0 20px 0;">
		<input type="hidden" name="foxyshop_search" value="1" />
		<input type="hidden" name="post_type" value="foxyshop_product" />
		<input type="hidden" name="page" value="foxyshop_order_management" />

		<table class="widefat">
		<thead><tr><th colspan="2"><img src="<?php 
    echo FOXYSHOP_DIR;
    ?>
/images/search-icon.png" alt="" /><?php 
    _e('Search Options', 'foxyshop');
    ?>
</th></tr></thead>
		<tbody><tr><td>

			<div class="foxyshop_field_control foxyshop_radio_label_container">
				<label><?php 
    _e('Transaction Status', 'foxyshop');
    ?>
</label>

				<input type="radio" id="hide_transaction_filter0" name="hide_transaction_filter" value="0"<?php 
    echo $foxy_data['hide_transaction_filter'] == 0 ? ' checked="checked"' : '';
    ?>
 />
				<label for="hide_transaction_filter0"><?php 
    _e('Unfilled', 'foxyshop');
    ?>
</label>

				<input type="radio" id="hide_transaction_filter1" name="hide_transaction_filter" value="1"<?php 
    echo $foxy_data['hide_transaction_filter'] == 1 ? ' checked="checked"' : '';
    ?>
 />
				<label for="hide_transaction_filter1"><?php 
    _e('Filled', 'foxyshop');
    ?>
</label>

				<input type="radio" id="hide_transaction_filter" name="hide_transaction_filter" value=""<?php 
    echo $foxy_data['hide_transaction_filter'] == '' ? ' checked="checked"' : '';
    ?>
 />
				<label for="hide_transaction_filter"><?php 
    _e('Both', 'foxyshop');
    ?>
</label>
			</div>

			<div class="foxyshop_field_control foxyshop_radio_label_container">
				<label><?php 
    _e('Datafeed Status', 'foxyshop');
    ?>
</label>

				<input type="radio" id="data_is_fed_filter0" name="data_is_fed_filter" value="0"<?php 
    echo $foxy_data['data_is_fed_filter'] == 0 ? ' checked="checked"' : '';
    ?>
 />
				<label for="data_is_fed_filter0"><?php 
    _e('Fed', 'foxyshop');
    ?>
</label>

				<input type="radio" id="data_is_fed_filter1" name="data_is_fed_filter" value="1"<?php 
    echo $foxy_data['data_is_fed_filter'] == 1 ? ' checked="checked"' : '';
    ?>
 />
				<label for="data_is_fed_filter1"><?php 
    _e('Unfed', 'foxyshop');
    ?>
</label>

				<input type="radio" id="data_is_fed_filter" name="data_is_fed_filter" value=""<?php 
    echo $foxy_data['data_is_fed_filter'] == '' ? ' checked="checked"' : '';
    ?>
 />
				<label for="data_is_fed_filter"><?php 
    _e('Both', 'foxyshop');
    ?>
</label>
			</div>

			<div class="foxyshop_field_control foxyshop_radio_label_container">
				<label><?php 
    _e('Test Transactions', 'foxyshop');
    ?>
</label>

				<input type="radio" id="is_test_filter0" name="is_test_filter" value="0"<?php 
    echo $foxy_data['is_test_filter'] == 0 ? ' checked="checked"' : '';
    ?>
 />
				<label for="is_test_filter0"><?php 
    _e('Live', 'foxyshop');
    ?>
</label>

				<input type="radio" id="is_test_filter1" name="is_test_filter" value="1"<?php 
    echo $foxy_data['is_test_filter'] == 1 ? ' checked="checked"' : '';
    ?>
 />
				<label for="is_test_filter1"><?php 
    _e('Test', 'foxyshop');
    ?>
</label>

				<input type="radio" id="is_test_filter" name="is_test_filter" value=""<?php 
    echo $foxy_data['is_test_filter'] == '' ? ' checked="checked"' : '';
    ?>
 />
				<label for="is_test_filter"><?php 
    _e('Both', 'foxyshop');
    ?>
</label>
			</div>

			<div class="foxyshop_field_control">
				<label for="order_id_filter"><?php 
    _e('Order ID', 'foxyshop');
    ?>
</label><input type="text" name="id_filter" id="id_filter" value="<?php 
    echo $foxy_data['id_filter'];
    ?>
" />
			</div>

			<div class="foxyshop_field_control">
				<label for="order_total_filter"><?php 
    _e('Order Total', 'foxyshop');
    ?>
</label><input type="text" name="order_total_filter" id="order_total_filter" value="<?php 
    echo $foxy_data['order_total_filter'];
    ?>
" />
			</div>

			<div class="foxyshop_field_control">
				<label for="coupon_code_filter"><?php 
    _e('Coupon Code', 'foxyshop');
    ?>
</label><input type="text" name="coupon_code_filter" id="coupon_code_filter" value="<?php 
    echo $foxy_data['coupon_code_filter'];
    ?>
" />
			</div>

			<div class="foxyshop_field_control">
				<label for="product_code_filter"><?php 
    echo FOXYSHOP_PRODUCT_NAME_SINGULAR . ' ' . __('Code', 'foxyshop');
    ?>
</label><input type="text" name="product_code_filter" id="product_code_filter" value="<?php 
    echo $foxy_data['product_code_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="product_name_filter"><?php 
    echo FOXYSHOP_PRODUCT_NAME_SINGULAR . ' ' . __('Name', 'foxyshop');
    ?>
</label><input type="text" name="product_name_filter" id="product_name_filter" value="<?php 
    echo $foxy_data['product_name_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="product_option_name_filter"><?php 
    echo FOXYSHOP_PRODUCT_NAME_SINGULAR . ' ' . __('Option Name', 'foxyshop');
    ?>
</label><input type="text" name="product_option_name_filter" id="product_option_name_filter" value="<?php 
    echo $foxy_data['product_option_name_filter'];
    ?>
" />
				<label for="product_option_value_filter" style="margin-left: 15px; margin-top: 4px; width: 34px;"><?php 
    _e('Value', 'foxyshop');
    ?>
</label><input type="text" name="product_option_value_filter" id="product_option_value_filter" value="<?php 
    echo $foxy_data['product_option_value_filter'];
    ?>
" />
			</div>

			<?php 
    if (version_compare($foxyshop_settings['version'], '0.7.2', ">=")) {
        ?>
			<div class="foxyshop_field_control">
				<label for="custom_field_name_filter"><?php 
        _e('Custom Field Name', 'foxyshop');
        ?>
</label><input type="text" name="custom_field_name_filter" id="custom_field_name_filter" value="<?php 
        echo $foxy_data['custom_field_name_filter'];
        ?>
" />
				<label for="custom_field_value_filter" style="margin-left: 15px; margin-top: 4px; width: 34px;"><?php 
        _e('Value', 'foxyshop');
        ?>
</label><input type="text" name="custom_field_value_filter" id="custom_field_value_filter" value="<?php 
        echo $foxy_data['custom_field_value_filter'];
        ?>
" />
			</div>
			<?php 
    }
    ?>

		</td><td>

			<div class="foxyshop_field_control">
				<label for="transaction_date_filter_begin"><?php 
    _e('Date Range', 'foxyshop');
    ?>
</label><input type="text" name="transaction_date_filter_begin" id="transaction_date_filter_begin" value="<?php 
    echo $foxy_data['transaction_date_filter_begin'];
    ?>
" class="foxyshop_date_field" />
				<span><?php 
    _e('to', 'foxyshop');
    ?>
</span><input type="text" name="transaction_date_filter_end" id="transaction_date_filter_end" value="<?php 
    echo $foxy_data['transaction_date_filter_end'];
    ?>
" class="foxyshop_date_field" />
			</div>



			<div class="foxyshop_field_control">
				<label for="customer_id_filter"><?php 
    _e('Customer ID', 'foxyshop');
    ?>
</label><input type="text" name="customer_id_filter" id="customer_id_filter" value="<?php 
    echo $foxy_data['customer_id_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="customer_email_filter"><?php 
    _e('Customer Email', 'foxyshop');
    ?>
</label><input type="text" name="customer_email_filter" id="customer_email_filter" value="<?php 
    echo $foxy_data['customer_email_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="customer_first_name_filter"><?php 
    _e('Customer First Name', 'foxyshop');
    ?>
</label><input type="text" name="customer_first_name_filter" id="customer_first_name_filter" value="<?php 
    echo $foxy_data['customer_first_name_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="customer_last_name_filter"><?php 
    _e('Customer Last Name', 'foxyshop');
    ?>
</label><input type="text" name="customer_last_name_filter" id="customer_last_name_filter" value="<?php 
    echo $foxy_data['customer_last_name_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="customer_state_filter"><?php 
    _e('Customer State', 'foxyshop');
    ?>
</label><input type="text" name="customer_state_filter" id="customer_state_filter" value="<?php 
    echo $foxy_data['customer_state_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="shipping_state_filter"><?php 
    _e('Shipping State', 'foxyshop');
    ?>
</label><input type="text" name="shipping_state_filter" id="shipping_state_filter" value="<?php 
    echo $foxy_data['shipping_state_filter'];
    ?>
" />
			</div>
			<div class="foxyshop_field_control">
				<label for="customer_ip_filter"><?php 
    _e('Customer IP', 'foxyshop');
    ?>
</label><input type="text" name="customer_ip_filter" id="customer_ip_filter" value="<?php 
    echo $foxy_data['customer_ip_filter'];
    ?>
" />
			</div>

			<div style="clear: both;"></div>
			<select name="transaction_search_type" id="transaction_search_type">
				<option value="show_orders"<?php 
    echo $transaction_search_type == "show_orders" ? ' selected="selected"' : '';
    ?>
><?php 
    _e('Show Orders', 'foxyshop');
    ?>
</option>
				<option value="print_recipts" target="_blank"><?php 
    _e('Print Receipts', 'foxyshop');
    ?>
</option>
				<?php 
    if (!$foxyshop_settings['enable_ship_to']) {
        ?>
				<option value="export_csv"><?php 
        _e('Export CSV', 'foxyshop');
        ?>
</option>
				<option value="export_tab"><?php 
        _e('Export Tab Delimeted', 'foxyshop');
        ?>
</option>
				<option value="export_ups"><?php 
        _e('Export to UPS', 'foxyshop');
        ?>
</option>
				<?php 
    }
    ?>
				<?php 
    do_action("foxyshop_order_search_list");
    ?>
			</select>
			<button type="submit" id="foxyshop_search_submit" name="foxyshop_search_submit" class="button-primary" style="clear: left; margin-top: 10px;"><?php 
    _e('Submit', 'foxyshop');
    ?>
</button>
			<button type="button" class="button submitcancel" style="margin-top: 10px;" onclick="document.location.href = 'edit.php?post_type=foxyshop_product&page=foxyshop_order_management';"><?php 
    _e('Reset', 'foxyshop');
    ?>
</button>

			<div style="clear: both;"></div>
			<?php 
    if (has_action('foxyshop_order_search_buttons')) {
        echo '<div id="foxyshop_order_search_buttons">';
        do_action("foxyshop_order_search_buttons", $foxy_data);
        echo '</div>';
    }
    ?>
		</td></tr></tbody></table>

		</form>

		<script type="text/javascript">
		jQuery(document).ready(function($) {
			$("#foxyshop_searchform button").live("click", function() {
				if ($("#transaction_search_type option:selected").attr("target") == "_blank") {
					$("#foxyshop_searchform").attr("target","_blank");
				} else {
					$("#foxyshop_searchform").attr("target","_self");
				}
			});
			$(".tablenav a.disabled").click(function() {
				return false;
			});

			$(".foxyshop_date_field").datepicker({ dateFormat: 'yy-mm-dd' });
		});
		</script>

	<?php 
    if (!isset($_GET['foxyshop_search']) && defined('FOXYSHOP_AUTO_API_DISABLED')) {
        return;
    }
    $foxy_response = foxyshop_get_foxycart_data($foxy_data);
    $xml = simplexml_load_string($foxy_response, NULL, LIBXML_NOCDATA);
    //var_dump($xml);
    if ((string) $xml->result == __('ERROR', 'foxyshop')) {
        echo '<h3>' . (string) $xml->messages->message . '</h3>';
        return;
    } else {
        ?>

		<form action="edit.php" method="get">
		<input type="hidden" name="foxyshop_search" value="1" />
		<input type="hidden" name="post_type" value="foxyshop_product" />
		<input type="hidden" name="page" value="foxyshop_order_management" />

		<?php 
        echo $foxyshop_hidden_input;
        foxyshop_api_paging_nav('transactions', 'top', $xml, $foxyshop_querystring);
        ?>

		<table cellpadding="0" cellspacing="0" border="0" class="wp-list-table widefat foxyshop-list-table" id="transaction_table">
			<thead>
				<tr>
					<th id="cb" class="manage-column column-cb check-column" scope="col"><input type="checkbox"></th>
					<th><span><?php 
        _e('Transaction ID', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<th><span><?php 
        _e('Order Date', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<th><span><?php 
        _e('Customer', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<th><span><?php 
        _e('Total', 'foxyshop');
        ?>
</span><span class="sorting-indicator"></span></th>
					<?php 
        do_action("foxyshop_order_table_head");
        ?>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<th class="manage-column column-cb check-column" style="" scope="col"><input type="checkbox"></th>
					<th><?php 
        _e('Transaction ID', 'foxyshop');
        ?>
</th>
					<th><?php 
        _e('OrderDate', 'foxyshop');
        ?>
</th>
					<th><?php 
        _e('Customer', 'foxyshop');
        ?>
</th>
					<th><?php 
        _e('Total', 'foxyshop');
        ?>
</th>
					<?php 
        do_action("foxyshop_order_table_foot");
        ?>
				</tr>
			</tfoot>
			<tbody id="the-list">

		<?php 
        $holder = "";
        $hide_transaction_filter = isset($_REQUEST['hide_transaction_filter']) ? $_REQUEST['hide_transaction_filter'] : 0;
        foreach ($xml->transactions->transaction as $transaction) {
            $transaction_id = (string) $transaction->id;
            $customer_first_name = (string) $transaction->customer_first_name;
            $customer_last_name = (string) $transaction->customer_last_name;
            $is_anonymous = (int) $transaction->is_anonymous;
            $customer_id = (string) $transaction->customer_id;
            $minfraud_score = (int) $transaction->minfraud_score;
            $transaction_date = (string) $transaction->transaction_date;
            $transaction_date = date(apply_filters("foxyshop_date_time_format", "Y-m-d H:i"), strtotime($transaction_date));
            $customer_name = $customer_last_name . ', ' . $customer_first_name;
            if ($is_anonymous != 1 && $customer_id) {
                $customer_name = '<a href="edit.php?post_type=foxyshop_product&page=foxyshop_customer_management&customer_id_filter=' . $customer_id . '&foxyshop_search=1" title="Customer ' . $customer_id . '">' . $customer_name . '</a>';
            }
            $print_receipt_link = "edit.php?foxyshop_search=1&amp;post_type=foxyshop_product&amp;page=foxyshop_order_management&amp;id_filter=" . $transaction_id . "&amp;foxyshop_print_invoice=1&amp;is_test_filter=&amp;skip_print=1&amp;transaction_date_filter_begin=" . $foxy_data['transaction_date_filter_begin'] . "&amp;transaction_date_filter_end=" . $foxy_data['transaction_date_filter_end'];
            foreach ($transaction->transaction_details->transaction_detail as $transaction_detail) {
                $pickup_day = "";
                $pickup_location = "";
                foreach ($transaction_detail->transaction_detail_options->transaction_detail_option as $transaction_detail_option) {
                    if ((string) $transaction_detail_option->product_option_name == "Pickup_Day") {
                        $pickup_day = (string) $transaction_detail_option->product_option_value;
                    } elseif ((string) $transaction_detail_option->product_option_name == "Pickup_Location") {
                        $pickup_location = (string) $transaction_detail_option->product_option_value;
                    }
                    $holder .= '<li>';
                    $holder .= str_replace("_", " ", (string) $transaction_detail_option->product_option_name) . ': ';
                    if (substr((string) $transaction_detail_option->product_option_value, 0, 5) == "file-") {
                        $upload_dir = wp_upload_dir();
                        $holder .= '<a href="' . $upload_dir['baseurl'] . '/customuploads/' . (string) $transaction_detail_option->product_option_value . '" target="_blank">' . (string) $transaction_detail_option->product_option_value . '</a>';
                    } else {
                        $holder .= $transaction_detail_option->product_option_value;
                    }
                    if ((string) $transaction_detail_option->price_mod != '0.000') {
                        $holder .= ' (' . (strpos("-", $transaction_detail_option->price_mod) !== false ? '-' : '+') . foxyshop_currency((double) $transaction_detail_option->price_mod) . ')';
                    }
                    $holder .= '</li>';
                }
            }
            echo '<tr rel="' . $transaction_id . '">';
            echo '<th class="check-column" scope="row"><input type="checkbox" value="' . $transaction_id . '" name="post[]"></th>' . "\n";
            echo '<td>';
            echo '<a href="' . (string) $transaction->receipt_url . '" title="' . __('FoxyCart Receipt', 'foxyshop') . '" target="_blank" style="float: left;"><img src="' . FOXYSHOP_DIR . '/images/foxycart-icon.png" alt="" align="top" /></a>';
            echo '<strong><a href="#" class="view_detail" style="float: left; line-height: 18px; margin: 0 0 0 5px;">' . $transaction_id . '</a></strong>';
            echo '<div class="row-actions">';
            echo '<span><a href="#" class="view_detail">' . __('View Order', 'foxyshop') . '</a> | </span>';
            echo '<span><a href="' . $print_receipt_link . '" title="' . __('Printable Receipt', 'foxyshop') . '" target="_blank">' . __('Receipt', 'foxyshop') . '</a></span>';
            if (!isset($transaction->is_hidden)) {
                $is_hidden = $hide_transaction_filter;
            } else {
                $is_hidden = (string) $transaction->is_hidden;
            }
            if ($is_hidden == 1) {
                echo '<span> | <a href="#" class="set_order_hidden_status" rel="0">' . __('Un-Archive', 'foxyshop') . '</a></span>';
            } else {
                echo '<span> | <a href="#" class="set_order_hidden_status" rel="1">' . __('Archive', 'foxyshop') . '</a></span>';
            }
            do_action("foxyshop_order_line_item", $transaction);
            echo '</div>';
            echo '</td>';
            echo '<td>' . $transaction_date . '</td>';
            echo '<td>' . $customer_name . '</td>';
            echo '<td>' . foxyshop_currency((double) $transaction->order_total) . '</td>';
            do_action("foxyshop_order_line_end", $transaction);
            echo '</tr>' . "\n";
            //Write Out Order Details Holder
            $holder .= '<div class="detail_holder" id="holder_' . $transaction_id . '">' . "\n";
            $holder .= '<div class="foxyshop_list_col">';
            $holder .= '<h4>' . __('Transaction Details', 'foxyshop') . '</h4>';
            $holder .= '<ul>';
            $holder .= '<li>' . __('Order ID', 'foxyshop') . ': ' . (string) $transaction->id . '</li>';
            $holder .= '<li>' . __('Date', 'foxyshop') . ': ' . $transaction_date . '</li>';
            $holder .= '<li>' . (string) $transaction->processor_response . '</li>';
            if ((string) $transaction->cc_number_masked != "") {
                $holder .= '<li>' . __('Card', 'foxyshop') . ': ' . (string) $transaction->cc_number_masked . ' (' . (string) $transaction->cc_type . ')</li>';
            }
            if ((string) $transaction->cc_exp_month != "") {
                $holder .= '<li>' . __('Exp', 'foxyshop') . ': ' . (string) $transaction->cc_exp_month . '-' . (string) $transaction->cc_exp_year . '</li>';
            }
            if ($minfraud_score > 0) {
                $holder .= '<li>' . __('MinFraud Score', 'foxyshop') . ': ' . $minfraud_score . '</li>';
            }
            if ((string) $transaction->shipto_shipping_service_description != "") {
                $holder .= '<li>' . __('Shipping Type', 'foxyshop') . ': ' . (string) $transaction->shipto_shipping_service_description . '</li>';
            }
            if ((string) $transaction->processor_response == "Purchase Order") {
                $holder .= '<li>PO #: ' . (string) $transaction->purchase_order . '</li>';
            }
            $holder .= '</ul>';
            $holder .= '</div>';
            $holder .= '<div class="foxyshop_list_col">';
            $holder .= '<h4>' . __('Order Details', 'foxyshop') . '</h4>';
            $holder .= '<ul>';
            $holder .= '<li>' . __('Subtotal', 'foxyshop') . ': ' . foxyshop_currency((double) $transaction->product_total) . '</li>';
            //Discounts
            foreach ($transaction->discounts->discount as $discount) {
                $holder .= '<li>' . (string) $discount->name . ': ' . foxyshop_currency((double) $discount->amount) . '</li>';
            }
            //Taxes
            foreach ($transaction->taxes->tax as $tax) {
                $holder .= '<li>' . (string) $tax->tax_name . ': ' . foxyshop_currency((double) $tax->tax_amount) . '</li>';
            }
            $holder .= '<li>' . __('Shipping', 'foxyshop') . ': ' . foxyshop_currency((double) $transaction->shipping_total) . '</li>';
            $holder .= '<li><strong>' . __('Order Total', 'foxyshop') . ': ' . foxyshop_currency((double) $transaction->order_total) . '</strong></li>';
            $holder .= '</ul>';
            $holder .= '</div>';
            $holder .= '<div class="foxyshop_list_col">';
            $holder .= '<h4>' . __('Customer Address', 'foxyshop') . '</h4>';
            $holder .= '<ul>';
            $holder .= '<li>' . (string) $transaction->customer_first_name . ' ' . (string) $transaction->customer_last_name . '</li>';
            if ((string) $transaction->customer_company != "") {
                $holder .= '<li>' . (string) $transaction->customer_company . '</li>';
            }
            $holder .= '<li>' . (string) $transaction->customer_address1 . '</li>';
            if ((string) $transaction->customer_address2 != "") {
                $holder .= '<li>' . (string) $transaction->customer_address2 . '</li>';
            }
            $holder .= '<li>' . (string) $transaction->customer_city . ', ' . (string) $transaction->customer_state . ' ' . (string) $transaction->customer_postal_code . '</li>';
            $holder .= '<li>' . (string) $transaction->customer_country . '</li>';
            $holder .= '</ul>';
            $holder .= '</div>';
            //Shipping Addresses (if entered)
            if ((string) $transaction->shipping_first_name != "" && !isset($transaction->shipto_addresses->shipto_address)) {
                $holder .= '<div class="foxyshop_list_col">';
                $holder .= '<h4>' . __('Shipping Details', 'foxyshop') . '</h4>';
                $holder .= '<ul>';
                $holder .= '<li>' . (string) $transaction->shipping_first_name . ' ' . (string) $transaction->shipping_last_name . '</li>';
                if ((string) $transaction->shipping_company != "") {
                    $holder .= '<li>' . (string) $transaction->shipping_company . '</li>';
                }
                $holder .= '<li>' . (string) $transaction->shipping_address1 . '</li>';
                if ((string) $transaction->shipping_address2 != "") {
                    $holder .= '<li>' . (string) $transaction->shipping_address2 . '</li>';
                }
                $holder .= '<li>' . (string) $transaction->shipping_city . ', ' . (string) $transaction->shipping_state . ' ' . (string) $transaction->shipping_postal_code . '</li>';
                $holder .= '<li>' . (string) $transaction->shipping_country . '</li>';
                if ((string) $transaction->shipping_phone != "") {
                    $holder .= '<li>' . (string) $transaction->shipping_phone . '</li>';
                }
                $holder .= '</ul>';
                $holder .= '</div>';
            }
            //Multi-ship Addresses
            foreach ($transaction->shipto_addresses->shipto_address as $shipto_address) {
                $holder .= '<div class="foxyshop_list_col">';
                $holder .= '<h4>' . __('Shipping Details', 'foxyshop') . ': ' . $shipto_address->address_name . '</h4>';
                $holder .= '<ul>';
                $holder .= '<li>' . $shipto_address->shipto_first_name . ' ' . $shipto_address->shipto_last_name . '</li>';
                if ((string) $shipto_address->shipto_company != "") {
                    $holder .= '<li>' . $shipto_address->shipto_company . '</li>';
                }
                $holder .= '<li>' . $shipto_address->shipto_address1 . '</li>';
                if ((string) $shipto_address->shipto_address2 != "") {
                    $holder .= '<li>' . $shipto_address->shipto_address2 . '</li>';
                }
                $holder .= '<li>' . $shipto_address->shipto_city . ', ' . $shipto_address->shipto_state . ' ' . $shipto_address->shipto_postal_code . '</li>';
                $holder .= '<li>' . $shipto_address->shipto_country . '</li>';
                if ((string) $shipto_address->shipto_phone != "") {
                    $holder .= '<li>' . $shipto_address->shipto_phone . '</li>';
                }
                $holder .= '<li><br />' . __('Method', 'foxyshop') . ': ' . $shipto_address->shipto_shipping_service_description . '</li>';
                $holder .= '<li>' . __('Shipping', 'foxyshop') . ': ' . foxyshop_currency((double) $shipto_address->shipto_shipping_total) . '</li>';
                $holder .= '</ul>';
                $holder .= '</div>';
            }
            //Customer Details
            $holder .= '<div class="foxyshop_list_col">';
            $holder .= '<h4>' . __('Customer Details', 'foxyshop') . '</h4>';
            $holder .= '<ul>';
            if ((string) $transaction->customer_phone != "") {
                $holder .= '<li>' . (string) $transaction->customer_phone . '</li>';
            }
            $holder .= '<li><a href="mailto:' . (string) $transaction->customer_email . '">' . (string) $transaction->customer_email . '</a></li>';
            $holder .= '<li>' . apply_filters('foxyshop_order_ip', '<a href="http://whatismyipaddress.com/ip/' . (string) $transaction->customer_ip . '" target="_blank">' . (string) $transaction->customer_ip . '</a>', (string) $transaction->customer_ip) . '</li>';
            $holder .= '<li>&nbsp;</li>';
            //Custom Fields
            foreach ($transaction->custom_fields->custom_field as $custom_field) {
                if ($custom_field->custom_field_name != 'ga') {
                    $holder .= '<li><strong>' . str_replace("_", " ", (string) $custom_field->custom_field_name) . ':</strong> ' . nl2br((string) $custom_field->custom_field_value) . '</li>';
                }
            }
            $holder .= '</ul>';
            $holder .= '</div>';
            //Custom Attributes
            $holder .= foxyshop_manage_attributes($transaction->attributes, $transaction_id, "transaction");
            $holder .= '<div style="clear: both; height: 20px;"></div>';
            foreach ($transaction->transaction_details->transaction_detail as $transaction_detail) {
                $holder .= '<div class="product_listing">';
                if ($transaction_detail->image != "") {
                    $holder .= '<div class="image_div">';
                    if ($transaction_detail->url != "") {
                        $holder .= '<a href="' . $transaction_detail->url . '" target="_blank">';
                    }
                    $holder .= '<img src="' . $transaction_detail->image . '" />';
                    if ($transaction_detail->url != "") {
                        $holder .= '</a>';
                    }
                    $holder .= '</div>';
                }
                $product_discount = 0;
                $weight_discount = 0;
                foreach ($transaction_detail->transaction_detail_options->transaction_detail_option as $transaction_detail_option) {
                    $product_discount += (double) $transaction_detail_option->price_mod;
                    $weight_discount += (double) $transaction_detail_option->weight_mod;
                }
                $holder .= '<div class="details_div">';
                $holder .= '<h4>' . $transaction_detail->product_name . '</h4>';
                $holder .= '<ul>';
                if ((string) $transaction_detail->shipto != "") {
                    $holder .= '<li>Ship To: ' . (string) $transaction_detail->shipto . '</li>';
                }
                $holder .= '<li>' . __('Code', 'foxyshop') . ': ' . (string) $transaction_detail->product_code . '</li>';
                $holder .= '<li>' . __('Price', 'foxyshop') . ': ' . foxyshop_currency((double) $transaction_detail->product_price) . '</li>';
                if ($product_discount != 0) {
                    $holder .= '<li>Adjusted Price: ' . foxyshop_currency((double) $transaction_detail->product_price + $product_discount) . '</li>';
                }
                $holder .= '<li>' . __('Qty', 'foxyshop') . ': ' . $transaction_detail->product_quantity . '</li>';
                if ((string) $transaction_detail->product_weight != "0.000") {
                    $holder .= '<li>Weight: ' . (string) $transaction_detail->product_weight . '</li>';
                }
                if ($weight_discount != 0) {
                    $holder .= '<li>Adjusted Weight: ' . ((double) $transaction_detail->product_weight + $weight_discount) . '</li>';
                }
                if ((string) $transaction_detail->category_code != "DEFAULT") {
                    $holder .= '<li>Category: ' . (string) $transaction_detail->category_description . '</li>';
                }
                if ((string) $transaction_detail->product_delivery_type != "shipped") {
                    $holder .= '<li>Delivery Type: ' . (string) $transaction_detail->product_delivery_type . '</li>';
                }
                if ((string) $transaction_detail->downloadable_url != "") {
                    $holder .= '<li>Downloadable URL: <a href="' . (string) $transaction_detail->downloadable_url . '" target="_blank">Click Here</a></li>';
                }
                if ($transaction_detail->subscription_frequency != "") {
                    $holder .= '<li>' . __('Subscription Frequency', 'foxyshop') . ': ' . (string) $transaction_detail->subscription_frequency . '</li>';
                    $holder .= '<li>' . __('Subscription Start Date', 'foxyshop') . ': ' . (string) $transaction_detail->subscription_startdate . '</li>';
                    $holder .= '<li>' . __('Subscription Next Date', 'foxyshop') . ': ' . (string) $transaction_detail->subscription_nextdate . '</li>';
                    if ((string) $transaction_detail->subscription_enddate != "0000-00-00") {
                        $holder .= '<li>Subscription End Date: ' . (string) $transaction_detail->subscription_enddate . '</li>';
                    }
                }
                foreach ($transaction_detail->transaction_detail_options->transaction_detail_option as $transaction_detail_option) {
                    $holder .= '<li>';
                    $holder .= str_replace("_", " ", (string) $transaction_detail_option->product_option_name) . ': ';
                    if (substr((string) $transaction_detail_option->product_option_value, 0, 5) == "file-") {
                        $upload_dir = wp_upload_dir();
                        $holder .= '<a href="' . $upload_dir['baseurl'] . '/customuploads/' . (string) $transaction_detail_option->product_option_value . '" target="_blank">' . (string) $transaction_detail_option->product_option_value . '</a>';
                    } else {
                        $holder .= $transaction_detail_option->product_option_value;
                    }
                    if ((string) $transaction_detail_option->price_mod != '0.000') {
                        $holder .= ' (' . (strpos("-", $transaction_detail_option->price_mod) !== false ? '-' : '+') . foxyshop_currency((double) $transaction_detail_option->price_mod) . ')';
                    }
                    $holder .= '</li>';
                }
                $holder .= '</ul>';
                $holder .= '</div>';
                $holder .= '<div style="clear: both;"></div>';
                $holder .= '</div>';
            }
            $holder .= '<div style="clear: both; height: 10px;"></div>';
            $holder .= '</div>';
        }
        echo '</tbody></table>';
        foxyshop_api_paging_nav('transactions', 'bottom', $xml, $foxyshop_querystring);
        ?>
		</form>
	<?php 
    }
    ?>


	<div id="details_holder"><?php 
    echo $holder;
    ?>
</div>

	<script type="text/javascript" src="<?php 
    echo FOXYSHOP_DIR;
    ?>
/js/jquery.tablesorter.js"></script>
	<script type="text/javascript">
	jQuery(document).ready(function($){
		$(".foxyshop-list-table thead th").click(function() {
			$("#foxyshop-list-inline .detail_holder").appendTo("#details_holder");
			$("#foxyshop-list-inline").remove();
		});
		$(".foxyshop-list-table").tablesorter({
			'cssDesc': 'asc sorted',
			'cssAsc': 'desc sorted',
			'headers': { 0: { sorter: false} }
		});
		$(".view_detail").click(function() {
			var id = $(this).parents("tr").attr("rel");

			if ($("#foxyshop-list-inline #holder_" + id).length > 0) {
				$("#foxyshop-list-inline .detail_holder").appendTo("#details_holder");
				$("#foxyshop-list-inline").remove();
			} else {
				$("#foxyshop-list-inline .detail_holder").appendTo("#details_holder");
				$("#foxyshop-list-inline").remove();

				$(this).parents("tr").after('<tr id="foxyshop-list-inline"><td colspan="7"></td></tr>');
				$("#holder_"+id).appendTo("#foxyshop-list-inline td");
			}

			return false;
		});



		$(".set_order_hidden_status").click( function() {
			var hide_transaction = $(this).attr("rel");
			var transaction_id = $(this).parents("tr").attr("rel");
			var data = {
				action: 'foxyshop_display_list_ajax_action',
				security: '<?php 
    echo wp_create_nonce("foxyshop-display-list-function");
    ?>
',
				hide_transaction: hide_transaction,
				foxyshop_action: 'hide_transaction',
				id: transaction_id
			};
			$.post(ajaxurl, data, function(response) {
			<?php 
    if ($hide_transaction_filter == "0") {
        ?>
				$("tr[rel="+transaction_id+"]").remove();
				$("#foxyshop-list-inline #holder_" + transaction_id).remove();
			<?php 
    } else {
        ?>
				alert(response);
			<?php 
    }
    ?>
			});

			return false;
		});

		<?php 
    foxyshop_manage_attributes_jquery('transaction');
    ?>

	});
	</script>


	<?php 
}