public static function output()
    {
        global $post, $thepostid;
        $thepostid = $post->ID;
        $_product = wc_get_product($thepostid);
        $terms = array();
        $delivery_time = $_product->gzd_product->delivery_time;
        woocommerce_wp_select(array('id' => '_unit', 'label' => __('Unit', 'woocommerce-germanized'), 'options' => array_merge(array('none' => __('Select unit', 'woocommerce-germanized')), WC_germanized()->units->get_units()), 'desc_tip' => true, 'description' => __('Needed if selling on a per unit basis', 'woocommerce-germanized')));
        woocommerce_wp_text_input(array('id' => '_unit_base', 'label' => __('Unit Base', 'woocommerce-germanized'), 'data_type' => 'decimal', 'desc_tip' => true, 'description' => __('Unit price per amount (e.g. 100)', 'woocommerce-germanized')));
        woocommerce_wp_text_input(array('id' => '_unit_price_regular', 'label' => __('Regular Unit Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
        woocommerce_wp_text_input(array('id' => '_unit_price_sale', 'label' => __('Sale Unit Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
        if (version_compare(WC()->version, '2.3', '<')) {
            return;
        }
        ?>
		
		<p class="form-field">
			<label for="delivery_time"><?php 
        _e('Delivery Time', 'woocommerce-germanized');
        ?>
</label>
			<input type="hidden" class="wc-product-search wc-gzd-delivery-time-search" style="width: 50%" id="delivery_time" name="delivery_time" data-minimum_input_length="1" data-allow_clear="true" data-placeholder="<?php 
        _e('Search for a delivery time&hellip;', 'woocommerce-germanized');
        ?>
" data-action="woocommerce_gzd_json_search_delivery_time" data-multiple="false" data-selected="<?php 
        echo $delivery_time ? $delivery_time->name : '';
        ?>
" value="<?php 
        echo $delivery_time ? $delivery_time->term_id : '';
        ?>
" />
		</p>
		
		<?php 
    }
 /**
  * Add custom fields to Product General Tab.
  *
  * @subpackage	Product
  */
 function woo_add_custom_general_fields()
 {
     global $woocommerce, $post;
     echo '<div class="options_group">';
     echo '<h2>Book Details</h2>';
     woocommerce_wp_text_input(array('id' => '_amazon_link', 'label' => __('Amazon Link', 'woocommerce'), 'placeholder' => 'Amazon link', 'desc_tip' => true, 'description' => __('Enter Amazon link here.', 'woocommerce')));
     woocommerce_wp_text_input(array('id' => '_isbn', 'label' => __('ISBN', 'woocommerce'), 'placeholder' => 'ISBN', 'desc_tip' => true, 'description' => __('Enter ISBN here.', 'woocommerce')));
     woocommerce_wp_text_input(array('id' => '_number_of_pages', 'label' => __('No of Pages', 'woocommerce'), 'placeholder' => 'No of pages', 'desc_tip' => true, 'description' => __('Enter number of pages here.', 'woocommerce')));
     woocommerce_wp_select(array('id' => '_book_format', 'label' => __('Book Format', 'woocommerce'), 'desc_tip' => true, 'description' => __('Select Book Format.', 'woocommerce'), 'options' => array('paperback' => __('Paperback', 'woocommerce'), 'hardcover' => __('Hardcover', 'woocommerce'), 'ebook' => __('eBook', 'woocommerce'))));
     woocommerce_wp_select(array('id' => '_print_type', 'label' => __('Print Type', 'woocommerce'), 'desc_tip' => true, 'description' => __('Select Print Type.', 'woocommerce'), 'options' => array('colour' => __('Colour', 'woocommerce'), 'black' => __('Black & White', 'woocommerce'))));
     echo '</div>';
 }
        function display()
        {
            global $post;
            global $DOPBSP;
            $dopbsp_woocommerce_options = array('calendar' => get_post_meta($post->ID, 'dopbsp_woocommerce_calendar', true), 'language' => get_post_meta($post->ID, 'dopbsp_woocommerce_language', true) == '' ? DOPBSP_CONFIG_TRANSLATION_DEFAULT_LANGUAGE : get_post_meta($post->ID, 'dopbsp_woocommerce_language', true), 'position' => get_post_meta($post->ID, 'dopbsp_woocommerce_position', true) == '' ? 'summary' : get_post_meta($post->ID, 'dopbsp_woocommerce_position', true));
            ?>
    <div id="dopbsp_tab_data" class="panel woocommerce_options_panel">
        <div class="options_group">
            <p class="form-field">
<?php 
            woocommerce_wp_select(array('id' => 'dopbsp_woocommerce_calendar', 'options' => $this->getCalendars(), 'label' => $DOPBSP->text('WOOCOMMERCE_TAB_CALENDAR'), 'description' => $DOPBSP->text('WOOCOMMERCE_TAB_CALENDAR_HELP')));
            woocommerce_wp_select(array('id' => 'dopbsp_woocommerce_language', 'options' => $this->getLanguages(), 'label' => $DOPBSP->text('WOOCOMMERCE_TAB_LANGUAGE'), 'description' => $DOPBSP->text('WOOCOMMERCE_TAB_LANGUAGE_HELP'), 'value' => $dopbsp_woocommerce_options['language']));
            woocommerce_wp_select(array('id' => 'dopbsp_woocommerce_position', 'options' => array('summary' => $DOPBSP->text('WOOCOMMERCE_TAB_POSITION_SUMMARY'), 'tabs' => $DOPBSP->text('WOOCOMMERCE_TAB_POSITION_TABS'), 'summary-tabs' => $DOPBSP->text('WOOCOMMERCE_TAB_POSITION_SUMMARY_AND_TABS')), 'label' => $DOPBSP->text('WOOCOMMERCE_TAB_POSITION'), 'description' => $DOPBSP->text('WOOCOMMERCE_TAB_POSITION_HELP'), 'value' => $dopbsp_woocommerce_options['position']));
            ?>
            </p>
        </div>	
    </div>
<?php 
        }
        function showTab()
        {
            global $post;
            $custom_tab_options = array('title' => get_post_meta($post->ID, 'custom_tab_title', true), 'content' => get_post_meta($post->ID, 'custom_tab_content', true));
            ?>
    <div id="dopbsp_tab_data" class="panel woocommerce_options_panel">
        <div class="options_group">
            <p class="form-field">
                <?php 
            woocommerce_wp_select(array('id' => 'custom_tab_enabled', 'options' => $this->getCalendars(), 'label' => __('Enable Custom Tab?', 'woothemes'), 'description' => __('Enable this option to enable the custom tab on the frontend.', 'woothemes')));
            ?>
            </p>
        </div>
		
        <div class="options_group">
        </div>	
    </div>
<?php 
        }
/**
 * Creates the Referfriend Meta Box in the admin control panel when in the Giftcard Post Type.  Allows you to create a giftcard manually.
 * @param  [type] $post
 * @return [type]
 */
function rf_meta_box($post)
{
    global $woocommerce;
    wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
    ?>
	<style type="text/css">
		#edit-slug-box, #minor-publishing-actions { display:none }

		.form-field input, .form-field textarea { width:100%;}

		input[type="checkbox"], input[type="radio"] { float: left; width:16px;}
	</style>

	<div class="panel woocommerce_options_panel">
	<?php 
    woocommerce_wp_select(array('id' => 'rf_coupon_type', 'label' => __('Coupon Type', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Coupon Type', 'mg_referfriend'), 'options' => wc_get_coupon_types()));
    woocommerce_wp_text_input(array('id' => 'rf_coupon_amount', 'label' => __('Coupon Amount', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Coupon Amount', 'mg_referfriend'), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
    woocommerce_wp_select(array('id' => 'rf_type', 'label' => __('Type', 'mg_referfriend'), 'placeholder' => '', 'options' => array('' => '', '1' => 'Refered by Email', '2' => 'Refered by share link')));
    // Description
    woocommerce_wp_textarea_input(array('id' => 'rf_description', 'label' => __('Description', 'rpgiftcards'), 'placeholder' => '', 'description' => __('Description', 'rpgiftcards')));
    woocommerce_wp_text_input(array('id' => 'rf_product_id', 'label' => __('Product IDs', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Product IDs', 'mg_referfriend'), 'type' => 'number'));
    woocommerce_wp_text_input(array('id' => 'rf_usage', 'label' => __('Usage', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Usage', 'mg_referfriend')));
    woocommerce_wp_text_input(array('id' => 'rf_limit', 'label' => __('Limit', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Limit', 'mg_referfriend')));
    woocommerce_wp_text_input(array('id' => 'rf_expiry_date', 'label' => __('Expiry Date', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Expiry Date', 'mg_referfriend')));
    echo '</div>';
}
 public static function output()
 {
     global $post, $thepostid;
     $thepostid = $post->ID;
     $_product = wc_get_product($thepostid);
     $terms = array();
     woocommerce_wp_select(array('id' => '_unit', 'label' => __('Unit', 'woocommerce-germanized'), 'options' => array_merge(array('none' => __('Select unit', 'woocommerce-germanized')), WC_germanized()->units->get_units()), 'desc_tip' => true, 'description' => __('Needed if selling on a per unit basis', 'woocommerce-germanized')));
     woocommerce_wp_text_input(array('id' => '_unit_product', 'label' => __('Product Units', 'woocommerce-germanized'), 'data_type' => 'decimal', 'desc_tip' => true, 'description' => __('Number of units included per default product price. Example: 1000 ml.', 'woocommerce-germanized')));
     woocommerce_wp_text_input(array('id' => '_unit_base', 'label' => __('Base Price Units', 'woocommerce-germanized'), 'data_type' => 'decimal', 'desc_tip' => true, 'description' => __('Base price units. Example base price: 0,99 € / 100 ml. Insert 100 as base price unit amount.', 'woocommerce-germanized')));
     woocommerce_wp_checkbox(array('id' => '_unit_price_auto', 'label' => __('Calculation', 'woocommerce-germanized'), 'description' => '<span class="wc-gzd-premium-desc">' . __('Calculate base prices automatically.', 'woocommerce-germanized') . '</span> <a href="https://vendidero.de/woocommerce-germanized#buy" target="_blank" class="wc-gzd-pro">pro</a>'));
     woocommerce_wp_text_input(array('id' => '_unit_price_regular', 'label' => __('Regular Base Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
     woocommerce_wp_text_input(array('id' => '_unit_price_sale', 'label' => __('Sale Base Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
 }
 function meta_box()
 {
     global $woocommerce, $post;
     $order = new WC_Order($post->ID);
     $order_discount = $order->get_total_discount();
     $order_tax = $order->get_total_tax();
     $order_subtotal = $order->get_subtotal_to_display();
     $order_total = $order->get_formatted_order_total();
     get_payment_gateway_fields('paypal');
     woocommerce_wp_select(array('id' => 'payment_type', 'label' => '', 'value' => 'default', 'options' => ins_get_payment_methods(), 'class' => 'chosen-select'));
     woocommerce_wp_select(array('id' => 'add_coupon', 'label' => '', 'value' => 'default', 'options' => ins_get_coupons(), 'class' => 'chosen-select'));
     woocommerce_wp_text_input(array('id' => 'sub_total', 'label' => __('Order Subtotal', 'instore'), 'placeholder' => 0.0, 'value' => $order_subtotal));
     woocommerce_wp_text_input(array('id' => 'order_tax', 'label' => __('Order Tax', 'instore'), 'placeholder' => 0.0, 'value' => $order_tax));
     woocommerce_wp_text_input(array('id' => 'applied_discount', 'label' => __('Applied Discount', 'instore'), 'placeholder' => 0.0, 'value' => $order_discount));
 }
    /**
     * Display product settings
     *
     * @access  public
     * @since   2.2
     */
    public function data_display()
    {
        ?>
		<div id="rcp_access_control" class="panel woocommerce_options_panel">

			<div class="options_group">
				<p><?php 
        _e('Restrict purchasing of this product to:', 'rcp');
        ?>
</p>
				<?php 
        woocommerce_wp_checkbox(array('id' => '_rcp_woo_active_to_purchase', 'label' => __('Active subscribers only?', 'rcp'), 'cbvalue' => 1));
        $levels = (array) get_post_meta(get_the_ID(), '_rcp_woo_subscription_levels_to_purchase', true);
        foreach (rcp_get_subscription_levels('all') as $level) {
            woocommerce_wp_checkbox(array('name' => '_rcp_woo_subscription_levels_to_purchase[]', 'id' => '_rcp_woo_subscription_level_' . $level->id, 'label' => $level->name, 'value' => in_array($level->id, $levels) ? $level->id : 0, 'cbvalue' => $level->id));
        }
        woocommerce_wp_select(array('id' => '_rcp_woo_access_level_to_purchase', 'label' => __('Access level required?', 'rcp'), 'options' => rcp_get_access_levels()));
        ?>
			</div>

			<div class="options_group">
				<p><?php 
        _e('Restrict viewing of this product to:', 'rcp');
        ?>
</p>
				<?php 
        woocommerce_wp_checkbox(array('id' => '_rcp_woo_active_to_view', 'label' => __('Active subscribers only?', 'rcp'), 'cbvalue' => 1));
        $levels = (array) get_post_meta(get_the_ID(), '_rcp_woo_subscription_levels_to_view', true);
        foreach (rcp_get_subscription_levels('all') as $level) {
            woocommerce_wp_checkbox(array('name' => '_rcp_woo_subscription_levels_to_view[]', 'id' => '_rcp_woo_subscription_level_to_view_' . $level->id, 'label' => $level->name, 'value' => in_array($level->id, $levels) ? $level->id : 0, 'cbvalue' => $level->id));
        }
        woocommerce_wp_select(array('id' => '_rcp_woo_access_level_to_view', 'label' => __('Access level required?', 'rcp'), 'options' => rcp_get_access_levels()));
        ?>
			</div>

		</div>
<?php 
    }
function soya_display_sv_panel()
{
    ?>
        
        <div id="soya_variable_product" class="panel woocommerce_options_panel ">
            <div class=" options_group show_if_soya_variable">
            <?php 
    // build query to get all features
    $args = array('post_type' => 'soya_feature', 'orderby' => 'title', 'order' => 'ASC');
    $query = new WP_Query($args);
    if ($query->have_posts()) {
        $options = [];
        foreach ($query->posts as $post) {
            $options[$post->ID] = $post->post_title;
        }
    }
    woocommerce_wp_select(array('id' => '_soya_features', 'label' => __('Select Features to Use', 'soya-customiza-product'), 'options' => $options));
    woocommerce_wp_text_input(array('id' => '_regular_price', 'label' => __('Regular Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
    //woocommerce_wp_text_input( array( 'id' => '_sale_price', 'data_type' => 'price', 'label' => __( 'Sale Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol().')', 'description' => '<a href="#" class="sale_schedule">' . __( 'Schedule', 'woocommerce' ) . '</a>' ) );
    ?>
            </div>
        </div>
    <?php 
}
    /**
     * WooCommerce custom product tab data
     *
     * Adds the panel to the Product Data postbox in the product interface
     *
     * @package WooCommerce - PDF Vouchers
     * @since   1.0.0
     */
    public function woo_vou_product_write_panel()
    {
        $prefix = WOO_VOU_META_PREFIX;
        global $current_user, $woo_vou_vendor_role;
        $voucher_options = array('' => __('Please Select', 'woovoucher'));
        $voucher_data = $this->model->woo_vou_get_vouchers();
        foreach ($voucher_data as $voucher) {
            if (isset($voucher['ID']) && !empty($voucher['ID'])) {
                // Check voucher id is not empty
                $voucher_options[$voucher['ID']] = $voucher['post_title'];
            }
        }
        $vendors_options = array('' => __('Please Select', 'woovoucher'));
        $vendors_data = get_users();
        if (!empty($vendors_data)) {
            // Check vendor users are not empty
            foreach ($vendors_data as $vendors) {
                if (user_can($vendors->ID, 'woo_vendor_options')) {
                    $vendors_options[$vendors->ID] = $vendors->display_name . ' (#' . $vendors->ID . ' &ndash; ' . sanitize_email($vendors->user_email) . ')';
                }
            }
        }
        $based_on_purchase_opt = array('7' => '7 Days', '15' => '15 Days', '30' => '1 Month (30 Days)', '90' => '3 Months (90 Days)', '180' => '6 Months (180 Days)', '365' => '1 Year (365 Days)', 'cust' => 'Custom');
        $using_type_opt = array('' => __('Default', 'woovoucher'), '0' => __('One time only', 'woovoucher'), '1' => __('Unlimited', 'woovoucher'));
        // Voucher Code Error
        $vou_codes_error_class = ' woo-vou-display-none ';
        $codes_error_msg = '<br/><span id="woo_vou_codes_error" class="woo-vou-codes-error ' . $vou_codes_error_class . '">' . __('Please enter atleast 1 voucher code.', 'woovoucher') . '</span>';
        $days_error_msg = '<span id="woo_vou_days_error" class="woo-vou-days-error ' . $vou_codes_error_class . '">' . __(' Please enter valid days.', 'woovoucher') . '</span>';
        $user_roles = isset($current_user->roles) ? $current_user->roles : array();
        $user_role = array_shift($user_roles);
        $vendor_flag = false;
        if (!empty($user_role) && in_array($user_role, $woo_vou_vendor_role)) {
            // Check vendor user role
            $vendor_flag = true;
        }
        $vou_hide_vendor_options = get_option('vou_hide_vendor_options');
        // display the custom tab panel
        echo '<div id="woo_vou_voucher" class="panel wc-metaboxes-wrapper woocommerce_options_panel">';
        //Enable Voucher Code
        $this->woo_vou_add_checkbox(array('id' => $prefix . 'enable', 'label' => __('Enable Voucher Codes:', 'woovoucher'), 'description' => __('To enable the Voucher for this Product check the "Enable Voucher Codes" check box.', 'woovoucher')));
        //Recipient Name Detail
        $this->woo_vou_add_checkbox(array('id' => $prefix . 'enable_recipient_name', 'label' => __('Enable Recipient Name:', 'woovoucher'), 'description' => __('To enable the Recipient Name on product page', 'woovoucher')));
        echo '<div class="recipient-detail-wrap">';
        $this->woo_vou_add_text(array('id' => $prefix . 'recipient_name_label', 'class' => 'woo_vou_recipient_text', 'wrap_class' => 'woo_vou_recipient_details', 'label' => __('Label:', 'woovoucher'), 'description' => __('', 'woovoucher') . $days_error_msg));
        $this->woo_vou_add_text(array('id' => $prefix . 'recipient_name_max_length', 'class' => 'woo_vou_recipient_text', 'wrap_class' => 'woo_vou_recipient_details', 'label' => __('Max Length:', 'woovoucher'), 'description' => __('', 'woovoucher') . $days_error_msg));
        $this->woo_vou_add_cust_checkbox(array('id' => $prefix . 'recipient_name_is_required', 'label' => __('Required:', 'woovoucher'), 'description' => __('Make this field required in order to add a voucher product to the cart', 'woovoucher')));
        echo '</div>';
        //Recipient Email Detail
        $this->woo_vou_add_checkbox(array('id' => $prefix . 'enable_recipient_email', 'label' => __('Enable Recipient Email:', 'woovoucher'), 'description' => __('To enable the Recipient Email on product page', 'woovoucher')));
        echo '<div class="recipient-detail-wrap">';
        $this->woo_vou_add_text(array('id' => $prefix . 'recipient_email_label', 'class' => 'woo_vou_recipient_text', 'wrap_class' => 'woo_vou_recipient_details', 'label' => __('Label:', 'woovoucher'), 'description' => __('', 'woovoucher') . $days_error_msg));
        $this->woo_vou_add_cust_checkbox(array('id' => $prefix . 'recipient_email_is_required', 'label' => __('Required:', 'woovoucher'), 'description' => __('Make this field required in order to add a voucher product to the cart', 'woovoucher')));
        echo '</div>';
        //Recipient Message Detail
        $this->woo_vou_add_checkbox(array('id' => $prefix . 'enable_recipient_message', 'label' => __('Enable Recipient Message:', 'woovoucher'), 'description' => __('To enable the Recipient Message on product page', 'woovoucher')));
        echo '<div class="recipient-detail-wrap">';
        $this->woo_vou_add_text(array('id' => $prefix . 'recipient_message_label', 'class' => 'woo_vou_recipient_text', 'wrap_class' => 'woo_vou_recipient_details', 'label' => __('Label:', 'woovoucher'), 'description' => __('', 'woovoucher')));
        $this->woo_vou_add_text(array('id' => $prefix . 'recipient_message_max_length', 'class' => 'woo_vou_recipient_text', 'wrap_class' => 'woo_vou_recipient_details', 'label' => __('Max Length:', 'woovoucher'), 'description' => __('', 'woovoucher')));
        $this->woo_vou_add_cust_checkbox(array('id' => $prefix . 'recipient_message_is_required', 'label' => __(' Required:', 'woovoucher'), 'description' => __('Make this field required in order to add a voucher product to the cart', 'woovoucher')));
        echo '</div>';
        // if user is vendor and hide options set
        if ($vendor_flag == true && $vou_hide_vendor_options == 'yes') {
        } else {
            //PDF Template
            woocommerce_wp_select(array('id' => $prefix . 'pdf_template', 'style' => 'min-width:200px;', 'class' => 'wc-enhanced-select', 'options' => $voucher_options, 'label' => __('PDF Template:', 'woovoucher'), 'description' => __('Select a PDF template. This setting modifies the global PDF template setting and overrides vendor\'s PDF template value. Leave it empty to use the global/vendor settings.', 'woovoucher')));
        }
        if ($vendor_flag == true) {
            // Check vendor user role
            woocommerce_wp_hidden_input(array('id' => $prefix . 'vendor_user', 'value' => $current_user->ID));
        } else {
            //Vendor User
            woocommerce_wp_select(array('id' => $prefix . 'vendor_user', 'style' => 'min-width:200px;', 'class' => 'wc-enhanced-select', 'options' => $vendors_options, 'label' => __('Vendor User:'******'woovoucher'), 'description' => __('Please select the vendor user.', 'woovoucher')));
        }
        if ($vendor_flag == true && $vou_hide_vendor_options == 'yes') {
        } else {
            //voucher's type to use it
            woocommerce_wp_select(array('id' => $prefix . 'using_type', 'style' => 'min-width:200px;', 'class' => 'wc-enhanced-select', 'options' => $using_type_opt, 'label' => __('Usability:', 'woovoucher'), 'description' => sprintf(__('Choose how you wanted to use vouchers codes. %sif you set usability "%sone time only%s" then it will automatically set product quantity equal to number of voucher codes entered and it will automatically decrease quanity  by 1 when it get purchased.
if you set usability "%sunlimited%s" then plugin will automatically generate unique voucher codes when product  purchased. %sThis setting modifies the global usability setting and overrides vendor\'s usability value. Leave it empty to use the global/vendor settings.', 'woovoucher'), '<br />', '<b>', '</b>', '<b>', '</b>', '<br />')));
        }
        //voucher's code comma seprated
        woocommerce_wp_textarea_input(array('id' => $prefix . 'codes', 'label' => __('Voucher Codes:', 'woovoucher'), 'description' => __('If you have a list of Voucher Codes you can copy and paste them in to this option. Make sure, that they are comma separated.', 'woovoucher') . $codes_error_msg));
        //import to csv field
        $this->woo_vou_add_importcsv(array('id' => $prefix . 'import_csv', 'btntext' => __('Generate / Import Codes', 'woovoucher'), 'label' => __('Generate / Import Codes:', 'woovoucher'), 'description' => __('Here you can import a csv file with voucher vodes or you can enter the prefix, pattern and extension will automatically create the voucher codes.', 'woovoucher')));
        //purchased voucher codes field
        $this->woo_vou_add_purchasedvoucodes(array('id' => $prefix . 'purchased_codes', 'btntext' => __('Purchased Voucher Codes', 'woovoucher'), 'label' => __('Purchased Voucher Code:', 'woovoucher'), 'description' => __('Click on the button to see a list of all purchased voucher vodes.', 'woovoucher')));
        //used voucher codes field
        $this->woo_vou_add_usedvoucodes(array('id' => $prefix . 'used_codes', 'btntext' => __('Used Voucher Codes', 'woovoucher'), 'label' => __('Used Voucher Code:', 'woovoucher'), 'description' => __('Click on the button to see a list of all used voucher vodes.', 'woovoucher')));
        //voucher expiration date type
        $expdate_types = apply_filters('woo_vou_exp_date_types', array('specific_date' => __('Specific Time', 'woovoucher'), 'based_on_purchase' => __('Based on purchase', 'woovoucher')));
        $this->woo_vou_add_radio(array('id' => $prefix . 'exp_type', 'options' => $expdate_types, 'default' => array('specific_date'), 'label' => __('Expiration Date Type:', 'woovoucher'), 'description' => __('Please select Expiration Date Type either specific time or set date based on purchased voucher date like After 7 days, 30 days, 1 year etc.', 'woovoucher')));
        //
        $this->woo_vou_add_select(array('id' => $prefix . 'days_diff', 'style' => 'min-width:200px;', 'class' => '_woo_vou_days_diff wc-enhanced-select', 'options' => $based_on_purchase_opt, 'label' => __('Expiration Days:', 'woovoucher'), 'description' => __('', 'woovoucher'), 'sign' => __(' After purchase', 'woovoucher')));
        //voucher expiration date custom days
        $this->woo_vou_add_custom_text(array('id' => $prefix . 'custom_days', 'class' => 'custom-days-text', 'label' => __('Custom Days:', 'woovoucher'), 'description' => __('', 'woovoucher') . $days_error_msg, 'sign' => __(' Days after purchase', 'woovoucher')));
        //voucher start date time
        $this->woo_vou_add_datetime(array('id' => $prefix . 'start_date', 'label' => __('Start Date:', 'woovoucher'), 'std' => array(''), 'description' => __('If you want to make the Voucher Code(s) valid for a specific time only, you can enter an start date here.', 'woovoucher'), 'format' => 'dd-mm-yy'));
        //voucher expiration date time
        $this->woo_vou_add_datetime(array('id' => $prefix . 'exp_date', 'label' => __('Expiration Date:', 'woovoucher'), 'std' => array(''), 'description' => __('If you want to make the Voucher Code(s) valid for a specific time only, you can enter an expiration date here. If the Voucher Code never expires, then leave that option blank.', 'woovoucher'), 'format' => 'dd-mm-yy'));
        if ($vendor_flag == true && $vou_hide_vendor_options == 'yes') {
        } else {
            //add the vendor's logo
            $this->woo_vou_add_image(array('id' => $prefix . 'logo', 'label' => __('Vendor\'s Logo:', 'woovoucher'), 'description' => __('Allows you to upload a logo of the vendor for which this Voucher is valid. The logo will also be displayed on the PDF document. Leave it empty to use the vendor logo from the vendor settings.', 'woovoucher')));
            //vendor's address
            woocommerce_wp_textarea_input(array('id' => $prefix . 'address_phone', 'label' => __('Vendor\'s Address:', 'woovoucher'), 'description' => __('Here you can enter the complete Vendor\'s address. This will be displayed on the PDF document sent to the customers so that they know where to redeem this Voucher. Limited HTML is allowed. Leave it empty to use address from the vendor settings.', 'woovoucher')));
            //vendor's website
            woocommerce_wp_text_input(array('id' => $prefix . 'website', 'class' => 'woo_vou_siteurl_text', 'label' => __('Website URL:', 'woovoucher'), 'description' => __('Enter the Vendor\'s website URL here. This will be displayed on the PDF document sent to the customer. Leave it empty to use website URL from the vendor settings.', 'woovoucher')));
            //using instructions of voucher
            woocommerce_wp_textarea_input(array('id' => $prefix . 'how_to_use', 'label' => __('Redeem Instructions:', 'woovoucher'), 'description' => __('Within this option you can enter instructions on how this Voucher can be redeemed. This instruction will then be displayed on the PDF document sent to the customer after successful purchase. Limited HTML is allowed. Leave it empty to use Redeem Instructions from the vendor settings.', 'woovoucher')));
            //location fields
            $voucherlocations = array('0' => array('id' => $prefix . 'locations', 'class' => 'woo_vou_location', 'label' => __('Location:', 'woovoucher'), 'description' => __('Enter the address of the location where the Voucher Code can be redeemed. This will be displayed on the PDF document sent to the customer. Limited HTML is allowed.', 'woovoucher')), '1' => array('id' => $prefix . 'map_link', 'class' => 'woo_vou_location', 'label' => __('Location Map Link:', 'woovoucher'), 'description' => __('Enter a link to a Google Map for the location here. This will be displayed on the PDF document sent to the customer.', 'woovoucher')));
            //locations for voucher block is available
            $this->woo_vou_add_repeater_block(array('id' => $prefix . 'avail_locations', 'label' => __('Locations:', 'woovoucher'), 'description' => __('If the Vendor of the Voucher has more than one location where the Voucher can be redeemed, then you can add all the locations within this option.  Leave it empty to use locations from the vendor settings.', 'woovoucher'), 'fields' => $voucherlocations));
        }
        echo '</div>';
    }
    /**
     * Output the subscription specific pricing fields on the "Edit Product" admin page.
     *
     * @since 1.3
     */
    public static function variable_subscription_pricing_fields($loop, $variation_data, $variation)
    {
        global $woocommerce, $thepostid;
        // Set month as the default billing period
        if (!($subscription_period = get_post_meta($variation->ID, '_subscription_period', true))) {
            $subscription_period = 'month';
        }
        // When called via Ajax
        if (!function_exists('woocommerce_wp_text_input')) {
            require_once $woocommerce->plugin_path() . '/admin/post-types/writepanels/writepanels-init.php';
        }
        if (!isset($thepostid)) {
            $thepostid = $variation->post_parent;
        }
        ?>
<tr class="variable_subscription_pricing show_if_variable-subscription">
	<td colspan="2">
		<label><?php 
        printf(__('Subscription Price (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol());
        ?>
</label>
		<?php 
        // Subscription Price
        woocommerce_wp_text_input(array('id' => 'variable_subscription_price[' . $loop . ']', 'class' => 'wc_input_subscription_price', 'wrapper_class' => '_subscription_price_field', 'label' => sprintf(__('Subscription Price (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol()), 'placeholder' => __('e.g. 5.90', WC_Subscriptions::$text_domain), 'value' => get_post_meta($variation->ID, '_subscription_price', true), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
        // Subscription Period Interval
        woocommerce_wp_select(array('id' => 'variable_subscription_period_interval[' . $loop . ']', 'class' => 'wc_input_subscription_period_interval', 'wrapper_class' => '_subscription_period_interval_field', 'label' => __('Subscription Periods', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_period_interval_strings(), 'value' => get_post_meta($variation->ID, '_subscription_period_interval', true)));
        // Billing Period
        woocommerce_wp_select(array('id' => 'variable_subscription_period[' . $loop . ']', 'class' => 'wc_input_subscription_period', 'wrapper_class' => '_subscription_period_field', 'label' => __('Billing Period', WC_Subscriptions::$text_domain), 'value' => $subscription_period, 'description' => __('for', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_period_strings()));
        // Subscription Length
        woocommerce_wp_select(array('id' => 'variable_subscription_length[' . $loop . ']', 'class' => 'wc_input_subscription_length', 'wrapper_class' => '_subscription_length_field', 'label' => __('Subscription Length', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_ranges($subscription_period), 'value' => get_post_meta($variation->ID, '_subscription_length', true)));
        ?>
	</td>
	<td class="sign-up-fee-cell show_if_variable-subscription">
		<label><?php 
        printf(__('Sign-up Fee (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol());
        ?>
</label>
<?php 
        // Sign-up Fee
        woocommerce_wp_text_input(array('id' => 'variable_subscription_sign_up_fee[' . $loop . ']', 'class' => 'wc_input_subscription_intial_price', 'wrapper_class' => '_subscription_sign_up_fee_field', 'label' => sprintf(__('Sign-up Fee (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol()), 'placeholder' => __('e.g. 9.90', WC_Subscriptions::$text_domain), 'value' => get_post_meta($variation->ID, '_subscription_sign_up_fee', true), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
        ?>
	</td>
</tr>
<tr class="variable_subscription_trial show_if_variable-subscription">
	<td colspan="1" class="show_if_variable-subscription">
		<label><?php 
        _e('Free Trial', WC_Subscriptions::$text_domain);
        ?>
</label>
<?php 
        // Trial Length
        woocommerce_wp_text_input(array('id' => 'variable_subscription_trial_length[' . $loop . ']', 'class' => 'wc_input_subscription_trial_length', 'wrapper_class' => '_subscription_trial_length_field', 'label' => __('Free Trial', WC_Subscriptions::$text_domain), 'placeholder' => __('e.g. 3', WC_Subscriptions::$text_domain), 'value' => get_post_meta($variation->ID, '_subscription_trial_length', true)));
        // Trial Period
        woocommerce_wp_select(array('id' => 'variable_subscription_trial_period[' . $loop . ']', 'class' => 'wc_input_subscription_trial_period', 'wrapper_class' => '_subscription_trial_period_field', 'label' => __('Subscription Trial Period', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_available_time_periods(), 'description' => sprintf(__('An optional period of time to wait before charging the first recurring payment. Any sign up fee will still be charged at the outset of the subscription. %s', WC_Subscriptions::$text_domain), self::get_trial_period_validation_message()), 'desc_tip' => true, 'value' => WC_Subscriptions_Product::get_trial_period($variation->ID)));
        do_action('woocommerce_variable_subscription_pricing');
        ?>
	</td>
</tr>
<?php 
    }
 function get_canvas_clip_dimensions_fields()
 {
     $id = get_the_ID();
     $wpc_metas = get_post_meta($id, 'wpc-metas', true);
     $bounding_box_array = WPD_Admin::get_proper_value($wpc_metas, 'bounding_box', array());
     $clip_w = WPD_Admin::get_proper_value($bounding_box_array, "width", "");
     $clip_h = WPD_Admin::get_proper_value($bounding_box_array, "height", "");
     $clip_x = WPD_Admin::get_proper_value($bounding_box_array, "x", "");
     $clip_y = WPD_Admin::get_proper_value($bounding_box_array, "y", "");
     $clip_radius = WPD_Admin::get_proper_value($bounding_box_array, "radius", "");
     $clip_radius_rect = WPD_Admin::get_proper_value($bounding_box_array, "r_radius", 0);
     $clip_type = WPD_Admin::get_proper_value($bounding_box_array, "type", "");
     $clip_border = WPD_Admin::get_proper_value($bounding_box_array, "border_color", "");
     echo "<div class='mg-top-10 mg-left-10'><strong>" . __('BOUNDING BOX PARAMETERS', 'wpd') . ": </strong></div>";
     echo "<div class='mg-top-10 mg-left-10'>" . __('If the coordinates (X,Y) are not set, they will automatically be determined from the product center.', 'wpd') . "</strong></div>";
     woocommerce_wp_text_input(array('id' => 'wpc-metas[bounding_box][x]', 'value' => $clip_x, 'label' => __('X', 'wpd') . ' (px)', 'description' => __('Bounding box coordinate X on the product', 'wpd'), 'desc_tip' => 'true'));
     woocommerce_wp_text_input(array('id' => 'wpc-metas[bounding_box][y]', 'value' => $clip_y, 'label' => __('Y', 'wpd') . ' (px)', 'description' => __('Bounding box coordinate Y on the product', 'wpd'), 'desc_tip' => 'true'));
     echo "<div class='mg-top-10 mg-left-10'>" . __('The dimensions are required to apply a bounding box on the product.', 'wpd') . " </strong></div>";
     woocommerce_wp_text_input(array('id' => 'wpc-metas[bounding_box][width]', 'value' => $clip_w, 'label' => __('Width', 'wpd') . ' (px)', 'description' => __('Bounding box width on the product', 'wpd'), 'desc_tip' => 'true'));
     woocommerce_wp_text_input(array('id' => 'wpc-metas[bounding_box][height]', 'value' => $clip_h, 'label' => __('Height', 'wpd') . ' (px)', 'description' => __('Bounding box height on the product', 'wpd'), 'desc_tip' => 'true'));
     woocommerce_wp_text_input(array('id' => 'wpc-metas[bounding_box][r_radius]', 'value' => $clip_radius_rect, 'label' => __('Radius (rect)', 'wpd') . ' (px)', 'description' => __('Bounding box radius on the product (used for rectangle)', 'wpd'), 'desc_tip' => 'true'));
     woocommerce_wp_text_input(array('id' => 'wpc-metas[bounding_box][radius]', 'value' => $clip_radius, 'label' => __('Radius (circle)', 'wpd') . ' (px)', 'description' => __('Bounding box radius on the product (used for circle)', 'wpd'), 'desc_tip' => 'true'));
     woocommerce_wp_select(array('id' => 'wpc-metas[bounding_box][type]', 'value' => $clip_type, 'label' => __('Type', 'wpd') . ' (px)', 'description' => __('Bounding box type', 'wpd'), 'desc_tip' => 'true', 'options' => array("rect" => "Rectangle", "arc" => "Circle")));
     woocommerce_wp_text_input(array('id' => 'wpc-metas[bounding_box][border_color]', 'value' => $clip_border, 'label' => __('Border color', 'wpd'), 'description' => __('Bounding box border color', 'wpd'), 'desc_tip' => 'true'));
 }
Exemple #13
0
            <?php endif; ?>

            <?php if (is_array($subscription->shipping_address) && !empty($subscription->shipping_address)): ?>
                <p class="subscriptio_admin_address_paragaph">
                    <strong><?php _e('Shipping Address:', 'subscriptio'); ?>
                        <?php if (!$subscription->is_inactive()): ?>
                            &nbsp;&nbsp;<a id="subscriptio_admin_edit_address" href="#"><?php _e('[edit]', 'subscriptio'); ?></a>
                        <?php endif; ?>
                    </strong>
                    <span class="subscriptio_admin_address"><?php echo wp_kses(Subscriptio::get_formatted_shipping_address($subscription->shipping_address), array('br' => array())); ?></span>
                </p>
                <?php if (!$subscription->is_inactive()): ?>
                    <div class="subscriptio_admin_address_fields">
                        <?php foreach (Subscriptio_Subscription::get_admin_shipping_fields() as $key => $field): ?>
                            <?php if ($field['type'] == 'select'): ?>
                                <?php woocommerce_wp_select(array('id' => $key, 'value' => $subscription->shipping_address[$key], 'label' => $field['title'], 'options' => $field['values'])); ?>
                            <?php else: ?>
                                <?php woocommerce_wp_text_input(array('id' => $key, 'value' => $subscription->shipping_address[$key], 'label' => $field['title'])); ?>
                            <?php endif; ?>
                        <?php endforeach; ?>
                        <div class="subscriptio_admin_address_save">
                            <button type="submit" class="button subscriptio_save_address" name="subscriptio_subscription_button" value="address" title="<?php _e('Save Address', 'subscriptio'); ?>"><?php _e('Save Address', 'subscriptio'); ?></button>
                            <button class="button" id="subscriptio_cancel_address_edit" title="<?php _e('Cancel', 'subscriptio'); ?>"><?php _e('Cancel', 'subscriptio'); ?></button>
                        </div>
                    </div>
                <?php endif; ?>
            <?php endif; ?>

        </div>
        <div class="subscription_data_content">
            <h4><?php _e('Scheduled Events', 'subscriptio'); ?></h4>
function pmprowoo_tab_options()
{
    global $membership_levels, $pmprowoo_product_levels;
    $membership_level_options[0] = 'None';
    foreach ($membership_levels as $option) {
        $key = $option->id;
        $membership_level_options[$key] = $option->name;
    }
    ?>

    <div id="pmprowoo_tab_data" class="panel woocommerce_options_panel">

        <div class="options_group">
            <p class="form-field">                <?php 
    // Membership Product
    woocommerce_wp_select(array('id' => '_membership_product_level', 'label' => __('Membership Product', 'pmprowoo'), 'options' => $membership_level_options));
    ?>
            </p>
        </div>
        <div class="options-group">
            <p class="form-field">
                <?php 
    // For each membership level, create respective price field
    foreach ($membership_levels as $level) {
        woocommerce_wp_text_input(array('id' => '_level_' . $level->id . '_price', 'label' => __($level->name . " Price", 'pmprowoo'), 'placeholder' => '', 'type' => 'text', 'desc_tip' => 'true', 'data_type' => 'price'));
    }
    ?>
            </p>
        </div>
    </div>
<?php 
}
    /**
     * Output the metabox.
     *
     * @param WP_Post $post
     */
    public static function output($post)
    {
        wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
        $coupon = new WC_Coupon($post->ID);
        ?>
		<style type="text/css">
			#edit-slug-box, #minor-publishing-actions { display:none }
		</style>
		<div id="coupon_options" class="panel-wrap coupon_data">

			<div class="wc-tabs-back"></div>

			<ul class="coupon_data_tabs wc-tabs" style="display:none;">
				<?php 
        $coupon_data_tabs = apply_filters('woocommerce_coupon_data_tabs', array('general' => array('label' => __('General', 'woocommerce'), 'target' => 'general_coupon_data', 'class' => 'general_coupon_data'), 'usage_restriction' => array('label' => __('Usage restriction', 'woocommerce'), 'target' => 'usage_restriction_coupon_data', 'class' => ''), 'usage_limit' => array('label' => __('Usage limits', 'woocommerce'), 'target' => 'usage_limit_coupon_data', 'class' => '')));
        foreach ($coupon_data_tabs as $key => $tab) {
            ?>
<li class="<?php 
            echo $key;
            ?>
_options <?php 
            echo $key;
            ?>
_tab <?php 
            echo implode(' ', (array) $tab['class']);
            ?>
">
							<a href="#<?php 
            echo $tab['target'];
            ?>
"><?php 
            echo esc_html($tab['label']);
            ?>
</a>
						</li><?php 
        }
        ?>
			</ul>
			<div id="general_coupon_data" class="panel woocommerce_options_panel"><?php 
        // Type
        woocommerce_wp_select(array('id' => 'discount_type', 'label' => __('Discount type', 'woocommerce'), 'options' => wc_get_coupon_types()));
        // Amount
        woocommerce_wp_text_input(array('id' => 'coupon_amount', 'label' => __('Coupon amount', 'woocommerce'), 'placeholder' => wc_format_localized_price(0), 'description' => __('Value of the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // Free Shipping
        woocommerce_wp_checkbox(array('id' => 'free_shipping', 'label' => __('Allow free shipping', 'woocommerce'), 'description' => sprintf(__('Check this box if the coupon grants free shipping. A <a href="%s" target="_blank">free shipping method</a> must be enabled in your shipping zone and be set to require "a valid free shipping coupon" (see the "Free Shipping Requires" setting).', 'woocommerce'), 'https://docs.woocommerce.com/document/free-shipping/')));
        // Expiry date
        $expiry_date = $coupon->get_date_expires() ? date('Y-m-d', $coupon->get_date_expires()) : '';
        woocommerce_wp_text_input(array('id' => 'expiry_date', 'value' => esc_attr($expiry_date), 'label' => __('Coupon expiry date', 'woocommerce'), 'placeholder' => esc_attr__('YYYY-MM-DD', 'woocommerce'), 'description' => '', 'class' => 'date-picker', 'custom_attributes' => array('pattern' => "[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])")));
        do_action('woocommerce_coupon_options');
        ?>
</div>
			<div id="usage_restriction_coupon_data" class="panel woocommerce_options_panel"><?php 
        echo '<div class="options_group">';
        // minimum spend
        woocommerce_wp_text_input(array('id' => 'minimum_amount', 'label' => __('Minimum spend', 'woocommerce'), 'placeholder' => __('No minimum', 'woocommerce'), 'description' => __('This field allows you to set the minimum spend (subtotal, including taxes) allowed to use the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // maximum spend
        woocommerce_wp_text_input(array('id' => 'maximum_amount', 'label' => __('Maximum spend', 'woocommerce'), 'placeholder' => __('No maximum', 'woocommerce'), 'description' => __('This field allows you to set the maximum spend (subtotal, including taxes) allowed when using the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // Individual use
        woocommerce_wp_checkbox(array('id' => 'individual_use', 'label' => __('Individual use only', 'woocommerce'), 'description' => __('Check this box if the coupon cannot be used in conjunction with other coupons.', 'woocommerce')));
        // Exclude Sale Products
        woocommerce_wp_checkbox(array('id' => 'exclude_sale_items', 'label' => __('Exclude sale items', 'woocommerce'), 'description' => __('Check this box if the coupon should not apply to items on sale. Per-item coupons will only work if the item is not on sale. Per-cart coupons will only work if there are no sale items in the cart.', 'woocommerce')));
        echo '</div><div class="options_group">';
        // Product ids
        ?>
				<p class="form-field"><label><?php 
        _e('Products', 'woocommerce');
        ?>
</label>
				<input type="hidden" class="wc-product-search" data-multiple="true" style="width: 50%;" name="product_ids" data-placeholder="<?php 
        esc_attr_e('Search for a product&hellip;', 'woocommerce');
        ?>
" data-action="woocommerce_json_search_products_and_variations" data-selected="<?php 
        $product_ids = $coupon->get_product_ids();
        $json_ids = array();
        foreach ($product_ids as $product_id) {
            $product = wc_get_product($product_id);
            if (is_object($product)) {
                $json_ids[$product_id] = wp_kses_post($product->get_formatted_name());
            }
        }
        echo esc_attr(json_encode($json_ids));
        ?>
" value="<?php 
        echo implode(',', array_keys($json_ids));
        ?>
" /> <?php 
        echo wc_help_tip(__('Products which need to be in the cart to use this coupon or, for "Product Discounts", which products are discounted.', 'woocommerce'));
        ?>
</p>
				<?php 
        // Exclude Product ids
        ?>
				<p class="form-field"><label><?php 
        _e('Exclude products', 'woocommerce');
        ?>
</label>
				<input type="hidden" class="wc-product-search" data-multiple="true" style="width: 50%;" name="exclude_product_ids" data-placeholder="<?php 
        esc_attr_e('Search for a product&hellip;', 'woocommerce');
        ?>
" data-action="woocommerce_json_search_products_and_variations" data-selected="<?php 
        $product_ids = $coupon->get_excluded_product_ids();
        $json_ids = array();
        foreach ($product_ids as $product_id) {
            $product = wc_get_product($product_id);
            if (is_object($product)) {
                $json_ids[$product_id] = wp_kses_post($product->get_formatted_name());
            }
        }
        echo esc_attr(json_encode($json_ids));
        ?>
" value="<?php 
        echo implode(',', array_keys($json_ids));
        ?>
" /> <?php 
        echo wc_help_tip(__('Products which must not be in the cart to use this coupon or, for "Product Discounts", which products are not discounted.', 'woocommerce'));
        ?>
</p>
				<?php 
        echo '</div><div class="options_group">';
        // Categories
        ?>
				<p class="form-field"><label for="product_categories"><?php 
        _e('Product categories', 'woocommerce');
        ?>
</label>
				<select id="product_categories" name="product_categories[]" style="width: 50%;"  class="wc-enhanced-select" multiple="multiple" data-placeholder="<?php 
        esc_attr_e('Any category', 'woocommerce');
        ?>
">
					<?php 
        $category_ids = $coupon->get_product_categories();
        $categories = get_terms('product_cat', 'orderby=name&hide_empty=0');
        if ($categories) {
            foreach ($categories as $cat) {
                echo '<option value="' . esc_attr($cat->term_id) . '"' . selected(in_array($cat->term_id, $category_ids), true, false) . '>' . esc_html($cat->name) . '</option>';
            }
        }
        ?>
				</select> <?php 
        echo wc_help_tip(__('A product must be in this category for the coupon to remain valid or, for "Product Discounts", products in these categories will be discounted.', 'woocommerce'));
        ?>
</p>
				<?php 
        // Exclude Categories
        ?>
				<p class="form-field"><label for="exclude_product_categories"><?php 
        _e('Exclude categories', 'woocommerce');
        ?>
</label>
				<select id="exclude_product_categories" name="exclude_product_categories[]" style="width: 50%;"  class="wc-enhanced-select" multiple="multiple" data-placeholder="<?php 
        esc_attr_e('No categories', 'woocommerce');
        ?>
">
					<?php 
        $category_ids = $coupon->get_excluded_product_categories();
        $categories = get_terms('product_cat', 'orderby=name&hide_empty=0');
        if ($categories) {
            foreach ($categories as $cat) {
                echo '<option value="' . esc_attr($cat->term_id) . '"' . selected(in_array($cat->term_id, $category_ids), true, false) . '>' . esc_html($cat->name) . '</option>';
            }
        }
        ?>
				</select> <?php 
        echo wc_help_tip(__('Product must not be in this category for the coupon to remain valid or, for "Product Discounts", products in these categories will not be discounted.', 'woocommerce'));
        ?>
</p>
				<?php 
        echo '</div><div class="options_group">';
        // Customers
        woocommerce_wp_text_input(array('id' => 'customer_email', 'label' => __('Email restrictions', 'woocommerce'), 'placeholder' => __('No restrictions', 'woocommerce'), 'description' => __('List of allowed emails to check against the customer\'s billing email when an order is placed. Separate email addresses with commas.', 'woocommerce'), 'value' => implode(', ', (array) get_post_meta($post->ID, 'customer_email', true)), 'desc_tip' => true, 'type' => 'email', 'class' => '', 'custom_attributes' => array('multiple' => 'multiple')));
        echo '</div>';
        do_action('woocommerce_coupon_options_usage_restriction');
        ?>
</div>
			<div id="usage_limit_coupon_data" class="panel woocommerce_options_panel"><?php 
        echo '<div class="options_group">';
        // Usage limit per coupons
        woocommerce_wp_text_input(array('id' => 'usage_limit', 'label' => __('Usage limit per coupon', 'woocommerce'), 'placeholder' => esc_attr__('Unlimited usage', 'woocommerce'), 'description' => __('How many times this coupon can be used before it is void.', 'woocommerce'), 'type' => 'number', 'desc_tip' => true, 'class' => 'short', 'custom_attributes' => array('step' => 1, 'min' => 0), 'value' => $coupon->get_usage_limit() ? $coupon->get_usage_limit() : ''));
        // Usage limit per product
        woocommerce_wp_text_input(array('id' => 'limit_usage_to_x_items', 'label' => __('Limit usage to X items', 'woocommerce'), 'placeholder' => esc_attr__('Apply to all qualifying items in cart', 'woocommerce'), 'description' => __('The maximum number of individual items this coupon can apply to when using product discounts. Leave blank to apply to all qualifying items in cart.', 'woocommerce'), 'desc_tip' => true, 'class' => 'short', 'type' => 'number', 'custom_attributes' => array('step' => 1, 'min' => 0), 'value' => $coupon->get_limit_usage_to_x_items() ? $coupon->get_limit_usage_to_x_items() : ''));
        // Usage limit per users
        woocommerce_wp_text_input(array('id' => 'usage_limit_per_user', 'label' => __('Usage limit per user', 'woocommerce'), 'placeholder' => esc_attr__('Unlimited usage', 'woocommerce'), 'description' => __('How many times this coupon can be used by an invidual user. Uses billing email for guests, and user ID for logged in users.', 'woocommerce'), 'desc_tip' => true, 'class' => 'short', 'type' => 'number', 'custom_attributes' => array('step' => 1, 'min' => 0), 'value' => $coupon->get_usage_limit_per_user() ? $coupon->get_usage_limit_per_user() : ''));
        echo '</div>';
        do_action('woocommerce_coupon_options_usage_limit');
        ?>
</div>
			<?php 
        do_action('woocommerce_coupon_data_panels');
        ?>
			<div class="clear"></div>
		</div>
		<?php 
    }
/**
 * Displays the order data meta box.
 *
 * @access public
 * @param mixed $post
 * @return void
 */
function woocommerce_order_data_meta_box($post)
{
    global $post, $wpdb, $thepostid, $order_status, $woocommerce;
    $thepostid = $post->ID;
    $order = new WC_Order($thepostid);
    wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
    // Custom user
    $customer_user = (int) get_post_meta($post->ID, '_customer_user', true);
    // Order status
    $order_status = wp_get_post_terms($post->ID, 'shop_order_status');
    if ($order_status) {
        $order_status = current($order_status);
        $order_status = $order_status->slug;
    } else {
        $order_status = apply_filters('woocommerce_default_order_status', 'pending');
    }
    if (!isset($post->post_title) || empty($post->post_title)) {
        $order_title = 'Order';
    } else {
        $order_title = $post->post_title;
    }
    ?>
	<style type="text/css">
		#titlediv, #major-publishing-actions, #minor-publishing-actions, #visibility, #submitdiv { display:none }
	</style>
	<div class="panel-wrap woocommerce">
		<input name="post_title" type="hidden" value="<?php 
    echo esc_attr($order_title);
    ?>
" />
		<input name="post_status" type="hidden" value="publish" />
		<div id="order_data" class="panel">

			<div class="order_data_left">

				<h2><?php 
    _e('Order Details', 'woocommerce');
    ?>
 &mdash; <?php 
    echo $order->get_order_number();
    ?>
</h2>

				<p class="form-field"><label for="order_status"><?php 
    _e('Order status:', 'woocommerce');
    ?>
</label>
				<select id="order_status" name="order_status" class="chosen_select">
					<?php 
    $statuses = (array) get_terms('shop_order_status', array('hide_empty' => 0, 'orderby' => 'id'));
    foreach ($statuses as $status) {
        echo '<option value="' . $status->slug . '" ';
        if ($status->slug == $order_status) {
            echo 'selected="selected"';
        }
        echo '>' . __($status->name, 'woocommerce') . '</option>';
    }
    ?>
				</select></p>

				<p class="form-field last"><label for="order_date"><?php 
    _e('Order Date:', 'woocommerce');
    ?>
</label>
					<input type="text" class="date-picker-field" name="order_date" id="order_date" maxlength="10" value="<?php 
    echo date_i18n('Y-m-d', strtotime($post->post_date));
    ?>
" /> @ <input type="text" class="hour" placeholder="<?php 
    _e('h', 'woocommerce');
    ?>
" name="order_date_hour" id="order_date_hour" maxlength="2" size="2" value="<?php 
    echo date_i18n('H', strtotime($post->post_date));
    ?>
" />:<input type="text" class="minute" placeholder="<?php 
    _e('m', 'woocommerce');
    ?>
" name="order_date_minute" id="order_date_minute" maxlength="2" size="2" value="<?php 
    echo date_i18n('i', strtotime($post->post_date));
    ?>
" />
				</p>

				<p class="form-field form-field-wide">
					<label for="customer_user"><?php 
    _e('Customer:', 'woocommerce');
    ?>
</label>
					<select id="customer_user" name="customer_user" class="ajax_chosen_select_customer">
						<option value=""><?php 
    _e('Guest', 'woocommerce');
    ?>
</option>
						<?php 
    if ($customer_user) {
        $user = get_user_by('id', $customer_user);
        echo '<option value="' . $user->ID . '" ';
        selected(1, 1);
        echo '>' . $user->display_name . ' (#' . $user->ID . ' &ndash; ' . $user->user_email . ')</option>';
    }
    ?>
					</select>
					<?php 
    // Ajax Chosen Customer Selectors JS
    $woocommerce->add_inline_js("\n\t\t\t\t\t\tjQuery('select.ajax_chosen_select_customer').ajaxChosen({\n\t\t\t\t\t\t    method: \t\t'GET',\n\t\t\t\t\t\t    url: \t\t\t'" . admin_url('admin-ajax.php') . "',\n\t\t\t\t\t\t    dataType: \t\t'json',\n\t\t\t\t\t\t    afterTypeDelay: 100,\n\t\t\t\t\t\t    minTermLength: \t1,\n\t\t\t\t\t\t    data:\t\t{\n\t\t\t\t\t\t    \taction: \t'woocommerce_json_search_customers',\n\t\t\t\t\t\t\t\tsecurity: \t'" . wp_create_nonce("search-customers") . "'\n\t\t\t\t\t\t    }\n\t\t\t\t\t\t}, function (data) {\n\n\t\t\t\t\t\t\tvar terms = {};\n\n\t\t\t\t\t\t    \$.each(data, function (i, val) {\n\t\t\t\t\t\t        terms[i] = val;\n\t\t\t\t\t\t    });\n\n\t\t\t\t\t\t    return terms;\n\t\t\t\t\t\t});\n\t\t\t\t\t");
    ?>
				</p>

				<?php 
    if (get_option('woocommerce_enable_order_comments') != 'no') {
        ?>
				<p class="form-field form-field-wide"><label for="excerpt"><?php 
        _e('Customer Note:', 'woocommerce');
        ?>
</label>
				<textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt" placeholder="<?php 
        _e('Customer\'s notes about the order', 'woocommerce');
        ?>
"><?php 
        echo $post->post_excerpt;
        ?>
</textarea></p>
				<?php 
    }
    ?>

				<?php 
    do_action('woocommerce_admin_order_data_after_order_details', $order);
    ?>

			</div>
			<div class="order_data_right">
				<div class="order_data">
					<h2><?php 
    _e('Billing Details', 'woocommerce');
    ?>
 <a class="edit_address" href="#">(<?php 
    _e('Edit', 'woocommerce');
    ?>
)</a></h2>
					<?php 
    $billing_data = apply_filters('woocommerce_admin_billing_fields', array('first_name' => array('label' => __('First Name', 'woocommerce'), 'show' => false), 'last_name' => array('label' => __('Last Name', 'woocommerce'), 'show' => false), 'company' => array('label' => __('Company', 'woocommerce'), 'show' => false), 'address_1' => array('label' => __('Address 1', 'woocommerce'), 'show' => false), 'address_2' => array('label' => __('Address 2', 'woocommerce'), 'show' => false), 'city' => array('label' => __('City', 'woocommerce'), 'show' => false), 'postcode' => array('label' => __('Postcode', 'woocommerce'), 'show' => false), 'country' => array('label' => __('Country', 'woocommerce'), 'show' => false, 'type' => 'select', 'options' => array('' => __('Select a country&hellip;', 'woocommerce')) + $woocommerce->countries->get_allowed_countries()), 'state' => array('label' => __('State/County', 'woocommerce'), 'show' => false), 'email' => array('label' => __('Email', 'woocommerce')), 'phone' => array('label' => __('Phone', 'woocommerce'))));
    // Display values
    echo '<div class="address">';
    if ($order->get_formatted_billing_address()) {
        echo '<p><strong>' . __('Address', 'woocommerce') . ':</strong><br/> ' . $order->get_formatted_billing_address() . '</p>';
    } else {
        echo '<p class="none_set"><strong>' . __('Address', 'woocommerce') . ':</strong> ' . __('No billing address set.', 'woocommerce') . '</p>';
    }
    foreach ($billing_data as $key => $field) {
        if (isset($field['show']) && !$field['show']) {
            continue;
        }
        $field_name = 'billing_' . $key;
        if ($order->{$field_name}) {
            echo '<p><strong>' . $field['label'] . ':</strong> ' . $order->{$field_name} . '</p>';
        }
    }
    echo '</div>';
    // Display form
    echo '<div class="edit_address"><p><button class="button load_customer_billing">' . __('Load billing address', 'woocommerce') . '</button></p>';
    foreach ($billing_data as $key => $field) {
        if (!isset($field['type'])) {
            $field['type'] = 'text';
        }
        switch ($field['type']) {
            case "select":
                woocommerce_wp_select(array('id' => '_billing_' . $key, 'label' => $field['label'], 'options' => $field['options']));
                break;
            default:
                woocommerce_wp_text_input(array('id' => '_billing_' . $key, 'label' => $field['label']));
                break;
        }
    }
    echo '</div>';
    do_action('woocommerce_admin_order_data_after_billing_address', $order);
    ?>
				</div>
				<div class="order_data order_data_alt">

					<h2><?php 
    _e('Shipping Details', 'woocommerce');
    ?>
 <a class="edit_address" href="#">(<?php 
    _e('Edit', 'woocommerce');
    ?>
)</a></h2>
					<?php 
    $shipping_data = apply_filters('woocommerce_admin_shipping_fields', array('first_name' => array('label' => __('First Name', 'woocommerce'), 'show' => false), 'last_name' => array('label' => __('Last Name', 'woocommerce'), 'show' => false), 'company' => array('label' => __('Company', 'woocommerce'), 'show' => false), 'address_1' => array('label' => __('Address 1', 'woocommerce'), 'show' => false), 'address_2' => array('label' => __('Address 2', 'woocommerce'), 'show' => false), 'city' => array('label' => __('City', 'woocommerce'), 'show' => false), 'postcode' => array('label' => __('Postcode', 'woocommerce'), 'show' => false), 'country' => array('label' => __('Country', 'woocommerce'), 'show' => false, 'type' => 'select', 'options' => array('' => __('Select a country&hellip;', 'woocommerce')) + $woocommerce->countries->get_allowed_countries()), 'state' => array('label' => __('State/County', 'woocommerce'), 'show' => false)));
    // Display values
    echo '<div class="address">';
    if ($order->get_formatted_shipping_address()) {
        echo '<p><strong>' . __('Address', 'woocommerce') . ':</strong><br/> ' . $order->get_formatted_shipping_address() . '</p>';
    } else {
        echo '<p class="none_set"><strong>' . __('Address', 'woocommerce') . ':</strong> ' . __('No shipping address set.', 'woocommerce') . '</p>';
    }
    if ($shipping_data) {
        foreach ($shipping_data as $key => $field) {
            if (isset($field['show']) && !$field['show']) {
                continue;
            }
            $field_name = 'shipping_' . $key;
            if ($order->{$field_name}) {
                echo '<p><strong>' . $field['label'] . ':</strong> ' . $order->{$field_name} . '</p>';
            }
        }
    }
    echo '</div>';
    // Display form
    echo '<div class="edit_address"><p><button class="button load_customer_shipping">' . __('Load shipping address', 'woocommerce') . '</button> <button class="button billing-same-as-shipping">' . __('Copy from billing', 'woocommerce') . '</button></p>';
    if ($shipping_data) {
        foreach ($shipping_data as $key => $field) {
            if (!isset($field['type'])) {
                $field['type'] = 'text';
            }
            switch ($field['type']) {
                case "select":
                    woocommerce_wp_select(array('id' => '_shipping_' . $key, 'label' => $field['label'], 'options' => $field['options']));
                    break;
                default:
                    woocommerce_wp_text_input(array('id' => '_shipping_' . $key, 'label' => $field['label']));
                    break;
            }
        }
    }
    echo '</div>';
    do_action('woocommerce_admin_order_data_after_shipping_address', $order);
    ?>
				</div>
			</div>
			<div class="clear"></div>

		</div>
	</div>
	<?php 
}
 /**
  * Output the subscription specific pricing fields on the "Edit Product" admin page.
  * 
  * @since 1.0
  */
 public static function subscription_pricing_fields()
 {
     global $post;
     // Set month as the default billing period
     if (!($subscription_period = get_post_meta($post->ID, '_subscription_period', true))) {
         $subscription_period = 'month';
     }
     echo '<div class="options_group show_if_subscription subscription_pricing">';
     // Subscription Price
     woocommerce_wp_text_input(array('id' => '_subscription_price', 'class' => 'wc_input_subscription_price', 'label' => sprintf(__('Subscription Price (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol()), 'placeholder' => __('e.g. 5.90', WC_Subscriptions::$text_domain)));
     // Subscription Period Interval
     woocommerce_wp_select(array('id' => '_subscription_period_interval', 'class' => 'wc_input_subscription_period_interval', 'label' => __('Subscription Periods', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_period_interval_strings()));
     // Billing Period
     woocommerce_wp_select(array('id' => '_subscription_period', 'class' => 'wc_input_subscription_period', 'label' => __('Billing Period', WC_Subscriptions::$text_domain), 'value' => $subscription_period, 'description' => __('for', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_period_strings()));
     // Subscription Length
     woocommerce_wp_select(array('id' => '_subscription_length', 'class' => 'wc_input_subscription_length', 'label' => __('Subscription Length', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_ranges($subscription_period), 'description' => sprintf(__('with a %s', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol())));
     // Sign-up Fee
     woocommerce_wp_text_input(array('id' => '_subscription_sign_up_fee', 'class' => 'wc_input_subscription_intial_price', 'label' => sprintf(__('Sign-up Fee (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol()), 'placeholder' => __('e.g. 9.90', WC_Subscriptions::$text_domain), 'description' => __('sign-up fee and', WC_Subscriptions::$text_domain)));
     // Trial Period
     woocommerce_wp_select(array('id' => '_subscription_trial_length', 'class' => 'wc_input_subscription_trial_length', 'label' => __('Subscription Trial Period', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_trial_lengths($subscription_period), 'description' => __('free trial', WC_Subscriptions::$text_domain)));
     do_action('woocommerce_subscriptions_product_options_pricing');
     echo '</div>';
 }
    /**
     * Output the metabox
     */
    public static function output($post)
    {
        global $post, $thepostid;
        wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
        $thepostid = $post->ID;
        if ($terms = wp_get_object_terms($post->ID, 'product_type')) {
            $product_type = sanitize_title(current($terms)->name);
        } else {
            $product_type = apply_filters('default_product_type', 'simple');
        }
        $product_type_selector = apply_filters('product_type_selector', array('simple' => __('Simple product', 'woocommerce'), 'grouped' => __('Grouped product', 'woocommerce'), 'external' => __('External/Affiliate product', 'woocommerce'), 'variable' => __('Variable product', 'woocommerce')), $product_type);
        $type_box = '<label for="product-type"><select id="product-type" name="product-type"><optgroup label="' . __('Product Type', 'woocommerce') . '">';
        foreach ($product_type_selector as $value => $label) {
            $type_box .= '<option value="' . esc_attr($value) . '" ' . selected($product_type, $value, false) . '>' . esc_html($label) . '</option>';
        }
        $type_box .= '</optgroup></select></label>';
        $product_type_options = apply_filters('product_type_options', array('virtual' => array('id' => '_virtual', 'wrapper_class' => 'show_if_simple', 'label' => __('Virtual', 'woocommerce'), 'description' => __('Virtual products are intangible and aren\'t shipped.', 'woocommerce'), 'default' => 'no'), 'downloadable' => array('id' => '_downloadable', 'wrapper_class' => 'show_if_simple', 'label' => __('Downloadable', 'woocommerce'), 'description' => __('Downloadable products give access to a file upon purchase.', 'woocommerce'), 'default' => 'no')));
        foreach ($product_type_options as $key => $option) {
            $selected_value = get_post_meta($post->ID, '_' . $key, true);
            if ('' == $selected_value && isset($option['default'])) {
                $selected_value = $option['default'];
            }
            $type_box .= '<label for="' . esc_attr($option['id']) . '" class="' . esc_attr($option['wrapper_class']) . ' tips" data-tip="' . esc_attr($option['description']) . '">' . esc_html($option['label']) . ': <input type="checkbox" name="' . esc_attr($option['id']) . '" id="' . esc_attr($option['id']) . '" ' . checked($selected_value, 'yes', false) . ' /></label>';
        }
        ?>
		<div class="panel-wrap product_data">

			<span class="type_box"> &mdash; <?php 
        echo $type_box;
        ?>
</span>

			<ul class="product_data_tabs wc-tabs" style="display:none;">
				<?php 
        $product_data_tabs = apply_filters('woocommerce_product_data_tabs', array('general' => array('label' => __('General', 'woocommerce'), 'target' => 'general_product_data', 'class' => array('hide_if_grouped')), 'inventory' => array('label' => __('Inventory', 'woocommerce'), 'target' => 'inventory_product_data', 'class' => array('show_if_simple', 'show_if_variable', 'show_if_grouped')), 'shipping' => array('label' => __('Shipping', 'woocommerce'), 'target' => 'shipping_product_data', 'class' => array('hide_if_virtual', 'hide_if_grouped', 'hide_if_external')), 'linked_product' => array('label' => __('Linked Products', 'woocommerce'), 'target' => 'linked_product_data', 'class' => array()), 'attribute' => array('label' => __('Attributes', 'woocommerce'), 'target' => 'product_attributes', 'class' => array()), 'variations' => array('label' => __('Variations', 'woocommerce'), 'target' => 'variable_product_options', 'class' => array('variations_tab', 'show_if_variable')), 'advanced' => array('label' => __('Advanced', 'woocommerce'), 'target' => 'advanced_product_data', 'class' => array())));
        foreach ($product_data_tabs as $key => $tab) {
            ?>
<li class="<?php 
            echo $key;
            ?>
_options <?php 
            echo $key;
            ?>
_tab <?php 
            echo implode(' ', $tab['class']);
            ?>
">
							<a href="#<?php 
            echo $tab['target'];
            ?>
"><?php 
            echo esc_html($tab['label']);
            ?>
</a>
						</li><?php 
        }
        do_action('woocommerce_product_write_panel_tabs');
        ?>
			</ul>
			<div id="general_product_data" class="panel woocommerce_options_panel"><?php 
        echo '<div class="options_group hide_if_grouped">';
        // SKU
        if (wc_product_sku_enabled()) {
            woocommerce_wp_text_input(array('id' => '_sku', 'label' => '<abbr title="' . __('Stock Keeping Unit', 'woocommerce') . '">' . __('SKU', 'woocommerce') . '</abbr>', 'desc_tip' => 'true', 'description' => __('SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased.', 'woocommerce')));
        } else {
            echo '<input type="hidden" name="_sku" value="' . esc_attr(get_post_meta($thepostid, '_sku', true)) . '" />';
        }
        do_action('woocommerce_product_options_sku');
        echo '</div>';
        echo '<div class="options_group show_if_external">';
        // External URL
        woocommerce_wp_text_input(array('id' => '_product_url', 'label' => __('Product URL', 'woocommerce'), 'placeholder' => 'http://', 'description' => __('Enter the external URL to the product.', 'woocommerce')));
        // Button text
        woocommerce_wp_text_input(array('id' => '_button_text', 'label' => __('Button text', 'woocommerce'), 'placeholder' => _x('Buy product', 'placeholder', 'woocommerce'), 'description' => __('This text will be shown on the button linking to the external product.', 'woocommerce')));
        echo '</div>';
        echo '<div class="options_group pricing show_if_simple show_if_external">';
        // Price
        woocommerce_wp_text_input(array('id' => '_regular_price', 'label' => __('Regular Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
        // Special Price
        woocommerce_wp_text_input(array('id' => '_sale_price', 'data_type' => 'price', 'label' => __('Sale Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'description' => '<a href="#" class="sale_schedule">' . __('Schedule', 'woocommerce') . '</a>'));
        // Special Price date range
        $sale_price_dates_from = ($date = get_post_meta($thepostid, '_sale_price_dates_from', true)) ? date_i18n('Y-m-d', $date) : '';
        $sale_price_dates_to = ($date = get_post_meta($thepostid, '_sale_price_dates_to', true)) ? date_i18n('Y-m-d', $date) : '';
        echo '<p class="form-field sale_price_dates_fields">
								<label for="_sale_price_dates_from">' . __('Sale Price Dates', 'woocommerce') . '</label>
								<input type="text" class="short" name="_sale_price_dates_from" id="_sale_price_dates_from" value="' . esc_attr($sale_price_dates_from) . '" placeholder="' . _x('From&hellip;', 'placeholder', 'woocommerce') . ' YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
								<input type="text" class="short" name="_sale_price_dates_to" id="_sale_price_dates_to" value="' . esc_attr($sale_price_dates_to) . '" placeholder="' . _x('To&hellip;', 'placeholder', 'woocommerce') . '  YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
								<a href="#" class="cancel_sale_schedule">' . __('Cancel', 'woocommerce') . '</a>
								<img class="help_tip" style="margin-top: 21px;" data-tip="' . __('The sale will end at the beginning of the set date.', 'woocommerce') . '" src="' . esc_url(WC()->plugin_url()) . '/assets/images/help.png" height="16" width="16" />
							</p>';
        do_action('woocommerce_product_options_pricing');
        echo '</div>';
        echo '<div class="options_group show_if_downloadable">';
        ?>
					<div class="form-field downloadable_files">
						<label><?php 
        _e('Downloadable Files', 'woocommerce');
        ?>
:</label>
						<table class="widefat">
							<thead>
								<tr>
									<th class="sort">&nbsp;</th>
									<th><?php 
        _e('Name', 'woocommerce');
        ?>
 <span class="tips" data-tip="<?php 
        _e('This is the name of the download shown to the customer.', 'woocommerce');
        ?>
">[?]</span></th>
									<th colspan="2"><?php 
        _e('File URL', 'woocommerce');
        ?>
 <span class="tips" data-tip="<?php 
        _e('This is the URL or absolute path to the file which customers will get access to. URLs entered here should already be encoded.', 'woocommerce');
        ?>
">[?]</span></th>
									<th>&nbsp;</th>
								</tr>
							</thead>
							<tbody>
								<?php 
        $downloadable_files = get_post_meta($post->ID, '_downloadable_files', true);
        if ($downloadable_files) {
            foreach ($downloadable_files as $key => $file) {
                include 'views/html-product-download.php';
            }
        }
        ?>
							</tbody>
							<tfoot>
								<tr>
									<th colspan="5">
										<a href="#" class="button insert" data-row="<?php 
        $file = array('file' => '', 'name' => '');
        ob_start();
        include 'views/html-product-download.php';
        echo esc_attr(ob_get_clean());
        ?>
"><?php 
        _e('Add File', 'woocommerce');
        ?>
</a>
									</th>
								</tr>
							</tfoot>
						</table>
					</div>
					<?php 
        // Download Limit
        woocommerce_wp_text_input(array('id' => '_download_limit', 'label' => __('Download Limit', 'woocommerce'), 'placeholder' => __('Unlimited', 'woocommerce'), 'description' => __('Leave blank for unlimited re-downloads.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '0')));
        // Expirey
        woocommerce_wp_text_input(array('id' => '_download_expiry', 'label' => __('Download Expiry', 'woocommerce'), 'placeholder' => __('Never', 'woocommerce'), 'description' => __('Enter the number of days before a download link expires, or leave blank.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '0')));
        // Download Type
        woocommerce_wp_select(array('id' => '_download_type', 'label' => __('Download Type', 'woocommerce'), 'description' => sprintf(__('Choose a download type - this controls the <a href="%s">schema</a>.', 'woocommerce'), 'http://schema.org/'), 'options' => array('' => __('Standard Product', 'woocommerce'), 'application' => __('Application/Software', 'woocommerce'), 'music' => __('Music', 'woocommerce'))));
        do_action('woocommerce_product_options_downloads');
        echo '</div>';
        if (wc_tax_enabled()) {
            echo '<div class="options_group show_if_simple show_if_external show_if_variable">';
            // Tax
            woocommerce_wp_select(array('id' => '_tax_status', 'label' => __('Tax Status', 'woocommerce'), 'options' => array('taxable' => __('Taxable', 'woocommerce'), 'shipping' => __('Shipping only', 'woocommerce'), 'none' => _x('None', 'Tax status', 'woocommerce'))));
            $tax_classes = WC_Tax::get_tax_classes();
            $classes_options = array();
            $classes_options[''] = __('Standard', 'woocommerce');
            if (!empty($tax_classes)) {
                foreach ($tax_classes as $class) {
                    $classes_options[sanitize_title($class)] = esc_html($class);
                }
            }
            woocommerce_wp_select(array('id' => '_tax_class', 'label' => __('Tax Class', 'woocommerce'), 'options' => $classes_options));
            do_action('woocommerce_product_options_tax');
            echo '</div>';
        }
        do_action('woocommerce_product_options_general_product_data');
        ?>
			</div>

			<div id="inventory_product_data" class="panel woocommerce_options_panel">

				<?php 
        echo '<div class="options_group">';
        if ('yes' == get_option('woocommerce_manage_stock')) {
            // manage stock
            woocommerce_wp_checkbox(array('id' => '_manage_stock', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __('Manage stock?', 'woocommerce'), 'description' => __('Enable stock management at product level', 'woocommerce')));
            do_action('woocommerce_product_options_stock');
            echo '<div class="stock_fields show_if_simple show_if_variable">';
            // Stock
            woocommerce_wp_text_input(array('id' => '_stock', 'label' => __('Stock Qty', 'woocommerce'), 'desc_tip' => true, 'description' => __('Stock quantity. If this is a variable product this value will be used to control stock for all variations, unless you define stock at variation level.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => 'any'), 'data_type' => 'stock'));
            // Backorders?
            woocommerce_wp_select(array('id' => '_backorders', 'label' => __('Allow Backorders?', 'woocommerce'), 'options' => array('no' => __('Do not allow', 'woocommerce'), 'notify' => __('Allow, but notify customer', 'woocommerce'), 'yes' => __('Allow', 'woocommerce')), 'desc_tip' => true, 'description' => __('If managing stock, this controls whether or not backorders are allowed. If enabled, stock quantity can go below 0.', 'woocommerce')));
            do_action('woocommerce_product_options_stock_fields');
            echo '</div>';
        }
        // Stock status
        woocommerce_wp_select(array('id' => '_stock_status', 'wrapper_class' => 'hide_if_variable', 'label' => __('Stock status', 'woocommerce'), 'options' => array('instock' => __('In stock', 'woocommerce'), 'outofstock' => __('Out of stock', 'woocommerce')), 'desc_tip' => true, 'description' => __('Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce')));
        do_action('woocommerce_product_options_stock_status');
        echo '</div>';
        echo '<div class="options_group show_if_simple show_if_variable">';
        // Individual product
        woocommerce_wp_checkbox(array('id' => '_sold_individually', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __('Sold Individually', 'woocommerce'), 'description' => __('Enable this to only allow one of this item to be bought in a single order', 'woocommerce')));
        do_action('woocommerce_product_options_sold_individually');
        echo '</div>';
        do_action('woocommerce_product_options_inventory_product_data');
        ?>

			</div>

			<div id="shipping_product_data" class="panel woocommerce_options_panel">

				<?php 
        echo '<div class="options_group">';
        // Weight
        if (wc_product_weight_enabled()) {
            woocommerce_wp_text_input(array('id' => '_weight', 'label' => __('Weight', 'woocommerce') . ' (' . get_option('woocommerce_weight_unit') . ')', 'placeholder' => wc_format_localized_decimal(0), 'desc_tip' => 'true', 'description' => __('Weight in decimal form', 'woocommerce'), 'type' => 'text', 'data_type' => 'decimal'));
        }
        // Size fields
        if (wc_product_dimensions_enabled()) {
            ?>
<p class="form-field dimensions_field">
							<label for="product_length"><?php 
            echo __('Dimensions', 'woocommerce') . ' (' . get_option('woocommerce_dimension_unit') . ')';
            ?>
</label>
							<span class="wrap">
								<input id="product_length" placeholder="<?php 
            _e('Length', 'woocommerce');
            ?>
" class="input-text wc_input_decimal" size="6" type="text" name="_length" value="<?php 
            echo esc_attr(wc_format_localized_decimal(get_post_meta($thepostid, '_length', true)));
            ?>
" />
								<input placeholder="<?php 
            _e('Width', 'woocommerce');
            ?>
" class="input-text wc_input_decimal" size="6" type="text" name="_width" value="<?php 
            echo esc_attr(wc_format_localized_decimal(get_post_meta($thepostid, '_width', true)));
            ?>
" />
								<input placeholder="<?php 
            _e('Height', 'woocommerce');
            ?>
" class="input-text wc_input_decimal last" size="6" type="text" name="_height" value="<?php 
            echo esc_attr(wc_format_localized_decimal(get_post_meta($thepostid, '_height', true)));
            ?>
" />
							</span>
							<img class="help_tip" data-tip="<?php 
            esc_attr_e('LxWxH in decimal form', 'woocommerce');
            ?>
" src="<?php 
            echo esc_url(WC()->plugin_url());
            ?>
/assets/images/help.png" height="16" width="16" />
						</p><?php 
        }
        do_action('woocommerce_product_options_dimensions');
        echo '</div>';
        echo '<div class="options_group">';
        // Shipping Class
        $classes = get_the_terms($thepostid, 'product_shipping_class');
        if ($classes && !is_wp_error($classes)) {
            $current_shipping_class = current($classes)->term_id;
        } else {
            $current_shipping_class = '';
        }
        $args = array('taxonomy' => 'product_shipping_class', 'hide_empty' => 0, 'show_option_none' => __('No shipping class', 'woocommerce'), 'name' => 'product_shipping_class', 'id' => 'product_shipping_class', 'selected' => $current_shipping_class, 'class' => 'select short');
        ?>
<p class="form-field dimensions_field"><label for="product_shipping_class"><?php 
        _e('Shipping class', 'woocommerce');
        ?>
</label> <?php 
        wp_dropdown_categories($args);
        ?>
 <img class="help_tip" data-tip="<?php 
        esc_attr_e('Shipping classes are used by certain shipping methods to group similar products.', 'woocommerce');
        ?>
" src="<?php 
        echo esc_url(WC()->plugin_url());
        ?>
/assets/images/help.png" height="16" width="16" /></p><?php 
        do_action('woocommerce_product_options_shipping');
        echo '</div>';
        ?>

			</div>

			<div id="product_attributes" class="panel wc-metaboxes-wrapper">
				<div class="product_attributes wc-metaboxes">

					<?php 
        global $wc_product_attributes;
        // Array of defined attribute taxonomies
        $attribute_taxonomies = wc_get_attribute_taxonomies();
        // Product attributes - taxonomies and custom, ordered, with visibility and variation attributes set
        $attributes = maybe_unserialize(get_post_meta($thepostid, '_product_attributes', true));
        // Output All Set Attributes
        if (!empty($attributes)) {
            $attribute_keys = array_keys($attributes);
            $attribute_total = sizeof($attribute_keys);
            for ($i = 0; $i < $attribute_total; $i++) {
                $attribute = $attributes[$attribute_keys[$i]];
                $position = empty($attribute['position']) ? 0 : absint($attribute['position']);
                $taxonomy = '';
                $metabox_class = array();
                if ($attribute['is_taxonomy']) {
                    $taxonomy = $attribute['name'];
                    if (!taxonomy_exists($taxonomy)) {
                        continue;
                    }
                    $attribute_taxonomy = $wc_product_attributes[$taxonomy];
                    $metabox_class[] = 'taxonomy';
                    $metabox_class[] = $taxonomy;
                    $attribute_label = wc_attribute_label($taxonomy);
                } else {
                    $attribute_label = apply_filters('woocommerce_attribute_label', $attribute['name'], $attribute['name']);
                }
                include 'views/html-product-attribute.php';
            }
        }
        ?>
				</div>

				<p class="toolbar">
					<button type="button" class="button button-primary add_attribute"><?php 
        _e('Add', 'woocommerce');
        ?>
</button>
					<select name="attribute_taxonomy" class="attribute_taxonomy">
						<option value=""><?php 
        _e('Custom product attribute', 'woocommerce');
        ?>
</option>
						<?php 
        if ($attribute_taxonomies) {
            foreach ($attribute_taxonomies as $tax) {
                $attribute_taxonomy_name = wc_attribute_taxonomy_name($tax->attribute_name);
                $label = $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name;
                echo '<option value="' . esc_attr($attribute_taxonomy_name) . '">' . esc_html($label) . '</option>';
            }
        }
        ?>
					</select>

					<button type="button" class="button save_attributes"><?php 
        _e('Save attributes', 'woocommerce');
        ?>
</button>
				</p>
				<?php 
        do_action('woocommerce_product_options_attributes');
        ?>
			</div>
			<div id="linked_product_data" class="panel woocommerce_options_panel">

				<div class="options_group">

					<p class="form-field">
						<label for="upsell_ids"><?php 
        _e('Up-Sells', 'woocommerce');
        ?>
</label>
						<input type="hidden" class="wc-product-search" style="width: 50%;" id="upsell_ids" name="upsell_ids" data-placeholder="<?php 
        _e('Search for a product&hellip;', 'woocommerce');
        ?>
" data-action="woocommerce_json_search_products" data-multiple="true" data-exclude="<?php 
        echo intval($post->ID);
        ?>
" data-selected="<?php 
        $product_ids = array_filter(array_map('absint', (array) get_post_meta($post->ID, '_upsell_ids', true)));
        $json_ids = array();
        foreach ($product_ids as $product_id) {
            $product = wc_get_product($product_id);
            if (is_object($product)) {
                $json_ids[$product_id] = wp_kses_post(html_entity_decode($product->get_formatted_name()));
            }
        }
        echo esc_attr(json_encode($json_ids));
        ?>
" value="<?php 
        echo implode(',', array_keys($json_ids));
        ?>
" /> <img class="help_tip" data-tip='<?php 
        _e('Up-sells are products which you recommend instead of the currently viewed product, for example, products that are more profitable or better quality or more expensive.', 'woocommerce');
        ?>
' src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/help.png" height="16" width="16" />
					</p>

					<p class="form-field">
						<label for="crosssell_ids"><?php 
        _e('Cross-Sells', 'woocommerce');
        ?>
</label>
						<input type="hidden" class="wc-product-search" style="width: 50%;" id="crosssell_ids" name="crosssell_ids" data-placeholder="<?php 
        _e('Search for a product&hellip;', 'woocommerce');
        ?>
" data-action="woocommerce_json_search_products" data-multiple="true" data-exclude="<?php 
        echo intval($post->ID);
        ?>
" data-selected="<?php 
        $product_ids = array_filter(array_map('absint', (array) get_post_meta($post->ID, '_crosssell_ids', true)));
        $json_ids = array();
        foreach ($product_ids as $product_id) {
            $product = wc_get_product($product_id);
            if (is_object($product)) {
                $json_ids[$product_id] = wp_kses_post(html_entity_decode($product->get_formatted_name()));
            }
        }
        echo esc_attr(json_encode($json_ids));
        ?>
" value="<?php 
        echo implode(',', array_keys($json_ids));
        ?>
" /> <img class="help_tip" data-tip='<?php 
        _e('Cross-sells are products which you promote in the cart, based on the current product.', 'woocommerce');
        ?>
' src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/help.png" height="16" width="16" />
					</p>
				</div>

				<div class="options_group grouping show_if_simple show_if_external">

					<p class="form-field">
						<label for="parent_id"><?php 
        _e('Grouping', 'woocommerce');
        ?>
</label>
						<input type="hidden" class="wc-product-search" style="width: 50%;" id="parent_id" name="parent_id" data-placeholder="<?php 
        _e('Search for a product&hellip;', 'woocommerce');
        ?>
" data-action="woocommerce_json_search_grouped_products" data-allow_clear="true" data-multiple="false" data-exclude="<?php 
        echo intval($post->ID);
        ?>
" data-selected="<?php 
        $parent_id = absint($post->post_parent);
        if ($parent_id) {
            $parent = wc_get_product($parent_id);
            if (is_object($parent)) {
                $parent_title = wp_kses_post(html_entity_decode($parent->get_formatted_name()));
            }
            echo esc_attr($parent_title);
        }
        ?>
" value="<?php 
        echo $parent_id ? $parent_id : '';
        ?>
" /> <img class="help_tip" data-tip='<?php 
        _e('Set this option to make this product part of a grouped product.', 'woocommerce');
        ?>
' src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/help.png" height="16" width="16" />
					</p>

					<?php 
        woocommerce_wp_hidden_input(array('id' => 'previous_parent_id', 'value' => absint($post->post_parent)));
        do_action('woocommerce_product_options_grouping');
        ?>
				</div>

				<?php 
        do_action('woocommerce_product_options_related');
        ?>
			</div>

			<div id="advanced_product_data" class="panel woocommerce_options_panel">

				<div class="options_group hide_if_external">
					<?php 
        // Purchase note
        woocommerce_wp_textarea_input(array('id' => '_purchase_note', 'label' => __('Purchase Note', 'woocommerce'), 'desc_tip' => 'true', 'description' => __('Enter an optional note to send the customer after purchase.', 'woocommerce')));
        ?>
				</div>

				<div class="options_group">
					<?php 
        // menu_order
        woocommerce_wp_text_input(array('id' => 'menu_order', 'label' => __('Menu order', 'woocommerce'), 'desc_tip' => 'true', 'description' => __('Custom ordering position.', 'woocommerce'), 'value' => intval($post->menu_order), 'type' => 'number', 'custom_attributes' => array('step' => '1')));
        ?>
				</div>

				<div class="options_group reviews">
					<?php 
        woocommerce_wp_checkbox(array('id' => 'comment_status', 'label' => __('Enable reviews', 'woocommerce'), 'cbvalue' => 'open', 'value' => esc_attr($post->comment_status)));
        do_action('woocommerce_product_options_reviews');
        ?>
				</div>

				<?php 
        do_action('woocommerce_product_options_advanced');
        ?>

			</div>

			<?php 
        self::output_variations();
        do_action('woocommerce_product_data_panels');
        do_action('woocommerce_product_write_panels');
        // _deprecated
        ?>

			<div class="clear"></div>

		</div>
		<?php 
    }
            
            <?php 
// Select
woocommerce_wp_select(array('id' => $public_perfix . 'tab_sticky_width', 'label' => __('Content Width', EXTRA_WOO_TABS_TEXTDOMAN), 'description' => __('Enter Sticky Content Width.', EXTRA_WOO_TABS_TEXTDOMAN), 'desc_tip' => 'true', 'value' => $custom_tab_options['public_fields'][$public_perfix . 'tab_sticky_width'], 'options' => array('pw-content-1' => '2:3', 'pw-content-2' => '1:2', 'pw-content-3' => '1:3', 'pw-content-4' => '1:4', 'pw-content-full' => __('Full', EXTRA_WOO_TABS_TEXTDOMAN))));
$dependency = array('parent_id' => $public_perfix . 'tab_sticky_enabled', 'value' => 'true');
dependency($public_perfix . 'tab_sticky_width', $dependency);
?>
            
            <?php 
// Number Field
woocommerce_wp_text_input(array('id' => $public_perfix . 'tab_sticky_height', 'label' => __('Content Height (Pixel)', EXTRA_WOO_TABS_TEXTDOMAN), 'description' => __('Enter Sticky Content Height.', EXTRA_WOO_TABS_TEXTDOMAN), 'type' => 'number', 'value' => $custom_tab_options['public_fields'][$public_perfix . 'tab_sticky_height'], 'custom_attributes' => array('step' => 'any', 'min' => '0')));
$dependency = array('parent_id' => $public_perfix . 'tab_sticky_enabled', 'value' => 'true');
dependency($public_perfix . 'tab_sticky_height', $dependency);
?>
            
            <?php 
// Select
woocommerce_wp_select(array('id' => $public_perfix . 'tab_sticky_position', 'label' => __('Sticky Button Position', EXTRA_WOO_TABS_TEXTDOMAN), 'description' => __('Choose Sticky Position', EXTRA_WOO_TABS_TEXTDOMAN), 'desc_tip' => 'true', 'value' => $custom_tab_options['public_fields'][$public_perfix . 'tab_sticky_position'], 'options' => array('pw-left-stick' => __('Left Side', EXTRA_WOO_TABS_TEXTDOMAN), 'pw-right-stick' => __('Right Side', EXTRA_WOO_TABS_TEXTDOMAN))));
$dependency = array('parent_id' => $public_perfix . 'tab_sticky_enabled', 'value' => 'true');
dependency($public_perfix . 'tab_sticky_position', $dependency);
?>
            <?php 
if ($product_tab_use_all == 'on') {
    woocommerce_wp_checkbox(array('id' => $public_perfix . 'tab_content_changed', 'label' => __('Content Changed', EXTRA_WOO_TABS_TEXTDOMAN), 'description' => __('If You Change Below Content, Please Check This Features', EXTRA_WOO_TABS_TEXTDOMAN), 'value' => $custom_tab_options['public_fields'][$public_perfix . 'tab_content_changed'], 'cbvalue' => 'yes'));
}
?>
            
        </div>
      </div>
    </div>
</div>
    /**
     * Output the metabox
     */
    public static function output($post)
    {
        global $theorder;
        if (!is_object($theorder)) {
            $theorder = wc_get_order($post->ID);
        }
        $order = $theorder;
        self::init_address_fields();
        if (WC()->payment_gateways()) {
            $payment_gateways = WC()->payment_gateways->payment_gateways();
        } else {
            $payment_gateways = array();
        }
        $payment_method = !empty($order->payment_method) ? $order->payment_method : '';
        wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
        ?>
		<style type="text/css">
			#post-body-content, #titlediv { display:none }
		</style>
		<div class="panel-wrap woocommerce">
			<input name="post_title" type="hidden" value="<?php 
        echo empty($post->post_title) ? 'Order' : esc_attr($post->post_title);
        ?>
" />
			<input name="post_status" type="hidden" value="<?php 
        echo esc_attr($post->post_status);
        ?>
" />
			<div id="order_data" class="panel">

				<h2><?php 
        printf(__('Order #%s Details', 'woocommerce'), esc_html($order->get_order_number()));
        ?>
</h2>
				<p class="order_number"><?php 
        if ($payment_method) {
            printf(__('Payment via %s', 'woocommerce'), isset($payment_gateways[$payment_method]) ? esc_html($payment_gateways[$payment_method]->get_title()) : esc_html($payment_method));
            if ($transaction_id = $order->get_transaction_id()) {
                if (isset($payment_gateways[$payment_method]) && ($url = $payment_gateways[$payment_method]->get_transaction_url($order))) {
                    echo ' (<a href="' . esc_url($url) . '" target="_blank">' . esc_html($transaction_id) . '</a>)';
                } else {
                    echo ' (' . esc_html($transaction_id) . ')';
                }
            }
            echo '. ';
        }
        if ($ip_address = get_post_meta($post->ID, '_customer_ip_address', true)) {
            echo __('Customer IP', 'woocommerce') . ': ' . esc_html($ip_address);
        }
        ?>
</p>

				<div class="order_data_column_container">
					<div class="order_data_column">
						<h4><?php 
        _e('General Details', 'woocommerce');
        ?>
</h4>

						<p class="form-field form-field-wide"><label for="order_date"><?php 
        _e('Order date:', 'woocommerce');
        ?>
</label>
							<input type="text" class="date-picker" name="order_date" id="order_date" maxlength="10" value="<?php 
        echo date_i18n('Y-m-d', strtotime($post->post_date));
        ?>
" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />@<input type="text" class="hour" placeholder="<?php 
        _e('h', 'woocommerce');
        ?>
" name="order_date_hour" id="order_date_hour" maxlength="2" size="2" value="<?php 
        echo date_i18n('H', strtotime($post->post_date));
        ?>
" pattern="\-?\d+(\.\d{0,})?" />:<input type="text" class="minute" placeholder="<?php 
        _e('m', 'woocommerce');
        ?>
" name="order_date_minute" id="order_date_minute" maxlength="2" size="2" value="<?php 
        echo date_i18n('i', strtotime($post->post_date));
        ?>
" pattern="\-?\d+(\.\d{0,})?" />
						</p>

						<p class="form-field form-field-wide"><label for="order_status"><?php 
        _e('Order status:', 'woocommerce');
        ?>
</label>
						<select id="order_status" name="order_status" class="wc-enhanced-select">
							<?php 
        $statuses = wc_get_order_statuses();
        foreach ($statuses as $status => $status_name) {
            echo '<option value="' . esc_attr($status) . '" ' . selected($status, 'wc-' . $order->get_status(), false) . '>' . esc_html($status_name) . '</option>';
        }
        ?>
						</select></p>

						<p class="form-field form-field-wide wc-customer-user">
							<label for="customer_user"><?php 
        _e('Customer:', 'woocommerce');
        ?>
 <?php 
        if (!empty($order->customer_user)) {
            $args = array('post_status' => 'all', 'post_type' => 'shop_order', '_customer_user' => absint($order->customer_user));
            printf('<a href="%s">%s &rarr;</a>', esc_url(add_query_arg($args, admin_url('edit.php'))), __('View other orders', 'woocommerce'));
        }
        ?>
</label>
							<?php 
        $user_string = '';
        $user_id = '';
        if (!empty($order->customer_user)) {
            $user_id = absint($order->customer_user);
            $user = get_user_by('id', $user_id);
            $user_string = esc_html($user->display_name) . ' (#' . absint($user->ID) . ' &ndash; ' . esc_html($user->user_email);
        }
        ?>
							<input type="hidden" class="wc-customer-search" id="customer_user" name="customer_user" data-placeholder="<?php 
        _e('Guest', 'woocommerce');
        ?>
" data-selected="<?php 
        echo htmlspecialchars($user_string);
        ?>
" value="<?php 
        echo $user_id;
        ?>
" data-allow_clear="true" />
						</p>
						<?php 
        do_action('woocommerce_admin_order_data_after_order_details', $order);
        ?>
					</div>
					<div class="order_data_column">
						<h4><?php 
        _e('Billing Details', 'woocommerce');
        ?>
 <a class="edit_address" href="#"><img src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/icons/edit.png" alt="<?php 
        _e('Edit', 'woocommerce');
        ?>
" width="14" /></a></h4>
						<?php 
        // Display values
        echo '<div class="address">';
        if ($order->get_formatted_billing_address()) {
            echo '<p><strong>' . __('Address', 'woocommerce') . ':</strong>' . wp_kses($order->get_formatted_billing_address(), array('br' => array())) . '</p>';
        } else {
            echo '<p class="none_set"><strong>' . __('Address', 'woocommerce') . ':</strong> ' . __('No billing address set.', 'woocommerce') . '</p>';
        }
        foreach (self::$billing_fields as $key => $field) {
            if (isset($field['show']) && false === $field['show']) {
                continue;
            }
            $field_name = 'billing_' . $key;
            if ($order->{$field_name}) {
                echo '<p><strong>' . esc_html($field['label']) . ':</strong> ' . make_clickable(esc_html($order->{$field_name})) . '</p>';
            }
        }
        echo '</div>';
        // Display form
        echo '<div class="edit_address"><p><button class="button load_customer_billing">' . __('Load billing address', 'woocommerce') . '</button></p>';
        foreach (self::$billing_fields as $key => $field) {
            if (!isset($field['type'])) {
                $field['type'] = 'text';
            }
            if (!isset($field['id'])) {
                $field['id'] = '_billing_' . $key;
            }
            switch ($field['type']) {
                case 'select':
                    woocommerce_wp_select($field);
                    break;
                default:
                    woocommerce_wp_text_input($field);
                    break;
            }
        }
        ?>
							<p class="form-field form-field-wide">
								<label><?php 
        _e('Payment Method:', 'woocommerce');
        ?>
</label>
								<select name="_payment_method" id="_payment_method" class="first">
									<option value=""><?php 
        _e('N/A', 'woocommerce');
        ?>
</option>
									<?php 
        $found_method = false;
        foreach ($payment_gateways as $gateway) {
            if ($gateway->enabled == "yes") {
                echo '<option value="' . esc_attr($gateway->id) . '" ' . selected($payment_method, $gateway->id, false) . '>' . esc_html($gateway->get_title()) . '</option>';
                if ($payment_method == $gateway->id) {
                    $found_method = true;
                }
            }
        }
        if (!$found_method && !empty($payment_method)) {
            echo '<option value="' . esc_attr($payment_method) . '" selected="selected">' . __('Other', 'woocommerce') . '</option>';
        } else {
            echo '<option value="other">' . __('Other', 'woocommerce') . '</option>';
        }
        ?>
								</select>
							</p>
							<?php 
        woocommerce_wp_text_input(array('id' => '_transaction_id', 'label' => __('Transaction ID', 'woocommerce')));
        echo '</div>';
        do_action('woocommerce_admin_order_data_after_billing_address', $order);
        ?>
					</div>
					<div class="order_data_column">

						<h4><?php 
        _e('Shipping Details', 'woocommerce');
        ?>
 <a class="edit_address" href="#"><img src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/icons/edit.png" alt="<?php 
        _e('Edit', 'woocommerce');
        ?>
" width="14" /></a></h4>
						<?php 
        // Display values
        echo '<div class="address">';
        if ($order->get_formatted_shipping_address()) {
            echo '<p><strong>' . __('Address', 'woocommerce') . ':</strong>' . wp_kses($order->get_formatted_shipping_address(), array('br' => array())) . '</p>';
        } else {
            echo '<p class="none_set"><strong>' . __('Address', 'woocommerce') . ':</strong> ' . __('No shipping address set.', 'woocommerce') . '</p>';
        }
        if (self::$shipping_fields) {
            foreach (self::$shipping_fields as $key => $field) {
                if (isset($field['show']) && false === $field['show']) {
                    continue;
                }
                $field_name = 'shipping_' . $key;
                if (!empty($order->{$field_name})) {
                    echo '<p><strong>' . esc_html($field['label']) . ':</strong> ' . make_clickable(esc_html($order->{$field_name})) . '</p>';
                }
            }
        }
        if (apply_filters('woocommerce_enable_order_notes_field', 'yes' == get_option('woocommerce_enable_order_comments', 'yes')) && $post->post_excerpt) {
            echo '<p><strong>' . __('Customer Note', 'woocommerce') . ':</strong> ' . nl2br(esc_html($post->post_excerpt)) . '</p>';
        }
        echo '</div>';
        // Display form
        echo '<div class="edit_address"><p><button class="button load_customer_shipping">' . __('Load shipping address', 'woocommerce') . '</button> <button class="button billing-same-as-shipping">' . __('Copy from billing', 'woocommerce') . '</button></p>';
        if (self::$shipping_fields) {
            foreach (self::$shipping_fields as $key => $field) {
                if (!isset($field['type'])) {
                    $field['type'] = 'text';
                }
                if (!isset($field['id'])) {
                    $field['id'] = '_shipping_' . $key;
                }
                switch ($field['type']) {
                    case 'select':
                        woocommerce_wp_select($field);
                        break;
                    default:
                        woocommerce_wp_text_input($field);
                        break;
                }
            }
        }
        if (apply_filters('woocommerce_enable_order_notes_field', 'yes' == get_option('woocommerce_enable_order_comments', 'yes'))) {
            ?>
								<p class="form-field form-field-wide"><label for="excerpt"><?php 
            _e('Customer Note:', 'woocommerce');
            ?>
</label>
								<textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt" placeholder="<?php 
            _e('Customer\'s notes about the order', 'woocommerce');
            ?>
"><?php 
            echo wp_kses_post($post->post_excerpt);
            ?>
</textarea></p>
								<?php 
        }
        echo '</div>';
        do_action('woocommerce_admin_order_data_after_shipping_address', $order);
        ?>
					</div>
				</div>
				<div class="clear"></div>
			</div>
		</div>
		<?php 
    }
		<?php 
woocommerce_wp_text_input(array('id' => '_wc_booking_min_duration', 'label' => __('Minimum duration', 'woocommerce-bookings'), 'description' => __('The minimum allowed duration the user can input.', 'woocommerce-bookings'), 'value' => max(absint(get_post_meta($post_id, '_wc_booking_min_duration', true)), 1), 'desc_tip' => true, 'type' => 'number', 'custom_attributes' => array('min' => '', 'step' => '1')));
woocommerce_wp_text_input(array('id' => '_wc_booking_max_duration', 'label' => __('Maximum duration', 'woocommerce-bookings'), 'description' => __('The maximum allowed duration the user can input.', 'woocommerce-bookings'), 'value' => max(absint(get_post_meta($post_id, '_wc_booking_max_duration', true)), 1), 'desc_tip' => true, 'type' => 'number', 'custom_attributes' => array('min' => '', 'step' => '1')));
?>

		<div id="enable-range-picker">
			<?php 
woocommerce_wp_checkbox(array('id' => '_wc_booking_enable_range_picker', 'label' => __('Enable Calendar Range Picker?', 'woocommerce-bookings'), 'description' => __('Lets the user select a start and end date on the calendar - duration will be calculated automatically.', 'woocommerce-bookings')));
?>
		</div>

	</div>

	<?php 
woocommerce_wp_select(array('id' => '_wc_booking_calendar_display_mode', 'label' => __('Calendar display mode', 'woocommerce-bookings'), 'description' => __('Choose how the calendar is displayed on the booking form.', 'woocommerce-bookings'), 'options' => array('' => __('Display calendar on click', 'woocommerce-bookings'), 'always_visible' => __('Calendar always visible', 'woocommerce-bookings')), 'desc_tip' => true, 'class' => 'select'));
woocommerce_wp_checkbox(array('id' => '_wc_booking_requires_confirmation', 'label' => __('Requires confirmation?', 'woocommerce-bookings'), 'description' => __('Check this box if the booking requires admin approval/confirmation. Payment will not be taken during checkout.', 'woocommerce-bookings')));
woocommerce_wp_checkbox(array('id' => '_wc_booking_user_can_cancel', 'label' => __('Can be cancelled?', 'woocommerce-bookings'), 'description' => __('Check this box if the booking can be cancelled by the customer after it has been purchased. A refund will not be sent automatically.', 'woocommerce-bookings')));
$cancel_limit = max(absint(get_post_meta($post_id, '_wc_booking_cancel_limit', true)), 1);
$cancel_limit_unit = get_post_meta($post_id, '_wc_booking_cancel_limit_unit', true);
?>
	<p class="form-field booking-cancel-limit">
		<label for="_wc_booking_cancel_limit"><?php 
_e('Booking can be cancelled until', 'woocommerce-bookings');
?>
</label>
		<input type="number" name="_wc_booking_cancel_limit" id="_wc_booking_cancel_limit" value="<?php 
echo $cancel_limit;
?>
" step="1" min="1" style="margin-right: 7px; width: 4em;">
		<select name="_wc_booking_cancel_limit_unit" id="_wc_booking_cancel_limit_unit" class="short" style="width: auto; margin-right: 7px;">
 function write_panel()
 {
     echo '<div class="options_group">';
     woocommerce_wp_select(array('id' => '_woocommerce_product_gallery_slider_enabled', 'label' => __('Enable Gallery Slider (product page)', 'wc_product_gallery_slider'), 'description' => __('Choose whether to enable the slider for this product on product detail pages.', 'wc_product_gallery_slider'), 'options' => array('' => __('Default', 'wc_product_gallery_slider'), 'yes' => __('Yes', 'wc_product_gallery_slider'), 'no' => __('No', 'wc_product_gallery_slider'))));
     woocommerce_wp_select(array('id' => '_woocommerce_product_gallery_slider_archives_enabled', 'label' => __('Enable Gallery Slider (archives)', 'wc_product_gallery_slider'), 'description' => __('Choose whether to enable the slider for this product on product archives', 'wc_product_gallery_slider'), 'options' => array('' => __('Default', 'wc_product_gallery_slider'), 'yes' => __('Yes', 'wc_product_gallery_slider'), 'no' => __('No', 'wc_product_gallery_slider'))));
     echo '</div>';
 }
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
?>
<div class="wc-metaboxes-wrapper">

	<div id="billing-schedule">
		<?php 
if ($the_subscription->can_date_be_updated('next_payment')) {
    ?>
		<div class="billing-schedule-edit wcs-date-input"><?php 
    // Subscription Period Interval
    echo woocommerce_wp_select(array('id' => '_billing_interval', 'class' => 'billing_interval', 'label' => __('Recurring:', 'woocommerce-subscriptions'), 'value' => empty($the_subscription->billing_interval) ? 1 : $the_subscription->billing_interval, 'options' => wcs_get_subscription_period_interval_strings()));
    // Billing Period
    echo woocommerce_wp_select(array('id' => '_billing_period', 'class' => 'billing_period', 'label' => __('Billing Period:', 'woocommerce-subscriptions'), 'value' => empty($the_subscription->billing_period) ? 'month' : $the_subscription->billing_period, 'options' => wcs_get_subscription_period_strings()));
    ?>
			<input type="hidden" name="wcs-lengths" id="wcs-lengths" data-subscription_lengths="<?php 
    echo esc_attr(json_encode(wcs_get_subscription_ranges()));
    ?>
">
		</div>
		<?php 
} else {
    ?>
		<strong><?php 
    esc_html_e('Recurring:', 'woocommerce-subscriptions');
    ?>
</strong>
		<?php 
    printf('%s %s', esc_html(wcs_get_subscription_period_interval_strings($the_subscription->billing_interval)), esc_html(wcs_get_subscription_period_strings(1, $the_subscription->billing_period)));
    public function meta_box_inner($post)
    {
        wp_nonce_field('wc_bookings_details_meta_box', 'wc_bookings_details_meta_box_nonce');
        // Scripts.
        wp_enqueue_script('ajax-chosen');
        wp_enqueue_script('chosen');
        wp_enqueue_script('jquery-ui-datepicker');
        $customer_id = get_post_meta($post->ID, '_booking_customer_id', true);
        $order_parent_id = apply_filters('woocommerce_order_number', _x('#', 'hash before order number', 'woocommerce-bookings') . $post->post_parent, $post->post_parent);
        ?>
		<style type="text/css">
			#post-body-content, #titlediv, #major-publishing-actions, #minor-publishing-actions, #visibility, #submitdiv { display:none }
		</style>
		<div class="panel-wrap woocommerce">
			<div id="booking_data" class="panel">

			<h2><?php 
        _e('Booking Details', 'woocommerce-bookings');
        ?>
</h2>
			<p class="booking_number"><?php 
        printf(__('Booking number: #%s.', 'woocommerce-bookings'), esc_html($post->ID));
        if ($post->post_parent) {
            $order = new WC_Order($post->post_parent);
            printf(' ' . __('Order number: %s.', 'woocommerce-bookings'), '<a href="' . admin_url('post.php?post=' . absint($post->post_parent) . '&action=edit') . '">' . esc_html($order->get_order_number()) . '</a>');
        }
        ?>
</p>

			<div class="booking_data_column_container">
				<div class="booking_data_column">

					<h4><?php 
        _e('General Details', 'woocommerce-bookings');
        ?>
</h4>

					<p class="form-field form-field-wide">
						<label for="_booking_order_id"><?php 
        _e('Order ID:', 'woocommerce-bookings');
        ?>
</label>
						<select id="_booking_order_id" name="_booking_order_id" class="ajax_chosen_select_booking_order_id" data-placeholder="<?php 
        _e('Select an order&hellip;', 'woocommerce-bookings');
        ?>
">
							<?php 
        if ($post->post_parent) {
            echo '<option value="' . esc_attr($post->post_parent) . '" ' . selected(1, 1, false) . '>' . $order_parent_id . ' &ndash; ' . esc_html(get_the_title($post->post_parent)) . '</option>';
        }
        ?>
						</select>
					</p>

					<p class="form-field form-field-wide"><label for="booking_date"><?php 
        _e('Date created:', 'woocommerce-bookings');
        ?>
</label>
						<input type="text" class="date-picker-field" name="booking_date" id="booking_date" maxlength="10" value="<?php 
        echo date_i18n('Y-m-d', strtotime($post->post_date));
        ?>
" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" /> @ <input type="text" class="hour" placeholder="<?php 
        _e('h', 'woocommerce-bookings');
        ?>
" name="booking_date_hour" id="booking_date_hour" maxlength="2" size="2" value="<?php 
        echo date_i18n('H', strtotime($post->post_date));
        ?>
" pattern="\-?\d+(\.\d{0,})?" />:<input type="text" class="minute" placeholder="<?php 
        _e('m', 'woocommerce-bookings');
        ?>
" name="booking_date_minute" id="booking_date_minute" maxlength="2" size="2" value="<?php 
        echo date_i18n('i', strtotime($post->post_date));
        ?>
" pattern="\-?\d+(\.\d{0,})?" />
					</p>

					<?php 
        $statuses = array('unpaid' => __('unpaid', 'woocommerce-bookings'), 'pending' => __('pending', 'woocommerce-bookings'), 'confirmed' => __('confirmed', 'woocommerce-bookings'), 'paid' => __('paid', 'woocommerce-bookings'), 'cancelled' => __('cancelled', 'woocommerce-bookings'), 'complete' => __('complete', 'woocommerce-bookings'));
        ?>

					<p class="form-field form-field-wide">
						<label for="_booking_status"><?php 
        _e('Booking Status:', 'woocommerce-bookings');
        ?>
</label>
						<select id="_booking_status" name="_booking_status">
							<?php 
        foreach ($statuses as $key => $value) {
            echo '<option value="' . esc_attr($key) . '" ' . selected($key, $post->post_status, false) . '>' . esc_html__($value, 'woocommerce-bookings') . '</option>';
        }
        ?>
						</select>
					</p>

					<p class="form-field form-field-wide">
						<label for="_booking_customer_id"><?php 
        _e('Customer:', 'woocommerce-bookings');
        ?>
</label>
						<select id="_booking_customer_id" name="_booking_customer_id" class="ajax_chosen_select_customer">
							<option value=""><?php 
        _e('Guest', 'woocommerce-bookings');
        ?>
</option>
							<?php 
        if ($customer_id) {
            $user = get_user_by('id', $customer_id);
            echo '<option value="' . esc_attr($user->ID) . '" ' . selected(1, 1, false) . '>' . esc_html($user->display_name) . ' (#' . absint($user->ID) . ' &ndash; ' . esc_html($user->user_email) . ')</option>';
        }
        ?>
						</select>
					</p>

					<?php 
        do_action('woocommerce_admin_booking_data_after_booking_details', $post->ID);
        ?>

				</div>
				<div class="booking_data_column">

					<h4><?php 
        _e('Booking Specification', 'woocommerce-bookings');
        ?>
</h4>

					<?php 
        $bookable_products = array('' => __('N/A', 'woocommerce-bookings'));
        $products = WC_Bookings_Admin::get_booking_products();
        foreach ($products as $product) {
            $bookable_products[$product->ID] = $product->post_title;
            $resources = wc_booking_get_product_resources($product->ID);
            foreach ($resources as $resource) {
                $bookable_products[$product->ID . '=>' . $resource->ID] = '&nbsp;&nbsp;&nbsp;' . $resource->post_title;
            }
        }
        $product_id = get_post_meta($post->ID, '_booking_product_id', true);
        $resource_id = get_post_meta($post->ID, '_booking_resource_id', true);
        woocommerce_wp_select(array('id' => 'product_or_resource_id', 'label' => __('Booked Product', 'woocommerce-bookings'), 'options' => $bookable_products, 'value' => $resource_id ? $product_id . '=>' . $resource_id : $product_id));
        woocommerce_wp_text_input(array('id' => '_booking_parent_id', 'label' => __('Parent Booking ID', 'woocommerce-bookings'), 'placeholder' => 'N/A'));
        $persons = get_post_meta($post->ID, '_booking_persons', true);
        if (!empty($persons) && is_array($persons)) {
            echo '<br class="clear" />';
            echo '<h4>' . __('Person(s)', 'woocommerce-bookings') . '</h4>';
            foreach ($persons as $person_id => $person_count) {
                woocommerce_wp_text_input(array('id' => '_booking_person_' . $person_id, 'label' => get_the_title($person_id), 'placeholder' => '0', 'value' => $person_count, 'wrapper_class' => 'booking-person'));
            }
        }
        ?>
				</div>
				<div class="booking_data_column">

					<h4><?php 
        _e('Booking Date/Time', 'woocommerce-bookings');
        ?>
</h4>

					<?php 
        woocommerce_wp_text_input(array('id' => 'booking_start_date', 'label' => __('Start date', 'woocommerce-bookings'), 'placeholder' => 'yyyy-mm-dd', 'value' => date('Y-m-d', strtotime(get_post_meta($post->ID, '_booking_start', true))), 'class' => 'date-picker-field'));
        woocommerce_wp_text_input(array('id' => 'booking_end_date', 'label' => __('End date', 'woocommerce-bookings'), 'placeholder' => 'yyyy-mm-dd', 'value' => date('Y-m-d', strtotime(get_post_meta($post->ID, '_booking_end', true))), 'class' => 'date-picker-field'));
        woocommerce_wp_checkbox(array('id' => '_booking_all_day', 'label' => __('All day', 'woocommerce-bookings'), 'description' => __('Check this box if the booking is for all day.', 'woocommerce-bookings'), 'value' => get_post_meta($post->ID, '_booking_all_day', true) ? 'yes' : 'no'));
        woocommerce_wp_text_input(array('id' => 'booking_start_time', 'label' => __('Start time', 'woocommerce-bookings'), 'placeholder' => 'hh:mm', 'value' => date('H:i', strtotime(get_post_meta($post->ID, '_booking_start', true))), 'class' => 'datepicker'));
        woocommerce_wp_text_input(array('id' => 'booking_end_time', 'label' => __('End time', 'woocommerce-bookings'), 'placeholder' => 'hh:mm', 'value' => date('H:i', strtotime(get_post_meta($post->ID, '_booking_end', true)))));
        ?>

				</div>
			</div>
			<div class="clear"></div>
		</div>

		<?php 
        wc_enqueue_js("\n\t\t\t\t\$( '#_booking_all_day' ).change( function () {\n\t\t\t\t\tif ( \$( this ).is( ':checked' ) ) {\n\t\t\t\t\t\t\$( '#booking_start_time, #booking_end_time' ).closest( 'p' ).hide();\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\$( '#booking_start_time, #booking_end_time' ).closest( 'p' ).show();\n\t\t\t\t\t}\n\t\t\t\t}).change();\n\n\t\t\t\t\$( 'select#_booking_order_id' ).ajaxChosen({\n\t\t\t\t\tmethod:         'GET',\n\t\t\t\t\turl:            '" . admin_url('admin-ajax.php') . "',\n\t\t\t\t\tdataType:       'json',\n\t\t\t\t\tafterTypeDelay: 100,\n\t\t\t\t\tminTermLength:  1,\n\t\t\t\t\tdata: {\n\t\t\t\t\t\taction:   'wc_bookings_json_search_order',\n\t\t\t\t\t\tsecurity: '" . wp_create_nonce('search-booking-order') . "'\n\t\t\t\t\t}\n\t\t\t\t}, function ( data ) {\n\n\t\t\t\t\tvar orders = {};\n\n\t\t\t\t\t\$.each( data, function ( i, val ) {\n\t\t\t\t\t\torders[i] = val;\n\t\t\t\t\t});\n\n\t\t\t\t\treturn orders;\n\t\t\t\t});\n\n\t\t\t\t\$( 'select#_booking_status' ).chosen({\n\t\t\t\t\tdisable_search: true\n\t\t\t\t});\n\n\t\t\t\t\$( 'select.ajax_chosen_select_customer' ).ajaxChosen({\n\t\t\t\t\tmethod:         'GET',\n\t\t\t\t\turl:            '" . admin_url('admin-ajax.php') . "',\n\t\t\t\t\tdataType:       'json',\n\t\t\t\t\tafterTypeDelay: 100,\n\t\t\t\t\tminTermLength:  1,\n\t\t\t\t\tdata: {\n\t\t\t\t\t\taction:   'woocommerce_json_search_customers',\n\t\t\t\t\t\tsecurity: '" . wp_create_nonce('search-customers') . "'\n\t\t\t\t\t}\n\t\t\t\t}, function ( data ) {\n\n\t\t\t\t\tvar terms = {};\n\n\t\t\t\t\t\$.each( data, function ( i, val ) {\n\t\t\t\t\t\tterms[i] = val;\n\t\t\t\t\t});\n\n\t\t\t\t\treturn terms;\n\t\t\t\t});\n\n\t\t\t\t\$( 'select#product_or_resource_id' ).chosen();\n\n\t\t\t\t\$( '.date-picker-field' ).datepicker({\n\t\t\t\t\tdateFormat: 'yy-mm-dd',\n\t\t\t\t\tnumberOfMonths: 1,\n\t\t\t\t\tshowButtonPanel: true,\n\t\t\t\t});\n\t\t\t");
    }
    /**
     * Output the metabox
     */
    public static function output($post)
    {
        wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
        ?>
		<style type="text/css">
			#edit-slug-box, #minor-publishing-actions { display:none }
		</style>
		<div id="coupon_options" class="panel-wrap coupon_data">

			<div class="wc-tabs-back"></div>

			<ul class="coupon_data_tabs wc-tabs" style="display:none;">
				<?php 
        $coupon_data_tabs = apply_filters('woocommerce_coupon_data_tabs', array('general' => array('label' => __('General', 'woocommerce'), 'target' => 'general_coupon_data', 'class' => 'general_coupon_data'), 'usage_restriction' => array('label' => __('Usage Restriction', 'woocommerce'), 'target' => 'usage_restriction_coupon_data', 'class' => ''), 'usage_limit' => array('label' => __('Usage Limits', 'woocommerce'), 'target' => 'usage_limit_coupon_data', 'class' => '')));
        foreach ($coupon_data_tabs as $key => $tab) {
            ?>
<li class="<?php 
            echo $key;
            ?>
_options <?php 
            echo $key;
            ?>
_tab <?php 
            echo implode(' ', (array) $tab['class']);
            ?>
">
							<a href="#<?php 
            echo $tab['target'];
            ?>
"><?php 
            echo esc_html($tab['label']);
            ?>
</a>
						</li><?php 
        }
        ?>
			</ul>
			<div id="general_coupon_data" class="panel woocommerce_options_panel"><?php 
        // Type
        woocommerce_wp_select(array('id' => 'discount_type', 'label' => __('Discount type', 'woocommerce'), 'options' => wc_get_coupon_types()));
        // Amount
        woocommerce_wp_text_input(array('id' => 'coupon_amount', 'label' => __('Coupon amount', 'woocommerce'), 'placeholder' => wc_format_localized_price(0), 'description' => __('Value of the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // Free Shipping
        woocommerce_wp_checkbox(array('id' => 'free_shipping', 'label' => __('Allow free shipping', 'woocommerce'), 'description' => sprintf(__('Check this box if the coupon grants free shipping. The <a href="%s">free shipping method</a> must be enabled with the "must use coupon" setting.', 'woocommerce'), admin_url('admin.php?page=wc-settings&tab=shipping&section=WC_Shipping_Free_Shipping'))));
        // Apply before tax
        woocommerce_wp_checkbox(array('id' => 'apply_before_tax', 'label' => __('Apply before tax', 'woocommerce'), 'description' => __('Check this box if the coupon should be applied before calculating cart tax.', 'woocommerce')));
        // Expiry date
        woocommerce_wp_text_input(array('id' => 'expiry_date', 'label' => __('Coupon expiry date', 'woocommerce'), 'placeholder' => _x('YYYY-MM-DD', 'placeholder', 'woocommerce'), 'description' => '', 'class' => 'date-picker', 'custom_attributes' => array('pattern' => "[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])")));
        do_action('woocommerce_coupon_options');
        ?>
</div>
			<div id="usage_restriction_coupon_data" class="panel woocommerce_options_panel"><?php 
        echo '<div class="options_group">';
        // minimum spend
        woocommerce_wp_text_input(array('id' => 'minimum_amount', 'label' => __('Minimum spend', 'woocommerce'), 'placeholder' => __('No minimum', 'woocommerce'), 'description' => __('This field allows you to set the minimum subtotal needed to use the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // maximum spend
        woocommerce_wp_text_input(array('id' => 'maximum_amount', 'label' => __('Maximum spend', 'woocommerce'), 'placeholder' => __('No maximum', 'woocommerce'), 'description' => __('This field allows you to set the maximum subtotal allowed when using the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // Individual use
        woocommerce_wp_checkbox(array('id' => 'individual_use', 'label' => __('Individual use only', 'woocommerce'), 'description' => __('Check this box if the coupon cannot be used in conjunction with other coupons.', 'woocommerce')));
        // Exclude Sale Products
        woocommerce_wp_checkbox(array('id' => 'exclude_sale_items', 'label' => __('Exclude sale items', 'woocommerce'), 'description' => __('Check this box if the coupon should not apply to items on sale. Per-item coupons will only work if the item is not on sale. Per-cart coupons will only work if there are no sale items in the cart.', 'woocommerce')));
        echo '</div><div class="options_group">';
        // Product ids
        ?>
				<p class="form-field"><label for="product_ids"><?php 
        _e('Products', 'woocommerce');
        ?>
</label>
				<select id="product_ids" name="product_ids[]" class="ajax_chosen_select_products_and_variations" multiple="multiple" data-placeholder="<?php 
        _e('Search for a product&hellip;', 'woocommerce');
        ?>
">
					<?php 
        $product_ids = get_post_meta($post->ID, 'product_ids', true);
        if ($product_ids) {
            $product_ids = array_map('absint', explode(',', $product_ids));
            foreach ($product_ids as $product_id) {
                $product = wc_get_product($product_id);
                echo '<option value="' . esc_attr($product_id) . '" selected="selected">' . wp_kses_post($product->get_formatted_name()) . '</option>';
            }
        }
        ?>
				</select> <img class="help_tip" data-tip='<?php 
        _e('Products which need to be in the cart to use this coupon or, for "Product Discounts", which products are discounted.', 'woocommerce');
        ?>
' src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/help.png" height="16" width="16" /></p>
				<?php 
        // Exclude Product ids
        ?>
				<p class="form-field"><label for="exclude_product_ids"><?php 
        _e('Exclude products', 'woocommerce');
        ?>
</label>
				<select id="exclude_product_ids" name="exclude_product_ids[]" class="ajax_chosen_select_products_and_variations" multiple="multiple" data-placeholder="<?php 
        _e('Search for a product…', 'woocommerce');
        ?>
">
					<?php 
        $product_ids = get_post_meta($post->ID, 'exclude_product_ids', true);
        if ($product_ids) {
            $product_ids = array_map('absint', explode(',', $product_ids));
            foreach ($product_ids as $product_id) {
                $product = wc_get_product($product_id);
                echo '<option value="' . esc_attr($product_id) . '" selected="selected">' . wp_kses_post($product->get_formatted_name()) . '</option>';
            }
        }
        ?>
				</select> <img class="help_tip" data-tip='<?php 
        _e('Products which must not be in the cart to use this coupon or, for "Product Discounts", which products are not discounted.', 'woocommerce');
        ?>
' src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/help.png" height="16" width="16" /></p>
				<?php 
        echo '</div><div class="options_group">';
        // Categories
        ?>
				<p class="form-field"><label for="product_ids"><?php 
        _e('Product categories', 'woocommerce');
        ?>
</label>
				<select id="product_categories" name="product_categories[]" class="chosen_select" multiple="multiple" data-placeholder="<?php 
        _e('Any category', 'woocommerce');
        ?>
">
					<?php 
        $category_ids = (array) get_post_meta($post->ID, 'product_categories', true);
        $categories = get_terms('product_cat', 'orderby=name&hide_empty=0');
        if ($categories) {
            foreach ($categories as $cat) {
                echo '<option value="' . esc_attr($cat->term_id) . '"' . selected(in_array($cat->term_id, $category_ids), true, false) . '>' . esc_html($cat->name) . '</option>';
            }
        }
        ?>
				</select> <img class="help_tip" data-tip='<?php 
        _e('A product must be in this category for the coupon to remain valid or, for "Product Discounts", products in these categories will be discounted.', 'woocommerce');
        ?>
' src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/help.png" height="16" width="16" /></p>
				<?php 
        // Exclude Categories
        ?>
				<p class="form-field"><label for="exclude_product_categories"><?php 
        _e('Exclude categories', 'woocommerce');
        ?>
</label>
				<select id="exclude_product_categories" name="exclude_product_categories[]" class="chosen_select" multiple="multiple" data-placeholder="<?php 
        _e('No categories', 'woocommerce');
        ?>
">
					<?php 
        $category_ids = (array) get_post_meta($post->ID, 'exclude_product_categories', true);
        $categories = get_terms('product_cat', 'orderby=name&hide_empty=0');
        if ($categories) {
            foreach ($categories as $cat) {
                echo '<option value="' . esc_attr($cat->term_id) . '"' . selected(in_array($cat->term_id, $category_ids), true, false) . '>' . esc_html($cat->name) . '</option>';
            }
        }
        ?>
				</select> <img class="help_tip" data-tip='<?php 
        _e('Product must not be in this category for the coupon to remain valid or, for "Product Discounts", products in these categories will not be discounted.', 'woocommerce');
        ?>
' src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/help.png" height="16" width="16" /></p>
				<?php 
        echo '</div><div class="options_group">';
        // Customers
        woocommerce_wp_text_input(array('id' => 'customer_email', 'label' => __('Email restrictions', 'woocommerce'), 'placeholder' => __('No restrictions', 'woocommerce'), 'description' => __('List of emails to check against the customer\'s billing email when an order is placed. Separate email addresses with commas.', 'woocommerce'), 'value' => implode(', ', (array) get_post_meta($post->ID, 'customer_email', true)), 'desc_tip' => true, 'type' => 'email', 'class' => '', 'custom_attributes' => array('multiple' => 'multiple')));
        echo '</div>';
        do_action('woocommerce_coupon_options_usage_restriction');
        ?>
</div>
			<div id="usage_limit_coupon_data" class="panel woocommerce_options_panel"><?php 
        echo '<div class="options_group">';
        // Usage limit per coupons
        woocommerce_wp_text_input(array('id' => 'usage_limit', 'label' => __('Usage limit per coupon', 'woocommerce'), 'placeholder' => _x('Unlimited usage', 'placeholder', 'woocommerce'), 'description' => __('How many times this coupon can be used before it is void.', 'woocommerce'), 'type' => 'number', 'desc_tip' => true, 'class' => 'short', 'custom_attributes' => array('step' => '1', 'min' => '0')));
        // Usage limit per product
        woocommerce_wp_text_input(array('id' => 'limit_usage_to_x_items', 'label' => __('Limit usage to X items', 'woocommerce'), 'placeholder' => _x('Apply to all qualifying items in cart', 'placeholder', 'woocommerce'), 'description' => __('The maximum number of individual items this coupon can apply to when using product discounts. Leave blank to apply to all qualifying items in cart.', 'woocommerce'), 'desc_tip' => true, 'class' => 'short', 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '0')));
        // Usage limit per users
        woocommerce_wp_text_input(array('id' => 'usage_limit_per_user', 'label' => __('Usage limit per user', 'woocommerce'), 'placeholder' => _x('Unlimited usage', 'placeholder', 'woocommerce'), 'description' => __('How many times this coupon can be used by an invidual user. Uses billing email for guests, and user ID for logged in users.', 'woocommerce'), 'desc_tip' => true, 'class' => 'short', 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '0')));
        echo '</div>';
        do_action('woocommerce_coupon_options_usage_limit');
        ?>
</div>
			<?php 
        do_action('woocommerce_coupon_data_panels');
        ?>
			<div class="clear"></div>
		</div>
		<?php 
    }
    /**
     * Output the metabox
     */
    public static function output($post)
    {
        global $the_subscription;
        if (!is_object($the_subscription) || $the_subscription->id !== $post->ID) {
            $the_subscription = wc_get_order($post->ID);
        }
        $subscription = $the_subscription;
        self::init_address_fields();
        wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
        ?>
		<style type="text/css">
			#post-body-content, #titlediv, #major-publishing-actions, #minor-publishing-actions, #visibility, #submitdiv { display:none }
		</style>
		<div class="panel-wrap woocommerce">
			<input name="post_title" type="hidden" value="<?php 
        echo empty($post->post_title) ? esc_attr(get_post_type_object($subscription->post->post_type)->labels->singular_name) : esc_attr($post->post_title);
        ?>
" />
			<input name="post_status" type="hidden" value="<?php 
        echo esc_attr($subscription->get_status());
        ?>
" />
			<div id="order_data" class="panel">

				<h2><?php 
        // translators: placeholder is the ID of the subscription
        printf(esc_html_x('Subscription %s details', 'edit subscription header', 'woocommerce-subscriptions'), esc_html($subscription->get_order_number()));
        ?>
</h2>

				<div class="order_data_column_container">
					<div class="order_data_column">

						<p class="form-field form-field-wide wc-customer-user">
							<label for="customer_user"><?php 
        esc_html_e('Customer:', 'woocommerce-subscriptions');
        ?>
 <?php 
        if (!empty($subscription->customer_user)) {
            $args = array('post_status' => 'all', 'post_type' => 'shop_subscription', '_customer_user' => absint($subscription->customer_user));
            printf('<a href="%s">%s &rarr;</a>', esc_url(add_query_arg($args, admin_url('edit.php'))), esc_html__('View other subscriptions', 'woocommerce-subscriptions'));
        }
        ?>
</label>
							<?php 
        $user_string = '';
        $user_id = '';
        if (!empty($subscription->customer_user) && false !== get_userdata($subscription->customer_user)) {
            $user_id = absint($subscription->customer_user);
            $user = get_user_by('id', $user_id);
            $user_string = esc_html($user->display_name) . ' (#' . absint($user->ID) . ' &ndash; ' . esc_html($user->user_email);
        }
        ?>
							<input type="hidden" class="wc-customer-search" id="customer_user" name="customer_user" data-placeholder="<?php 
        esc_attr_e('Search for a customer&hellip;', 'woocommerce-subscriptions');
        ?>
" data-selected="<?php 
        echo esc_attr($user_string);
        ?>
" value="<?php 
        echo esc_attr($user_id);
        ?>
" />
						</p>

						<p class="form-field form-field-wide">
							<label for="order_status"><?php 
        esc_html_e('Subscription Status:', 'woocommerce-subscriptions');
        ?>
</label>
							<select id="order_status" name="order_status">
								<?php 
        $statuses = wcs_get_subscription_statuses();
        foreach ($statuses as $status => $status_name) {
            if (!$subscription->can_be_updated_to($status) && !$subscription->has_status(str_replace('wc-', '', $status))) {
                continue;
            }
            echo '<option value="' . esc_attr($status) . '" ' . selected($status, 'wc-' . $subscription->get_status(), false) . '>' . esc_html($status_name) . '</option>';
        }
        ?>
							</select>
						</p>

						<?php 
        do_action('woocommerce_admin_order_data_after_order_details', $subscription);
        ?>

					</div>
					<div class="order_data_column">
						<h4><?php 
        esc_html_e('Billing Details', 'woocommerce-subscriptions');
        ?>
 <a class="edit_address" href="#"><a href="#" class="tips load_customer_billing" data-tip="Load billing address" style="display:none;">Load billing address</a></a></h4>
						<?php 
        // Display values
        echo '<div class="address">';
        if ($subscription->get_formatted_billing_address()) {
            echo '<p><strong>' . esc_html__('Address', 'woocommerce-subscriptions') . ':</strong>' . wp_kses($subscription->get_formatted_billing_address(), array('br' => array())) . '</p>';
        } else {
            echo '<p class="none_set"><strong>' . esc_html__('Address', 'woocommerce-subscriptions') . ':</strong> ' . esc_html__('No billing address set.', 'woocommerce-subscriptions') . '</p>';
        }
        foreach (self::$billing_fields as $key => $field) {
            if (isset($field['show']) && false === $field['show']) {
                continue;
            }
            $field_name = 'billing_' . $key;
            if ($subscription->{$field_name}) {
                echo '<p><strong>' . esc_html($field['label']) . ':</strong> ' . wp_kses_post(make_clickable(esc_html($subscription->{$field_name}))) . '</p>';
            }
        }
        echo '<p' . (!empty($subscription->payment_method) ? ' class="' . esc_attr($subscription->payment_method) . '"' : '') . '><strong>' . esc_html__('Payment Method', 'woocommerce-subscriptions') . ':</strong>' . wp_kses_post(nl2br($subscription->get_payment_method_to_display()));
        // Display help tip
        if (!empty($subscription->payment_method) && !$subscription->is_manual()) {
            echo '<img class="help_tip" data-tip="Gateway ID: [' . esc_attr($subscription->payment_gateway->id) . ']" src="' . esc_url(WC()->plugin_url()) . '/assets/images/help.png" height="16" width="16" />';
        }
        echo '</p>';
        echo '</div>';
        // Display form
        echo '<div class="edit_address">';
        foreach (self::$billing_fields as $key => $field) {
            if (!isset($field['type'])) {
                $field['type'] = 'text';
            }
            switch ($field['type']) {
                case 'select':
                    // allow for setting a default value programaticaly, and draw the selectbox
                    woocommerce_wp_select(array('id' => '_billing_' . $key, 'label' => $field['label'], 'options' => $field['options'], 'value' => isset($field['value']) ? $field['value'] : null));
                    break;
                default:
                    // allow for setting a default value programaticaly, and draw the textbox
                    woocommerce_wp_text_input(array('id' => '_billing_' . $key, 'label' => $field['label'], 'value' => isset($field['value']) ? $field['value'] : null));
                    break;
            }
        }
        WCS_Change_Payment_Method_Admin::display_fields($subscription);
        echo '</div>';
        do_action('woocommerce_admin_order_data_after_billing_address', $subscription);
        ?>
					</div>
					<div class="order_data_column">

						<h4><?php 
        esc_html_e('Shipping Details', 'woocommerce-subscriptions');
        ?>
							<a class="edit_address" href="#">
								<a href="#" class="tips billing-same-as-shipping" data-tip="Copy from billing" style="display:none;">Copy from billing</a>
								<a href="#" class="tips load_customer_shipping" data-tip="Load shipping address" style="display:none;">Load shipping address</a>
							</a>
						</h4>
						<?php 
        // Display values
        echo '<div class="address">';
        if ($subscription->get_formatted_shipping_address()) {
            echo '<p><strong>' . esc_html__('Address', 'woocommerce-subscriptions') . ':</strong>' . wp_kses($subscription->get_formatted_shipping_address(), array('br' => array())) . '</p>';
        } else {
            echo '<p class="none_set"><strong>' . esc_html__('Address', 'woocommerce-subscriptions') . ':</strong> ' . esc_html__('No shipping address set.', 'woocommerce-subscriptions') . '</p>';
        }
        if (self::$shipping_fields) {
            foreach (self::$shipping_fields as $key => $field) {
                if (isset($field['show']) && false === $field['show']) {
                    continue;
                }
                $field_name = 'shipping_' . $key;
                if (!empty($subscription->{$field_name})) {
                    echo '<p><strong>' . esc_html($field['label']) . ':</strong> ' . wp_kses_post(make_clickable(esc_html($subscription->{$field_name}))) . '</p>';
                }
            }
        }
        if (apply_filters('woocommerce_enable_order_notes_field', 'yes' == get_option('woocommerce_enable_order_comments', 'yes')) && $post->post_excerpt) {
            echo '<p><strong>' . esc_html__('Customer Note', 'woocommerce-subscriptions') . ':</strong> ' . wp_kses_post(nl2br($post->post_excerpt)) . '</p>';
        }
        echo '</div>';
        // Display form
        echo '<div class="edit_address">';
        if (self::$shipping_fields) {
            foreach (self::$shipping_fields as $key => $field) {
                if (!isset($field['type'])) {
                    $field['type'] = 'text';
                }
                switch ($field['type']) {
                    case 'select':
                        woocommerce_wp_select(array('id' => '_shipping_' . $key, 'label' => $field['label'], 'options' => $field['options']));
                        break;
                    default:
                        woocommerce_wp_text_input(array('id' => '_shipping_' . $key, 'label' => $field['label']));
                        break;
                }
            }
        }
        if (apply_filters('woocommerce_enable_order_notes_field', 'yes' == get_option('woocommerce_enable_order_comments', 'yes'))) {
            ?>
							<p class="form-field form-field-wide"><label for="excerpt"><?php 
            esc_html_e('Customer Note:', 'woocommerce-subscriptions');
            ?>
</label>
								<textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt" placeholder="<?php 
            esc_attr_e('Customer\'s notes about the order', 'woocommerce-subscriptions');
            ?>
"><?php 
            echo wp_kses_post($post->post_excerpt);
            ?>
</textarea></p>
								<?php 
        }
        echo '</div>';
        do_action('woocommerce_admin_order_data_after_shipping_address', $subscription);
        ?>
					</div>
				</div>
				<div class="clear"></div>
			</div>
		</div>
		<?php 
    }
    /**
     * Product writepanel for Subscriptions.
     *
     * @return void
     */
    public static function product_write_panel()
    {
        global $post;
        $subscription_schemes = get_post_meta($post->ID, '_wcsatt_schemes', true);
        ?>
<div id="wcsatt_data" class="panel woocommerce_options_panel wc-metaboxes-wrapper">
			<div class="options_group"><?php 
        // Subscription Status.
        woocommerce_wp_checkbox(array('id' => '_wcsatt_force_subscription', 'label' => __('Force subscription', WCS_ATT::TEXT_DOMAIN), 'desc_tip' => true, 'description' => __('Check this option to prevent one-time purchases of this product. In effect when at least one Subscription Option has been added below.', WCS_ATT::TEXT_DOMAIN)));
        // Default Status.
        woocommerce_wp_select(array('id' => '_wcsatt_default_status', 'wrapper_class' => 'wcsatt_default_status', 'label' => __('Default to', WCS_ATT::TEXT_DOMAIN), 'description' => '', 'options' => array('one-time' => __('One-time purchase', WCS_ATT::TEXT_DOMAIN), 'subscription' => __('Subscription', WCS_ATT::TEXT_DOMAIN))));
        // Subscription Prompt.
        woocommerce_wp_textarea_input(array('id' => '_wcsatt_subscription_prompt', 'label' => __('Subscription prompt', WCS_ATT::TEXT_DOMAIN), 'description' => __('Custom html/text to display before the available Subscription Options. In effect when at least one Subscription Option has been added below.', WCS_ATT::TEXT_DOMAIN), 'desc_tip' => true));
        ?>
</div>

			<p class="form-field">
				<label>
					<?php 
        echo __('Subscription Options', WCS_ATT::TEXT_DOMAIN);
        echo WCS_ATT_Core_Compatibility::wc_help_tip(__('Add one or more subscription options for this product.', WCS_ATT::TEXT_DOMAIN));
        ?>
</label></p>
			<div class="subscription_schemes wc-metaboxes ui-sortable" data-count=""><?php 
        if ($subscription_schemes) {
            $i = 0;
            foreach ($subscription_schemes as $subscription_scheme) {
                do_action('wcsatt_subscription_scheme', $i, $subscription_scheme, $post->ID);
                $i++;
            }
        }
        ?>
</div>

			<p class="toolbar">
				<button type="button" class="button button-primary add_subscription_scheme"><?php 
        _e('Add Option', WCS_ATT::TEXT_DOMAIN);
        ?>
</button>
			</p>
		</div><?php 
    }
    /**
     * Output the metabox
     */
    public static function output($post)
    {
        global $theorder;
        if (!is_object($theorder)) {
            $theorder = wc_get_order($post->ID);
        }
        $order = $theorder;
        self::init_address_fields();
        if (WC()->payment_gateways()) {
            $payment_gateways = WC()->payment_gateways->payment_gateways();
        }
        $payment_method = !empty($order->payment_method) ? $order->payment_method : '';
        wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
        ?>
		<style type="text/css">
			#post-body-content, #titlediv, #major-publishing-actions, #minor-publishing-actions, #visibility, #submitdiv { display:none }
		</style>
		<div class="panel-wrap woocommerce">
			<input name="post_title" type="hidden" value="<?php 
        echo empty($post->post_title) ? 'Order' : esc_attr($post->post_title);
        ?>
" />
			<input name="post_status" type="hidden" value="<?php 
        echo esc_attr($order->get_status());
        ?>
" />
			<div id="order_data" class="panel">

				<h2><?php 
        printf(__('Order %s details', 'woocommerce'), esc_html($order->get_order_number()));
        ?>
</h2>
				<p class="order_number"><?php 
        if ($payment_method) {
            printf(__('Payment via %s', 'woocommerce'), isset($payment_gateways[$payment_method]) ? esc_html($payment_gateways[$payment_method]->get_title()) : esc_html($payment_method));
            if ($transaction_id = $order->get_transaction_id()) {
                if (isset($payment_gateways[$payment_method]) && ($url = $payment_gateways[$payment_method]->get_transaction_url($order))) {
                    echo ' (<a href="' . esc_url($url) . '" target="_blank">' . esc_html($transaction_id) . '</a>)';
                } else {
                    echo ' (' . esc_html($transaction_id) . ')';
                }
            }
            echo '. ';
        }
        if ($ip_address = get_post_meta($post->ID, '_customer_ip_address', true)) {
            echo __('Customer IP', 'woocommerce') . ': ' . esc_html($ip_address);
        }
        ?>
</p>

				<div class="order_data_column_container">
					<div class="order_data_column">
						<h4><?php 
        _e('General Details', 'woocommerce');
        ?>
</h4>

						<p class="form-field form-field-wide"><label for="order_date"><?php 
        _e('Order date:', 'woocommerce');
        ?>
</label>
							<input type="text" class="date-picker-field" name="order_date" id="order_date" maxlength="10" value="<?php 
        echo date_i18n('Y-m-d', strtotime($post->post_date));
        ?>
" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />@<input type="text" class="hour" placeholder="<?php 
        _e('h', 'woocommerce');
        ?>
" name="order_date_hour" id="order_date_hour" maxlength="2" size="2" value="<?php 
        echo date_i18n('H', strtotime($post->post_date));
        ?>
" pattern="\-?\d+(\.\d{0,})?" />:<input type="text" class="minute" placeholder="<?php 
        _e('m', 'woocommerce');
        ?>
" name="order_date_minute" id="order_date_minute" maxlength="2" size="2" value="<?php 
        echo date_i18n('i', strtotime($post->post_date));
        ?>
" pattern="\-?\d+(\.\d{0,})?" />
						</p>

						<p class="form-field form-field-wide"><label for="order_status"><?php 
        _e('Order status:', 'woocommerce');
        ?>
</label>
						<select id="order_status" name="order_status" class="chosen_select">
							<?php 
        $statuses = wc_get_order_statuses();
        foreach ($statuses as $status => $status_name) {
            echo '<option value="' . esc_attr($status) . '" ' . selected($status, 'wc-' . $order->get_status(), false) . '>' . esc_html($status_name) . '</option>';
        }
        ?>
						</select></p>

						<p class="form-field form-field-wide">
							<label for="customer_user"><?php 
        _e('Customer:', 'woocommerce');
        ?>
</label>
							<select id="customer_user" name="customer_user" class="ajax_chosen_select_customer">
								<option value=""><?php 
        _e('Guest', 'woocommerce');
        ?>
</option>
								<?php 
        if ($order->customer_user) {
            $user = get_user_by('id', $order->customer_user);
            echo '<option value="' . esc_attr($user->ID) . '" ' . selected(1, 1, false) . '>' . esc_html($user->display_name) . ' (#' . absint($user->ID) . ' &ndash; ' . esc_html($user->user_email) . ')</option>';
        }
        ?>
							</select>
						</p>

						<?php 
        do_action('woocommerce_admin_order_data_after_order_details', $order);
        ?>
					</div>
					<div class="order_data_column">
						<h4><?php 
        _e('Billing Details', 'woocommerce');
        ?>
 <a class="edit_address" href="#"><img src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/icons/edit.png" alt="<?php 
        _e('Edit', 'woocommerce');
        ?>
" width="14" /></a></h4>
						<?php 
        // Display values
        echo '<div class="address">';
        if ($order->get_formatted_billing_address()) {
            echo '<p><strong>' . __('Address', 'woocommerce') . ':</strong>' . wp_kses($order->get_formatted_billing_address(), array('br' => array())) . '</p>';
        } else {
            echo '<p class="none_set"><strong>' . __('Address', 'woocommerce') . ':</strong> ' . __('No billing address set.', 'woocommerce') . '</p>';
        }
        foreach (self::$billing_fields as $key => $field) {
            if (isset($field['show']) && false === $field['show']) {
                continue;
            }
            $field_name = 'billing_' . $key;
            if ($order->{$field_name}) {
                echo '<p><strong>' . esc_html($field['label']) . ':</strong> ' . make_clickable(esc_html($order->{$field_name})) . '</p>';
            }
        }
        echo '</div>';
        // Display form
        echo '<div class="edit_address"><p><button class="button load_customer_billing">' . __('Load billing address', 'woocommerce') . '</button></p>';
        foreach (self::$billing_fields as $key => $field) {
            if (!isset($field['type'])) {
                $field['type'] = 'text';
            }
            switch ($field['type']) {
                case 'select':
                    // allow for setting a default value programaticaly, and draw the selectbox
                    woocommerce_wp_select(array('id' => '_billing_' . $key, 'label' => $field['label'], 'options' => $field['options'], 'value' => isset($field['value']) ? $field['value'] : null));
                    break;
                default:
                    // allow for setting a default value programaticaly, and draw the textbox
                    woocommerce_wp_text_input(array('id' => '_billing_' . $key, 'label' => $field['label'], 'value' => isset($field['value']) ? $field['value'] : null));
                    break;
            }
        }
        ?>
							<p class="form-field form-field-wide">
								<label><?php 
        _e('Payment Method:', 'woocommerce');
        ?>
</label>
								<select name="_payment_method" id="_payment_method" class="first">
									<option value=""><?php 
        _e('N/A', 'woocommerce');
        ?>
</option>
									<?php 
        $found_method = false;
        foreach ($payment_gateways as $gateway) {
            if ($gateway->enabled == "yes") {
                echo '<option value="' . esc_attr($gateway->id) . '" ' . selected($payment_method, $gateway->id, false) . '>' . esc_html($gateway->get_title()) . '</option>';
                if ($payment_method == $gateway->id) {
                    $found_method = true;
                }
            }
        }
        if (!$found_method && !empty($payment_method)) {
            echo '<option value="' . esc_attr($payment_method) . '" selected="selected">' . __('Other', 'woocommerce') . '</option>';
        } else {
            echo '<option value="other">' . __('Other', 'woocommerce') . '</option>';
        }
        ?>
								</select>
							</p>
							<?php 
        woocommerce_wp_text_input(array('id' => '_transaction_id', 'label' => __('Transaction ID', 'woocommerce')));
        echo '</div>';
        do_action('woocommerce_admin_order_data_after_billing_address', $order);
        ?>
					</div>
					<div class="order_data_column">

						<h4><?php 
        _e('Shipping Details', 'woocommerce');
        ?>
 <a class="edit_address" href="#"><img src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/icons/edit.png" alt="<?php 
        _e('Edit', 'woocommerce');
        ?>
" width="14" /></a></h4>
						<?php 
        // Display values
        echo '<div class="address">';
        if ($order->get_formatted_shipping_address()) {
            echo '<p><strong>' . __('Address', 'woocommerce') . ':</strong>' . wp_kses($order->get_formatted_shipping_address(), array('br' => array())) . '</p>';
        } else {
            echo '<p class="none_set"><strong>' . __('Address', 'woocommerce') . ':</strong> ' . __('No shipping address set.', 'woocommerce') . '</p>';
        }
        if (self::$shipping_fields) {
            foreach (self::$shipping_fields as $key => $field) {
                if (isset($field['show']) && false === $field['show']) {
                    continue;
                }
                $field_name = 'shipping_' . $key;
                if (!empty($order->{$field_name})) {
                    echo '<p><strong>' . esc_html($field['label']) . ':</strong> ' . make_clickable(esc_html($order->{$field_name})) . '</p>';
                }
            }
        }
        if (apply_filters('woocommerce_enable_order_notes_field', 'yes' == get_option('woocommerce_enable_order_comments', 'yes')) && $post->post_excerpt) {
            echo '<p><strong>' . __('Customer Note', 'woocommerce') . ':</strong> ' . nl2br(esc_html($post->post_excerpt)) . '</p>';
        }
        echo '</div>';
        // Display form
        echo '<div class="edit_address"><p><button class="button load_customer_shipping">' . __('Load shipping address', 'woocommerce') . '</button> <button class="button billing-same-as-shipping">' . __('Copy from billing', 'woocommerce') . '</button></p>';
        if (self::$shipping_fields) {
            foreach (self::$shipping_fields as $key => $field) {
                if (!isset($field['type'])) {
                    $field['type'] = 'text';
                }
                switch ($field['type']) {
                    case 'select':
                        woocommerce_wp_select(array('id' => '_shipping_' . $key, 'label' => $field['label'], 'options' => $field['options']));
                        break;
                    default:
                        woocommerce_wp_text_input(array('id' => '_shipping_' . $key, 'label' => $field['label']));
                        break;
                }
            }
        }
        if (apply_filters('woocommerce_enable_order_notes_field', 'yes' == get_option('woocommerce_enable_order_comments', 'yes'))) {
            ?>
								<p class="form-field form-field-wide"><label for="excerpt"><?php 
            _e('Customer Note:', 'woocommerce');
            ?>
</label>
								<textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt" placeholder="<?php 
            _e('Customer\'s notes about the order', 'woocommerce');
            ?>
"><?php 
            echo wp_kses_post($post->post_excerpt);
            ?>
</textarea></p>
								<?php 
        }
        echo '</div>';
        do_action('woocommerce_admin_order_data_after_shipping_address', $order);
        ?>
					</div>
				</div>
				<div class="clear"></div>
			</div>
		</div>
		<?php 
        // Ajax Chosen Customer Selectors JS
        wc_enqueue_js("\n\t\t\tjQuery( 'select.ajax_chosen_select_customer' ).ajaxChosen({\n\t\t\t\tmethod:         'GET',\n\t\t\t\turl:            '" . admin_url('admin-ajax.php') . "',\n\t\t\t\tdataType:       'json',\n\t\t\t\tafterTypeDelay: 100,\n\t\t\t\tminTermLength:  1,\n\t\t\t\tdata:           {\n\t\t\t\t\taction:   'woocommerce_json_search_customers',\n\t\t\t\t\tsecurity: '" . wp_create_nonce('search-customers') . "'\n\t\t\t\t}\n\t\t\t}, function ( data ) {\n\n\t\t\t\tvar terms = {};\n\n\t\t\t\t\$.each( data, function ( i, val ) {\n\t\t\t\t\tterms[i] = val;\n\t\t\t\t});\n\n\t\t\t\treturn terms;\n\t\t\t});\n\t\t");
    }
/**
 * Coupon data meta box
 * 
 * Displays the meta box
 */
function woocommerce_coupon_data_meta_box($post)
{
    global $woocommerce;
    wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
    ?>
	<style type="text/css">
		#edit-slug-box { display:none }
	</style>
	<div id="coupon_options" class="panel woocommerce_options_panel">
		<?php 
    // Type
    woocommerce_wp_select(array('id' => 'discount_type', 'label' => __('Discount type', 'woocommerce'), 'options' => $woocommerce->get_coupon_discount_types()));
    // Amount
    woocommerce_wp_text_input(array('id' => 'coupon_amount', 'label' => __('Coupon amount', 'woocommerce'), 'placeholder' => __('0.00', 'woocommerce'), 'description' => __('Enter an amount e.g. 2.99', 'woocommerce')));
    // Individual use
    woocommerce_wp_checkbox(array('id' => 'individual_use', 'label' => __('Individual use', 'woocommerce'), 'description' => __('Check this box if the coupon cannot be used in conjunction with other coupons', 'woocommerce')));
    // Apply before tax
    woocommerce_wp_checkbox(array('id' => 'apply_before_tax', 'label' => __('Apply before tax', 'woocommerce'), 'description' => __('Check this box if the coupon should be applied before calculating cart tax', 'woocommerce')));
    // Free Shipping
    woocommerce_wp_checkbox(array('id' => 'free_shipping', 'label' => __('Enable free shipping', 'woocommerce'), 'description' => sprintf(__('Check this box if the coupon enables free shipping (see <a href="%s">Free Shipping</a>)', 'woocommerce'), admin_url('admin.php?page=woocommerce&tab=shipping_methods&subtab=shipping-free_shipping'))));
    // Product ids
    woocommerce_wp_text_input(array('id' => 'product_ids', 'label' => __('Product IDs', 'woocommerce'), 'placeholder' => __('N/A', 'woocommerce'), 'description' => __('(optional) Comma separate IDs which need to be in the cart to use this coupon or, for "Product Discounts", which products are discounted.', 'woocommerce')));
    // Exclude Product ids
    woocommerce_wp_text_input(array('id' => 'exclude_product_ids', 'label' => __('Exclude Product IDs', 'woocommerce'), 'placeholder' => __('N/A', 'woocommerce'), 'description' => __('(optional) Comma separate IDs which must not be in the cart to use this coupon or, for "Product Discounts", which products are not discounted.', 'woocommerce')));
    // Usage limit
    woocommerce_wp_text_input(array('id' => 'usage_limit', 'label' => __('Usage limit', 'woocommerce'), 'placeholder' => __('Unlimited usage', 'woocommerce'), 'description' => __('(optional) How many times this coupon can be used before it is void', 'woocommerce')));
    // Expiry date
    woocommerce_wp_text_input(array('id' => 'expiry_date', 'label' => __('Expiry date', 'woocommerce'), 'placeholder' => __('Never expire', 'woocommerce'), 'description' => __('(optional) The date this coupon will expire, <code>YYYY-MM-DD</code>', 'woocommerce'), 'class' => 'short date-picker'));
    do_action('woocommerce_coupon_options');
    ?>
	</div>
	<?php 
}
Exemple #30
-1
function woogle_custom_general_fields()
{
    global $post;
    echo '<div class="options_group woogle-options-group">';
    // Enable Google Shopping
    woocommerce_wp_checkbox(array('id' => '_woogle_enabled', 'label' => __('Enable Google Shopping', 'woogle'), 'desc_tip' => true, 'description' => __('Select to upload this product to your Google Merchant Center', 'woogle')));
    echo __('<h3>Product Description</h3>', 'woogle');
    // Title
    woocommerce_wp_text_input(array('id' => '_woogle_title', 'label' => __('Woogle Title', 'woogle'), 'placeholder' => '(Limit 150 characters)', 'desc_tip' => false, 'description' => __('Enter a custom value to override the title for this product.<br />(Limit 150 characters)', 'woogle')));
    // Description
    woocommerce_wp_textarea_input(array('id' => '_woogle_description', 'label' => __('Woogle Description', 'woogle'), 'placeholder' => '(Limit 5000 characters)', 'desc_tip' => false, 'description' => __('Enter a custom value to override the description for this product.<br />(Limit 5000 characters)', 'woogle')));
    echo __('<h3>Product Identification</h3>', 'woogle');
    // Condition
    woocommerce_wp_select(array('id' => '_woogle_condition', 'label' => __('Condition', 'woogle'), 'options' => array('new' => __('New', 'woogle'), 'used' => __('Used', 'woogle'), 'refurbished' => __('Refurbished', 'woogle')), 'desc_tip' => true, 'description' => __('Condition of the item', 'woogle')));
    // Category
    woocommerce_wp_text_input(array('id' => '_woogle_category', 'label' => __('Product Category', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('Product Category from Google Shopping Content Category Taxonomy.', 'woogle')));
    // Brand
    woocommerce_wp_text_input(array('id' => '_woogle_brand', 'label' => __('Brand', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The brand of the product.', 'woogle')));
    // GTIN
    woocommerce_wp_text_input(array('id' => '_woogle_gtin', 'label' => __('GTIN', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('Global Trade Item Number', 'woogle')));
    // MPN
    woocommerce_wp_text_input(array('id' => '_woogle_mpn', 'label' => __('MPN', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('Manufacturer Part Number', 'woogle')));
    echo __('<h3>Physical Properties</h3>', 'woogle');
    // Color
    woocommerce_wp_text_input(array('id' => '_woogle_color', 'label' => __('Color', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The color of the product. If you are trying to indicate multiple colors for a ' . 'single item (not product variants), specify a primary color, optionally followed ' . 'by at most two secondary colors, separated by a \'/\'. Here replace RedPinkBlue ' . 'with Red/Pink/Blue', 'woogle')));
    // Material
    woocommerce_wp_text_input(array('id' => '_woogle_material', 'label' => __('Material', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The material of the product.', 'woogle')));
    // Pattern
    woocommerce_wp_text_input(array('id' => '_woogle_pattern', 'label' => __('Pattern', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The pattern of the product.', 'woogle')));
    // Size
    woocommerce_wp_text_input(array('id' => '_woogle_size', 'label' => __('Size', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The size of the product.', 'woogle')));
    echo __('<h3>Target Consumer</h3>', 'woogle');
    // Age Group
    woocommerce_wp_select(array('id' => '_woogle_age_group', 'label' => __('Age Group', 'woogle'), 'options' => array('' => __('&mdash;SELECT&mdash;', 'woogle'), 'adult' => __('Adult', 'woogle'), 'infant' => __('Infant', 'woogle'), 'kids' => __('Kids', 'woogle'), 'newborn' => __('Newborn', 'woogle'), 'toddler' => __('Toddler', 'woogle')), 'desc_tip' => true, 'description' => __('The target age group of the product.', 'woogle')));
    // Gender
    woocommerce_wp_select(array('id' => '_woogle_gender', 'label' => __('Gender', 'woogle'), 'options' => array('' => __('&mdash;SELECT&mdash;', 'woogle'), 'female' => __('Female', 'woogle'), 'male' => __('Male', 'woogle'), 'unisex' => __('Unisex', 'woogle')), 'desc_tip' => true, 'description' => __('The target gender of the product.', 'woogle')));
    // Adult
    woocommerce_wp_checkbox(array('id' => '_woogle_adult', 'label' => __('Adult (18+)', 'woogle'), 'desc_tip' => true, 'description' => __('This item is targeted towards adults.', 'woogle')));
    echo '</div>';
}