public static function display_field_options($fieldoptions)
 {
     global $woocommerce, $post;
     foreach ($fieldoptions as $key => $fields) {
         if (isset($fields['type'])) {
             switch ($fields['type']) {
                 case 'select':
                     if ($result = get_post_meta($post->ID, $fields['id'], true)) {
                         $fields['value'] = $result;
                     }
                     woocommerce_wp_select($fields);
                     break;
                 case 'checkbox':
                     if ($result = get_post_meta($post->ID, $fields['id'], true)) {
                         $fields['value'] = $result;
                     }
                     woocommerce_wp_checkbox($fields);
                     break;
                 case 'radio':
                     if ($result = get_post_meta($post->ID, $fields['id'], true)) {
                         $fields['value'] = $result;
                     }
                     woocommerce_wp_radio($fields);
                     break;
                 case 'hidden':
                     if ($result = get_post_meta($post->ID, $fields['id'], true)) {
                         $fields['value'] = $result;
                     }
                     woocommerce_wp_hidden_input($fields);
                     break;
                 case 'number':
                 case 'text':
                     if ($result = get_post_meta($post->ID, $fields['id'], true)) {
                         $fields['value'] = $result;
                     }
                     woocommerce_wp_text_input($fields);
                     break;
                 case 'textarea':
                     if ($result = get_post_meta($post->ID, $fields['id'], true)) {
                         $fields['value'] = $result;
                     }
                     woocommerce_wp_textarea_input($fields);
                     break;
             }
         }
     }
 }
function bf_wc_product_general($thepostid, $customfield)
{
    ?>

    <div id="general_product_data"><?php 
    if (isset($customfield['product_sku']) && $customfield['product_sku'] != 'hidden') {
        echo '<div class="options_group hide_if_grouped">';
        // SKU
        if (wc_product_sku_enabled()) {
            $required = $customfield['product_sku'] == 'required' ? array('required' => '') : '';
            $required_html = $customfield['product_sku'] == 'required' ? '<span class="required">* </span>' : '';
            woocommerce_wp_text_input(array('custom_attributes' => $required, 'id' => '_sku', 'label' => $required_html . '<abbr title="' . __('Stock Keeping Unit', 'woocommerce') . '">' . __('SKU', 'woocommerce') . '</abbr><br>', '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') . '<br>', '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') . '<br>', '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">';
    $required = $customfield['product_regular_price'][0] == 'required' ? array('required' => '') : '';
    $required_html = $customfield['product_regular_price'][0] == 'required' ? '<span class="required">* </span>' : '';
    // Price
    woocommerce_wp_text_input(array('custom_attributes' => $required, 'id' => '_regular_price', 'label' => $required_html . __('Regular Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')<br>', 'data_type' => 'price'));
    if (isset($customfield['product_sales_price']) && $customfield['product_sales_price'] != 'hidden') {
        $required = $customfield['product_sales_price'] == 'required' ? array('required' => '') : '';
        $required_html = $customfield['product_sales_price'] == 'required' ? '<span class="required">* </span>' : '';
        $description = isset($customfield['product_sales_price']) ? $customfield['product_sales_price'] == 'required' ? '' : '<a href="#" class="sale_schedule">' . __('Schedule', 'woocommerce') . '</a>' : '';
        // Special Price
        woocommerce_wp_text_input(array('custom_attributes' => $required, 'id' => '_sale_price', 'data_type' => 'price', 'label' => $required_html . __('Sale Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')<br>', 'description' => $description));
    } else {
        woocommerce_wp_hidden_input(array('id' => '_sale_price', 'data_type' => 'price'));
    }
    if (isset($customfield['product_sales_price_dates']) && $customfield['product_sales_price_dates'] != 'hidden') {
        $required = $customfield['product_sales_price_dates'] == 'required' ? array('required' => '') : '';
        $required_html = $customfield['product_sales_price_dates'] == 'required' ? '<span class="required">* </span>' : '';
        $description = isset($customfield['product_sales_price_dates']) ? $customfield['product_sales_price'] == 'required' ? 'style="display: block;"' : '' : '';
        // 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" ' . $required_style . '>
            <label for="_sale_price_dates_from">' . $required_html . __('Sale Price Dates', 'woocommerce') . '</label>
            <input ' . $required . ' 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 ' . $required . ' 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>
        </p>';
    }
    do_action('woocommerce_product_options_pricing');
    echo '</div></div>';
    do_action('bf_woocommerce_product_options_general_last', $thepostid, $customfield);
}
Esempio n. 3
0
/**
 * Контент блока нашли девле
 */
function cr_woocommerce_buy_with_this_item_options()
{
    global $post;
    $values = get_post_meta($post->ID, '_buy_with_this', true);
    $buy_with_this = explode(',', $values);
    ?>

    <div id="cr_buy_with_this_item" class="panel woocommerce_options_panel">
        <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css">
        <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"></script>
        <div class="club-opening-hours">
            <?php 
    echo get_the_ID();
    ?>
            <fieldset class="form-field">
                <div class="wrap">

                    <p>
                        <?php 
    $out = '<select id="multiple-select-box" class="js-example-basic-multiple" data-placeholder="Type to search cities" name="_buy_with_this_sel" multiple="multiple">';
    $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => 10000);
    $products = new WP_Query($args);
    if ($products->have_posts()) {
        while ($products->have_posts()) {
            $products->the_post();
            $selected = in_array($post->ID, $buy_with_this) ? ' selected="selected"' : '';
            $out .= '<option value="' . $post->ID . '"' . $selected . '>' . $post->post_title . '</option>';
        }
    }
    wp_reset_query();
    $out .= '</select>';
    woocommerce_wp_hidden_input(array('id' => '_buy_with_this', 'value' => $values));
    echo $out;
    ?>
                        <a class="ccc" href="#">submit</a>
                    </p>

                    <script>
                        $eventSelect = jQuery('#multiple-select-box').select2();

                        $eventSelect.on("change", function (e) { jQuery('#_buy_with_this').val($eventSelect.val()) });

                        jQuery('a.ccc').click(function (e) {
                           // alert(jQuery('#multiple-select-box').val());
                        });
                    </script>

                </div>
            </fieldset>
        </div>
    </div>
    <?php 
}
    /**
     * 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 
    }
 /**
  * Show the meta box for shipment info on the order page
  *
  * @access public
  */
 public function meta_box()
 {
     global $woocommerce, $post;
     $tracking_items = $this->get_tracking_items($post->ID);
     echo '<div id="tracking-items">';
     if (count($tracking_items) > 0) {
         foreach ($tracking_items as $tracking_item) {
             $this->display_html_tracking_item_for_meta_box($post->ID, $tracking_item);
         }
     }
     echo '</div>';
     echo '<button class="button button-show-form" type="button">' . __('Add Tracking Number', 'wc_shipment_tracking') . '</button>';
     echo '<div id="shipment-tracking-form">';
     // Providers
     echo '<p class="form-field tracking_provider_field"><label for="tracking_provider">' . __('Provider:', 'wc_shipment_tracking') . '</label><br/><select id="tracking_provider" name="tracking_provider" class="chosen_select" style="width:100%;">';
     echo '<option value="">' . __('Custom Provider', 'wc_shipment_tracking') . '</option>';
     $selected_provider = '';
     if (!$selected_provider) {
         $selected_provider = sanitize_title(apply_filters('woocommerce_shipment_tracking_default_provider', ''));
     }
     foreach ($this->get_providers() as $provider_group => $providers) {
         echo '<optgroup label="' . $provider_group . '">';
         foreach ($providers as $provider => $url) {
             echo '<option value="' . sanitize_title($provider) . '" ' . selected(sanitize_title($provider), $selected_provider, true) . '>' . $provider . '</option>';
         }
         echo '</optgroup>';
     }
     echo '</select> ';
     woocommerce_wp_hidden_input(array('id' => 'wc_shipment_tracking_delete_nonce', 'value' => wp_create_nonce('delete-tracking-item')));
     woocommerce_wp_hidden_input(array('id' => 'wc_shipment_tracking_create_nonce', 'value' => wp_create_nonce('create-tracking-item')));
     woocommerce_wp_text_input(array('id' => 'custom_tracking_provider', 'label' => __('Provider Name:', 'wc_shipment_tracking'), 'placeholder' => '', 'description' => '', 'value' => ''));
     woocommerce_wp_text_input(array('id' => 'tracking_number', 'label' => __('Tracking number:', 'wc_shipment_tracking'), 'placeholder' => '', 'description' => '', 'value' => ''));
     woocommerce_wp_text_input(array('id' => 'custom_tracking_link', 'label' => __('Tracking link:', 'wc_shipment_tracking'), 'placeholder' => 'http://', 'description' => '', 'value' => ''));
     woocommerce_wp_text_input(array('id' => 'date_shipped', 'label' => __('Date shipped:', 'wc_shipment_tracking'), 'placeholder' => date_i18n(__('Y-m-d', 'wc_shipment_tracking'), time()), 'description' => '', 'class' => 'date-picker-field', 'value' => date_i18n(__('Y-m-d', 'wc_shipment_tracking'), current_time('timestamp'))));
     echo '<button class="button button-primary button-save-form">' . __('Save Tracking', 'wc_shipment_tracking') . '</button>';
     // Live preview
     echo '<p class="preview_tracking_link">' . __('Preview:', 'wc_shipment_tracking') . ' <a href="" target="_blank">' . __('Click here to track your shipment', 'wc_shipment_tracking') . '</a></p>';
     echo '</div>';
     $provider_array = array();
     foreach ($this->get_providers() as $providers) {
         foreach ($providers as $provider => $format) {
             $provider_array[sanitize_title($provider)] = urlencode($format);
         }
     }
     $js = "\n\t\t\tjQuery('p.custom_tracking_link_field, p.custom_tracking_provider_field').hide();\n\n\t\t\tjQuery('input#custom_tracking_link, input#tracking_number, #tracking_provider').change(function(){\n\n\t\t\t\tvar tracking = jQuery('input#tracking_number').val();\n\t\t\t\tvar provider = jQuery('#tracking_provider').val();\n\t\t\t\tvar providers = jQuery.parseJSON( '" . json_encode($provider_array) . "' );\n\n\t\t\t\tpostcode = jQuery('#_billing_postcode').val();\n\t\t\t\tpostcode = encodeURIComponent( postcode );\n\n\t\t\t\tvar link = '';\n\n\t\t\t\tif ( providers[ provider ] ) {\n\t\t\t\t\tlink = providers[provider];\n\t\t\t\t\tlink = link.replace( '%251%24s', tracking );\n\t\t\t\t\tlink = link.replace( '%252%24s', postcode );\n\t\t\t\t\tlink = decodeURIComponent( link );\n\n\t\t\t\t\tjQuery('p.custom_tracking_link_field, p.custom_tracking_provider_field').hide();\n\t\t\t\t} else {\n\t\t\t\t\tjQuery('p.custom_tracking_link_field, p.custom_tracking_provider_field').show();\n\n\t\t\t\t\tlink = jQuery('input#custom_tracking_link').val();\n\t\t\t\t}\n\n\t\t\t\tif ( link ) {\n\t\t\t\t\tjQuery('p.preview_tracking_link a').attr('href', link);\n\t\t\t\t\tjQuery('p.preview_tracking_link').show();\n\t\t\t\t} else {\n\t\t\t\t\tjQuery('p.preview_tracking_link').hide();\n\t\t\t\t}\n\n\t\t\t}).change();";
     if (function_exists('wc_enqueue_js')) {
         wc_enqueue_js($js);
     } else {
         $woocommerce->add_inline_js($js);
     }
     wp_enqueue_script('wc-shipment-tracking-js', plugins_url() . '/woocommerce-shipment-tracking/assets/js/admin.min.js');
 }
    /**
     * 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>';
    }
 /**
  * Freshdesk tab panel.
  *
  * @since  1.0.0
  *
  * @return string Tab panel content.
  */
 public function product_panel()
 {
     global $post;
     // Forum category data.
     $forum = get_post_meta($post->ID, '_forum_category', true);
     $forum_enable = isset($forum['enable']) ? $forum['enable'] : '';
     $forum_title = isset($forum['title']) ? $forum['title'] : $post->post_title;
     $forum_description = isset($forum['description']) ? $forum['description'] : '';
     $forum_id = get_post_meta($post->ID, '_forum_category_id', true);
     // Solutions category data.
     $solutions = get_post_meta($post->ID, '_solutions_category', true);
     $solutions_enable = isset($solutions['enable']) ? $solutions['enable'] : '';
     $solutions_title = isset($solutions['title']) ? $solutions['title'] : $post->post_title;
     $solutions_description = isset($solutions['description']) ? $solutions['description'] : '';
     $solutions_id = get_post_meta($post->ID, '_solutions_category_id', true);
     wp_nonce_field(basename(__FILE__), 'woocommerce_freshdesk_nonce');
     echo '<div id="freshdesk_product_data" class="panel woocommerce_options_panel">';
     if ('sprout' != $this->plan) {
         echo '<div class="options_group">';
         echo '<h4>' . __('Forum Category', 'woocommerce-freshdesk') . '</h4>';
         if ('yes' != $forum_enable) {
             woocommerce_wp_select(array('id' => '_forum_category', 'label' => __('Add/get Category', 'woocommerce-freshdesk'), 'cbvalue' => 'yes', 'value' => '', 'desc_tip' => 'true', 'description' => __('Create or synchronize a Freshdesk Forum Category.', 'woocommerce-freshdesk'), 'options' => array('' => __('Select an option&hellip;', 'woocommerce-freshdesk'), 'create' => __('Create', 'woocommerce-freshdesk'), 'sync' => __('Synchronize', 'woocommerce-freshdesk'))));
             woocommerce_wp_text_input(array('id' => '_forum_category_id', 'label' => __('Category ID', 'woocommerce-freshdesk'), 'value' => esc_attr($forum_id), 'desc_tip' => 'true', 'description' => __('Enter the Forum Category ID to synchronize.', 'woocommerce-freshdesk')));
         } else {
             echo '<p class="category-id">' . __('Forum Category ID:', 'woocommerce-freshdesk') . ' <code>' . esc_attr($forum_id) . '</code></p>';
             woocommerce_wp_hidden_input(array('id' => '_forum_category_enable', 'value' => sanitize_text_field($forum_enable)));
             woocommerce_wp_checkbox(array('id' => '_forum_category_delete', 'label' => __('Remove Relationship?', 'woocommerce-freshdesk'), 'cbvalue' => 'yes', 'value' => '', 'description' => __('This option remove the synchronization with this Forum Category and your Freshdesk.', 'woocommerce-freshdesk')));
         }
         woocommerce_wp_text_input(array('id' => '_forum_category_title', 'label' => __('Category Title', 'woocommerce-freshdesk'), 'value' => sanitize_text_field($forum_title), 'desc_tip' => 'true', 'description' => __('Enter with the Forum Category title.', 'woocommerce-freshdesk')));
         woocommerce_wp_textarea_input(array('id' => '_forum_category_description', 'label' => __('Category Description', 'woocommerce-freshdesk'), 'value' => esc_attr($forum_description), 'desc_tip' => 'true', 'description' => __('Enter with the Forum Category description.', 'woocommerce-freshdesk')));
         echo '</div>';
     }
     echo '<div class="options_group">';
     echo '<h4>' . __('Solution Category', 'woocommerce-freshdesk') . '</h4>';
     if ('yes' != $solutions_enable) {
         woocommerce_wp_select(array('id' => '_solutions_category', 'label' => __('Add/get Category', 'woocommerce-freshdesk'), 'cbvalue' => 'yes', 'value' => '', 'desc_tip' => 'true', 'description' => __('Create or synchronize a Freshdesk Solutions Category.', 'woocommerce-freshdesk'), 'options' => array('' => __('Select an option&hellip;', 'woocommerce-freshdesk'), 'create' => __('Create', 'woocommerce-freshdesk'), 'sync' => __('Synchronize', 'woocommerce-freshdesk'))));
         woocommerce_wp_text_input(array('id' => '_solutions_category_id', 'label' => __('Category ID', 'woocommerce-freshdesk'), 'value' => esc_attr($solutions_id), 'desc_tip' => 'true', 'description' => __('Enter the Solutions Category ID to synchronize.', 'woocommerce-freshdesk')));
     } else {
         echo '<p class="category-id">' . __('Solution Category ID:', 'woocommerce-freshdesk') . ' <code>' . esc_attr($solutions_id) . '</code></p>';
         woocommerce_wp_hidden_input(array('id' => '_solutions_category_enable', 'value' => sanitize_text_field($solutions_enable)));
         woocommerce_wp_checkbox(array('id' => '_solutions_category_delete', 'label' => __('Remove Relationship?', 'woocommerce-freshdesk'), 'cbvalue' => 'yes', 'value' => '', 'description' => __('This option remove the synchronization with this Solutions Category and your Freshdesk.', 'woocommerce-freshdesk')));
     }
     woocommerce_wp_text_input(array('id' => '_solutions_category_title', 'label' => __('Category Title', 'woocommerce-freshdesk'), 'value' => sanitize_text_field($solutions_title), 'desc_tip' => 'true', 'description' => __('Enter with the Solutions Category title.', 'woocommerce-freshdesk')));
     woocommerce_wp_textarea_input(array('id' => '_solutions_category_description', 'label' => __('Category Description', 'woocommerce-freshdesk'), 'value' => esc_attr($solutions_description), 'desc_tip' => 'true', 'description' => __('Enter with the Solutions Category description.', 'woocommerce-freshdesk')));
     echo '</div>';
     echo '</div>';
 }
/**
 * Display the product data meta box.
 *
 * Displays the product data box, tabbed, with several panels covering price, stock etc.
 *
 * @access public
 * @return void
 */
function woocommerce_product_data_box()
{
    global $post, $wpdb, $thepostid, $woocommerce;
    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 = 'simple';
    }
    $product_type_selector = apply_filters('product_type_selector', array('simple' => __('Simple product', 'woocommerce'), 'grouped' => __('Grouped product', 'woocommerce'), 'external' => __('External/Affiliate 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')), 'downloadable' => array('id' => '_downloadable', 'wrapper_class' => 'show_if_simple', 'label' => __('Downloadable', 'woocommerce'), 'description' => __('Downloadable products give access to a file upon purchase.', 'woocommerce'))));
    foreach ($product_type_options as $key => $option) {
        $selected_value = get_post_meta($post->ID, '_' . $key, true);
        $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>

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

		<ul class="product_data_tabs wc-tabs" style="display:none;">

			<li class="active general_options hide_if_grouped"><a href="#general_product_data"><?php 
    _e('General', 'woocommerce');
    ?>
</a></li>

			<li class="inventory_tab show_if_simple show_if_variable show_if_grouped inventory_options"><a href="#inventory_product_data"><?php 
    _e('Inventory', 'woocommerce');
    ?>
</a></li>

			<li class="shipping_tab hide_if_virtual shipping_options hide_if_grouped hide_if_external"><a href="#shipping_product_data"><?php 
    _e('Shipping', 'woocommerce');
    ?>
</a></li>

			<li class="linked_product_tab linked_product_options"><a href="#linked_product_data"><?php 
    _e('Linked Products', 'woocommerce');
    ?>
</a></li>

			<li class="attributes_tab attribute_options"><a href="#woocommerce_attributes"><?php 
    _e('Attributes', 'woocommerce');
    ?>
</a></li>

			<li class="advanced_tab advanced_options"><a href="#advanced_product_data"><?php 
    _e('Advanced', 'woocommerce');
    ?>
</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 (get_option('woocommerce_enable_sku', true) !== 'no') {
        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', 'class' => 'wc_input_price short', 'label' => __('Regular Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
    // Special Price
    woocommerce_wp_text_input(array('id' => '_sale_price', 'class' => 'wc_input_price short', 'label' => __('Sale Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'description' => '<a href="#" class="sale_schedule">' . __('Schedule', 'woocommerce') . '</a>', 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
    // 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="' . $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="' . $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>
						</p>';
    do_action('woocommerce_product_options_pricing');
    echo '</div>';
    echo '<div class="options_group show_if_downloadable">';
    // File URL
    $file_paths = get_post_meta($post->ID, '_file_paths', true);
    if (is_array($file_paths)) {
        $file_paths = implode("\n", $file_paths);
    }
    echo '<p class="form-field"><label for="_file_paths">' . __('File paths (one per line)', 'woocommerce') . ':</label>
					<textarea style="float:left;height:5em;" id="_file_paths" class="short file_paths" cols="20" rows="3" placeholder="' . __('File paths/URLs, one per line', 'woocommerce') . '" name="_file_paths" wrap="off">' . esc_textarea($file_paths) . '</textarea>
					<input type="button" class="upload_file_button button" data-choose="' . __('Choose a file', 'woocommerce') . '" data-update="' . __('Insert file URL', 'woocommerce') . '" value="' . __('Choose a file', 'woocommerce') . '" />
				</p>';
    // 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')));
    do_action('woocommerce_product_options_downloads');
    echo '</div>';
    if (get_option('woocommerce_calc_taxes') == 'yes') {
        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' => __('None', 'woocommerce'))));
        $tax_classes = array_filter(array_map('trim', explode("\n", get_option('woocommerce_tax_classes'))));
        $classes_options = array();
        $classes_options[''] = __('Standard', 'woocommerce');
        if ($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 (get_option('woocommerce_manage_stock') == 'yes') {
        // 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')));
        do_action('woocommerce_product_options_stock_fields');
        echo '</div>';
    }
    // Stock status
    woocommerce_wp_select(array('id' => '_stock_status', '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')));
    if (get_option('woocommerce_manage_stock') == 'yes') {
        echo '<div class="show_if_simple show_if_variable">';
        // 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 for this product and variations. If enabled, stock quantity can go below 0.', 'woocommerce')));
        echo '</div>';
    }
    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>';
    ?>


		</div>

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

			<?php 
    echo '<div class="options_group">';
    // Weight
    if (get_option('woocommerce_enable_weight', true) !== 'no') {
        woocommerce_wp_text_input(array('id' => '_weight', 'label' => __('Weight', 'woocommerce') . ' (' . get_option('woocommerce_weight_unit') . ')', 'placeholder' => '0.00', 'description' => __('Weight in decimal form', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
    } else {
        echo '<input type="hidden" name="_weight" value="' . esc_attr(get_post_meta($thepostid, '_weight', true)) . '" />';
    }
    // Size fields
    if (get_option('woocommerce_enable_dimensions', true) !== 'no') {
        ?>
<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" size="6" type="number" name="_length" value="<?php 
        echo esc_attr(get_post_meta($thepostid, '_length', true));
        ?>
" step="any" min="0" />
							<input placeholder="<?php 
        _e('Width', 'woocommerce');
        ?>
" class="input-text" size="6" type="number" name="_width" value="<?php 
        echo esc_attr(get_post_meta($thepostid, '_width', true));
        ?>
"  step="any" min="0" />
							<input placeholder="<?php 
        _e('Height', 'woocommerce');
        ?>
" class="input-text last" size="6" type="number" name="_height" value="<?php 
        echo esc_attr(get_post_meta($thepostid, '_height', true));
        ?>
"  step="any" min="0" />
						</span>
						<span class="description"><?php 
        _e('LxWxH in decimal form', 'woocommerce');
        ?>
</span>
					</p><?php 
    } else {
        echo '<input type="hidden" name="_length" value="' . esc_attr(get_post_meta($thepostid, '_length', true)) . '" />';
        echo '<input type="hidden" name="_width" value="' . esc_attr(get_post_meta($thepostid, '_width', true)) . '" />';
        echo '<input type="hidden" name="_height" value="' . esc_attr(get_post_meta($thepostid, '_height', true)) . '" />';
    }
    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);
    ?>
 <span class="description"><?php 
    _e('Shipping classes are used by certain shipping methods to group similar products.', 'woocommerce');
    ?>
</span></p><?php 
    do_action('woocommerce_product_options_shipping');
    echo '</div>';
    ?>


		</div>

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

			<p class="toolbar">
				<a href="#" class="close_all"><?php 
    _e('Close all', 'woocommerce');
    ?>
</a><a href="#" class="expand_all"><?php 
    _e('Expand all', 'woocommerce');
    ?>
</a>
			</p>

			<div class="woocommerce_attributes wc-metaboxes">

				<?php 
    // Array of defined attribute taxonomies
    $attribute_taxonomies = $woocommerce->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));
    $i = -1;
    // Taxonomies
    if ($attribute_taxonomies) {
        foreach ($attribute_taxonomies as $tax) {
            // Get name of taxonomy we're now outputting (pa_xxx)
            $attribute_taxonomy_name = $woocommerce->attribute_taxonomy_name($tax->attribute_name);
            // Ensure it exists
            if (!taxonomy_exists($attribute_taxonomy_name)) {
                continue;
            }
            $i++;
            // Get product data values for current taxonomy - this contains ordering and visibility data
            if (isset($attributes[sanitize_title($attribute_taxonomy_name)])) {
                $attribute = $attributes[sanitize_title($attribute_taxonomy_name)];
            }
            $position = empty($attribute['position']) ? 0 : absint($attribute['position']);
            // Get terms of this taxonomy associated with current product
            $post_terms = wp_get_post_terms($thepostid, $attribute_taxonomy_name);
            // Any set?
            $has_terms = is_wp_error($post_terms) || !$post_terms || sizeof($post_terms) == 0 ? 0 : 1;
            ?>

				    		<div class="woocommerce_attribute wc-metabox closed taxonomy <?php 
            echo $attribute_taxonomy_name;
            ?>
" rel="<?php 
            echo $position;
            ?>
" <?php 
            if (!$has_terms) {
                echo 'style="display:none"';
            }
            ?>
>
								<h3>
									<button type="button" class="remove_row button"><?php 
            _e('Remove', 'woocommerce');
            ?>
</button>
									<div class="handlediv" title="<?php 
            _e('Click to toggle', 'woocommerce');
            ?>
"></div>
									<strong class="attribute_name"><?php 
            echo apply_filters('woocommerce_attribute_label', $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name, $tax->attribute_name);
            ?>
</strong>
								</h3>
								<table cellpadding="0" cellspacing="0" class="woocommerce_attribute_data wc-metabox-content">
									<tbody>
										<tr>
											<td class="attribute_name">
												<label><?php 
            _e('Name', 'woocommerce');
            ?>
:</label>
												<strong><?php 
            echo $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name;
            ?>
</strong>

												<input type="hidden" name="attribute_names[<?php 
            echo $i;
            ?>
]" value="<?php 
            echo esc_attr($attribute_taxonomy_name);
            ?>
" />
												<input type="hidden" name="attribute_position[<?php 
            echo $i;
            ?>
]" class="attribute_position" value="<?php 
            echo esc_attr($position);
            ?>
" />
												<input type="hidden" name="attribute_is_taxonomy[<?php 
            echo $i;
            ?>
]" value="1" />
											</td>
											<td rowspan="3">
												<label><?php 
            _e('Value(s)', 'woocommerce');
            ?>
:</label>
												<?php 
            if ($tax->attribute_type == "select") {
                ?>

													<select multiple="multiple" data-placeholder="<?php 
                _e('Select terms', 'woocommerce');
                ?>
" class="multiselect attribute_values" name="attribute_values[<?php 
                echo $i;
                ?>
][]">
														<?php 
                $all_terms = get_terms($attribute_taxonomy_name, 'orderby=name&hide_empty=0');
                if ($all_terms) {
                    foreach ($all_terms as $term) {
                        $has_term = has_term((int) $term->term_id, $attribute_taxonomy_name, $thepostid) ? 1 : 0;
                        echo '<option value="' . esc_attr($term->slug) . '" ' . selected($has_term, 1, false) . '>' . $term->name . '</option>';
                    }
                }
                ?>

													</select>

													<button class="button plus select_all_attributes"><?php 
                _e('Select all', 'woocommerce');
                ?>
</button> <button class="button minus select_no_attributes"><?php 
                _e('Select none', 'woocommerce');
                ?>
</button>

													<button class="button fr plus add_new_attribute" data-attribute="<?php 
                echo $attribute_taxonomy_name;
                ?>
"><?php 
                _e('Add new', 'woocommerce');
                ?>
</button>

												<?php 
            } elseif ($tax->attribute_type == "text") {
                ?>

													<input type="text" name="attribute_values[<?php 
                echo $i;
                ?>
]" value="<?php 
                // Text attributes should list terms pipe separated
                if ($post_terms) {
                    $values = array();
                    foreach ($post_terms as $term) {
                        $values[] = $term->name;
                    }
                    echo implode(' | ', $values);
                }
                ?>
" placeholder="<?php 
                _e('Pipe (|) separate terms', 'woocommerce');
                ?>
" />
												<?php 
            }
            ?>

												<?php 
            do_action('woocommerce_product_option_terms', $tax, $i);
            ?>

											</td>
										</tr>
										<tr>
											<td>
												<label><input type="checkbox" class="checkbox" <?php 
            if (isset($attribute['is_visible'])) {
                checked($attribute['is_visible'], 1);
            } else {
                checked(apply_filters('default_attribute_visibility', false, $tax), true);
            }
            ?>
 name="attribute_visibility[<?php 
            echo $i;
            ?>
]" value="1" /> <?php 
            _e('Visible on the product page', 'woocommerce');
            ?>
</label>
											</td>
										</tr>
										<tr>
											<td>
												<div class="enable_variation show_if_variable">
												<label><input type="checkbox" class="checkbox" <?php 
            if (isset($attribute['is_variation'])) {
                checked($attribute['is_variation'], 1);
            } else {
                checked(apply_filters('default_attribute_variation', false, $tax), true);
            }
            ?>
 name="attribute_variation[<?php 
            echo $i;
            ?>
]" value="1" /> <?php 
            _e('Used for variations', 'woocommerce');
            ?>
</label>
												</div>
											</td>
										</tr>
									</tbody>
								</table>
							</div>
				    		<?php 
        }
    }
    // Custom Attributes
    if (!empty($attributes)) {
        foreach ($attributes as $attribute) {
            if ($attribute['is_taxonomy']) {
                continue;
            }
            $i++;
            $position = empty($attribute['position']) ? 0 : absint($attribute['position']);
            ?>

			    		<div class="woocommerce_attribute wc-metabox closed" rel="<?php 
            echo $position;
            ?>
">
							<h3>
								<button type="button" class="remove_row button"><?php 
            _e('Remove', 'woocommerce');
            ?>
</button>
								<div class="handlediv" title="<?php 
            _e('Click to toggle', 'woocommerce');
            ?>
"></div>
								<strong class="attribute_name"><?php 
            echo apply_filters('woocommerce_attribute_label', esc_html($attribute['name']), esc_html($attribute['name']));
            ?>
</strong>
							</h3>
							<table cellpadding="0" cellspacing="0" class="woocommerce_attribute_data wc-metabox-content">
								<tbody>
									<tr>
										<td class="attribute_name">
											<label><?php 
            _e('Name', 'woocommerce');
            ?>
:</label>
											<input type="text" class="attribute_name" name="attribute_names[<?php 
            echo $i;
            ?>
]" value="<?php 
            echo esc_attr($attribute['name']);
            ?>
" />
											<input type="hidden" name="attribute_position[<?php 
            echo $i;
            ?>
]" class="attribute_position" value="<?php 
            echo esc_attr($position);
            ?>
" />
											<input type="hidden" name="attribute_is_taxonomy[<?php 
            echo $i;
            ?>
]" value="0" />
										</td>
										<td rowspan="3">
											<label><?php 
            _e('Value(s)', 'woocommerce');
            ?>
:</label>
											<textarea name="attribute_values[<?php 
            echo $i;
            ?>
]" cols="5" rows="5" placeholder="<?php 
            _e('Enter some text, or some attributes by pipe (|) separating values.', 'woocommerce');
            ?>
"><?php 
            echo esc_textarea($attribute['value']);
            ?>
</textarea>
										</td>
									</tr>
									<tr>
										<td>
											<label><input type="checkbox" class="checkbox" <?php 
            checked($attribute['is_visible'], 1);
            ?>
 name="attribute_visibility[<?php 
            echo $i;
            ?>
]" value="1" /> <?php 
            _e('Visible on the product page', 'woocommerce');
            ?>
</label>
										</td>
									</tr>
									<tr>
										<td>
											<div class="enable_variation show_if_variable">
											<label><input type="checkbox" class="checkbox" <?php 
            checked($attribute['is_variation'], 1);
            ?>
 name="attribute_variation[<?php 
            echo $i;
            ?>
]" value="1" /> <?php 
            _e('Used for variations', 'woocommerce');
            ?>
</label>
											</div>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<?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 = $woocommerce->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>
		</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>
			<select id="upsell_ids" name="upsell_ids[]" class="ajax_chosen_select_products" multiple="multiple" data-placeholder="<?php 
    _e('Search for a product&hellip;', 'woocommerce');
    ?>
">
				<?php 
    $upsell_ids = get_post_meta($post->ID, '_upsell_ids', true);
    $product_ids = !empty($upsell_ids) ? array_map('absint', $upsell_ids) : null;
    if ($product_ids) {
        foreach ($product_ids as $product_id) {
            $product = get_product($product_id);
            $product_name = woocommerce_get_formatted_product_name($product);
            echo '<option value="' . esc_attr($product_id) . '" selected="selected">' . esc_html($product_name) . '</option>';
        }
    }
    ?>

			</select> <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 $woocommerce->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>
			<select id="crosssell_ids" name="crosssell_ids[]" class="ajax_chosen_select_products" multiple="multiple" data-placeholder="<?php 
    _e('Search for a product&hellip;', 'woocommerce');
    ?>
">
				<?php 
    $crosssell_ids = get_post_meta($post->ID, '_crosssell_ids', true);
    $product_ids = !empty($crosssell_ids) ? array_map('absint', $crosssell_ids) : null;
    if ($product_ids) {
        foreach ($product_ids as $product_id) {
            $product = get_product($product_id);
            $product_name = woocommerce_get_formatted_product_name($product);
            if ($product) {
                echo '<option value="' . esc_attr($product_id) . '" selected="selected">' . esc_html($product_name) . '</option>';
            }
        }
    }
    ?>

			</select> <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 $woocommerce->plugin_url();
    ?>
/assets/images/help.png" height="16" width="16" /></p>

			</div>

			<?php 
    echo '<div class="options_group grouping show_if_simple show_if_external">';
    // List Grouped products
    $post_parents = array();
    $post_parents[''] = __('Choose a grouped product&hellip;', 'woocommerce');
    $posts_in = array_unique((array) get_objects_in_term(get_term_by('slug', 'grouped', 'product_type')->term_id, 'product_type'));
    if (sizeof($posts_in) > 0) {
        $args = array('post_type' => 'product', 'post_status' => 'any', 'numberposts' => -1, 'orderby' => 'title', 'order' => 'asc', 'post_parent' => 0, 'include' => $posts_in);
        $grouped_products = get_posts($args);
        if ($grouped_products) {
            foreach ($grouped_products as $product) {
                if ($product->ID == $post->ID) {
                    continue;
                }
                $post_parents[$product->ID] = $product->post_title;
            }
        }
    }
    woocommerce_wp_select(array('id' => 'parent_id', 'label' => __('Grouping', 'woocommerce'), 'value' => absint($post->post_parent), 'options' => $post_parents, 'desc_tip' => true, 'description' => __('Set this option to make this product part of a grouped product.', 'woocommerce')));
    woocommerce_wp_hidden_input(array('id' => 'previous_parent_id', 'value' => absint($post->post_parent)));
    do_action('woocommerce_product_options_grouping');
    echo '</div>';
    ?>


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


		</div>

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

			<?php 
    echo '<div class="options_group hide_if_external">';
    // Purchase note
    woocommerce_wp_textarea_input(array('id' => '_purchase_note', 'label' => __('Purchase Note', 'woocommerce'), 'description' => __('Enter an optional note to send the customer after purchase.', 'woocommerce')));
    echo '</div>';
    echo '<div class="options_group">';
    // menu_order
    woocommerce_wp_text_input(array('id' => 'menu_order', 'label' => __('Menu order', 'woocommerce'), 'description' => __('Custom ordering position.', 'woocommerce'), 'value' => intval($post->menu_order), 'type' => 'number', 'custom_attributes' => array('step' => '1')));
    echo '</div>';
    echo '<div class="options_group reviews">';
    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');
    echo '</div>';
    ?>


		</div>

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


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

	</div>
	<?php 
}
function bf_wc_product_linked($thepostid, $customfield)
{
    global $post;
    ?>


<div id="linked_product_data">

    <div class="options_group">

        <?php 
    if (!isset($customfield['product_up_sales'])) {
        ?>
            <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_and_variations" data-multiple="true" 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);
            $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));
        ?>
" /> <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>
        <?php 
    }
    ?>

        <?php 
    if (!isset($customfield['product_cross_sales'])) {
        ?>
            <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_and_variations" data-multiple="true" 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);
            $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));
        ?>
" /> <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>
        <?php 
    }
    ?>
         </div>

    <?php 
    echo '<div class="options_group grouping show_if_simple show_if_external">';
    // List Grouped products
    $post_parents = array();
    $post_parents[''] = __('Choose a grouped product&hellip;', 'woocommerce');
    if ($grouped_term = get_term_by('slug', 'grouped', 'product_type')) {
        $posts_in = array_unique((array) get_objects_in_term($grouped_term->term_id, 'product_type'));
        if (sizeof($posts_in) > 0) {
            $args = array('post_type' => 'product', 'post_status' => 'any', 'numberposts' => -1, 'orderby' => 'title', 'order' => 'asc', 'post_parent' => 0, 'suppress_filters' => 0, 'include' => $posts_in);
            $grouped_products = get_posts($args);
            if ($grouped_products) {
                foreach ($grouped_products as $product) {
                    if ($product->ID == $thepostid) {
                        continue;
                    }
                    $post_parents[$product->ID] = $product->post_title;
                }
            }
        }
    }
    if (!isset($customfield['product_grouping'])) {
        woocommerce_wp_select(array('id' => 'parent_id', 'label' => __('Grouping', 'woocommerce') . '<br>', 'value' => absint($post->post_parent), 'options' => $post_parents, 'desc_tip' => true, 'description' => __('Set this option to make this product part of a grouped product.', 'woocommerce')));
        woocommerce_wp_hidden_input(array('id' => 'previous_parent_id', 'value' => absint($post->post_parent)));
        do_action('woocommerce_product_options_grouping');
    }
    echo '</div>';
    ?>

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

</div>

<?php 
}
?>
	<div class="options_group ml_required_fields">
		<p class="form-field ml_category_id_field">
			<label for="ml_category_id"><?php 
_e('Category', $textdomain);
?>
</label>
			<?php 
if ($ml_product->is_published()) {
    printf('<a href="%s" target="_blank">%s</a>', $ml_product->permalink, implode(' > ', wp_list_pluck(ML_Category::get_category_path($ml_product->category_id), 'name')));
    $variations = ML_Category::get_category_variations($ml_product->category_id);
    if (!empty($variations)) {
        include_once 'html-variations.php';
    }
} else {
    woocommerce_wp_hidden_input(array('id' => 'ml_category_id', 'value' => $ml_product->category_id));
}
?>
		</p>
	</div>
	<div class="options_group">
		<?php 
if (!empty(ML()->ml_official_stores)) {
    woocommerce_wp_select(array('id' => 'ml_official_store_id', 'label' => __('Official Store', $textdomain), 'description' => __('Determines which official store the product will be posted', $textdomain), 'desc_tip' => true, 'options' => ML()->ml_official_stores, 'value' => isset($_POST['ml_official_store_id']) ? $_POST['ml_official_store_id'] : $ml_product->official_store_id, 'custom_attributes' => $ml_product->is_published() ? array('disabled' => 'disabled') : array()));
}
//Modifiable with conditions
woocommerce_wp_select(array('id' => 'ml_listing_type_id', 'label' => __('Listing Type', $textdomain), 'description' => __('Determines how your product will be listed on MercadoLivre', $textdomain), 'desc_tip' => true, 'options' => wp_list_pluck(ML()->ml_communication->get_listing_types(), 'name', 'id'), 'value' => isset($_POST['ml_listing_type_id']) ? $_POST['ml_listing_type_id'] : $ml_product->listing_type_id));
?>
	</div>
	<div class="options_group">
		<?php 
function bf_wc_product_inventory($thepostid, $customfield)
{
    ?>

    <div id="inventory_product_data">

        <?php 
    echo '<div class="options_group">';
    if ('yes' == get_option('woocommerce_manage_stock')) {
        if (!isset($customfield['product_manage_stock']) || !in_array('manage', $customfield['product_manage_stock'])) {
            // manage stock
            if (isset($customfield['product_manage_stock_hide']) && in_array('hidden', $customfield['product_manage_stock_hide'])) {
                echo '<span style="display: none;">';
            }
            woocommerce_wp_checkbox(array('value' => 'yes', 'id' => '_manage_stock', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __('Manage stock?', 'woocommerce'), 'description' => __('Enable stock management at product level', 'woocommerce')));
            if (isset($customfield['product_manage_stock_hide']) && in_array('hidden', $customfield['product_manage_stock_hide'])) {
                echo '</span>';
            }
            do_action('woocommerce_product_options_stock');
            echo '<div class="stock_fields show_if_simple show_if_variable">';
            #
            $product_manage_stock_qty = isset($customfield['product_manage_stock_qty']) ? $customfield['product_manage_stock_qty'] : 0;
            $product_manage_stock_qty = isset($customfield['product_manage_stock_qty_options']) ? $product_manage_stock_qty : 0;
            $stock = get_post_meta($thepostid, '_stock', true);
            $product_manage_stock_qty = !empty($stock) ? $stock : $product_manage_stock_qty;
            // 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', 'value' => $product_manage_stock_qty));
            if (isset($customfield['product_allow_backorders_options']) && in_array('hidden', $customfield['product_allow_backorders_options'])) {
                woocommerce_wp_hidden_input(array('id' => '_backorders', 'value' => $customfield['product_allow_backorders']));
            } else {
                // 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>';
        }
    }
    if (isset($customfield['product_stock_status_options']) && in_array('hidden', $customfield['product_stock_status_options'])) {
        woocommerce_wp_hidden_input(array('id' => '_stock_status', 'value' => $customfield['product_stock_status']));
    } else {
        // 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">';
    if (isset($customfield['product_sold_individually_options']) && in_array('hidden', $customfield['product_sold_individually_options'])) {
        woocommerce_wp_hidden_input(array('id' => '_sold_individually', 'value' => $customfield['product_sold_individually']));
    } else {
        // 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>

<?php 
}
        public function woocommerce_variation_options($loop, $variation_data, $variation)
        {
            $variation_images = get_post_meta($variation->ID, '_wpb_variation_images', true);
            ?>
            <div class="wpb_variation_images">
                <ul class="wpb_image_thumb">
                    <?php 
            if (!empty($variation_images)) {
                $image_array = explode(',', $variation_images);
                if (!empty($image_array)) {
                    foreach ($image_array as $image) {
                        $url = wp_get_attachment_url($image);
                        ?>
                               <li class="image" data-attachment_id="<?php 
                        echo $image;
                        ?>
">
                                   <a href="#" class="delete" title="<?php 
                        echo __('Delete Image', 'wpb');
                        ?>
"><img src="<?php 
                        echo $url;
                        ?>
"></a>
                               </li>
                          <?php 
                    }
                }
                ?>
                    <?php 
            }
            ?>
                </ul>
                <?php 
            woocommerce_wp_hidden_input(array('id' => 'wpb_variation_images[' . $variation->ID . ']', 'value' => $variation_images, 'class' => 'wpb_variation_image_gallery'));
            ?>
                <a class="button button-primary wpb_multiple_image_upload"><?php 
            echo __('Add Additional Images', 'wpb');
            ?>
</a>
            </div>
            <?php 
        }
    /**
     * 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="' . esc_attr__('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());
        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">

			<ul class="product_data_tabs wc-tabs" style="display:none;">
				<?php 
        $product_data_tabs = apply_filters('woocommerce_product_data_tabs', array('attribute' => array('label' => __('Attributes', 'woocommerce'), 'target' => 'product_attributes', '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="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 
            esc_attr_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 
            esc_attr_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 
            esc_attr_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="toolbar toolbar-top">
					<span class="expand-close">
						<a href="#" class="expand_all"><?php 
        _e('Разшири', 'woocommerce');
        ?>
</a> / <a href="#" class="close_all"><?php 
        _e('Затвори', 'woocommerce');
        ?>
</a>
					</span>
					<select name="attribute_taxonomy" class="attribute_taxonomy">
						<option value=""><?php 
        _e('Атрибут', 'woocommerce');
        ?>
</option>
						<?php 
        global $wc_product_attributes;
        // Array of defined attribute taxonomies
        $attribute_taxonomies = wc_get_attribute_taxonomies();
        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 add_attribute"><?php 
        _e('Add', 'woocommerce');
        ?>
</button>
				</div>
				<div class="product_attributes wc-metaboxes">
					<?php 
        // 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>
				<div class="toolbar">
					<span class="expand-close">
						<a href="#" class="expand_all"><?php 
        _e('Expand', 'woocommerce');
        ?>
</a> / <a href="#" class="close_all"><?php 
        _e('Close', 'woocommerce');
        ?>
</a>
					</span>
					<button type="button" class="button save_attributes button-primary"><?php 
        _e('Save Attributes', 'woocommerce');
        ?>
</button>
				</div>
				<?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 
        esc_attr_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(), ENT_QUOTES, get_bloginfo('charset')));
            }
        }
        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 
        esc_attr_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(), ENT_QUOTES, get_bloginfo('charset')));
            }
        }
        echo esc_attr(json_encode($json_ids));
        ?>
" value="<?php 
        echo implode(',', array_keys($json_ids));
        ?>
" /> <img class="help_tip" data-tip='<?php 
        esc_attr_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 
        esc_attr_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(), ENT_QUOTES, get_bloginfo('charset')));
            }
            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 
    }
Esempio n. 14
0
            public function woo_view_custom_box($post)
            {
                ?>

        <div class="panel-wrap product_data woocommerce">
        <ul class="tabs wc-tabs">
            <li class="active"><a href="#woo_view_metabox_data"><?php 
                echo 'General';
                ?>
</a></li>
        </ul>

        <div id="woo_view_metabox_data" class="panel woocommerce_options_panel">
            <?php 
                $woo_view_meta_options = get_post_meta($post->ID, '_woo_view_meta_options', true);
                ?>
            <div class="options_group">
                <table id="woo_view_tbl">
                    <tr>
                        <td>
                            <?php 
                woocommerce_wp_text_input(array('name' => 'woo_view_location', 'id' => 'woo_view_location', 'label' => __('Location', 'woo_view'), 'custom_attributes' => array('style' => "width:75%"), 'description' => __("Enter the address for the product and click on locate button.", 'woo_view'), 'desc_tip' => true, 'value' => isset($woo_view_meta_options['woo_view_location']) && $woo_view_meta_options['woo_view_location'] ? $woo_view_meta_options['woo_view_location'] : ''));
                ?>
                        </td>
                        <td>
                            <?php 
                echo '<input type="button" value="' . __('Locate', 'woo_view') . '" id="agmap_add_button" style="width:auto;"/>';
                echo '<span id="locate_my_add" style="padding :20px;"><a href="#" id="agmap_geoloc">' . __(' Or Locate My Local Address', 'woo_view') . '</a></span>';
                woocommerce_wp_hidden_input(array('name' => 'woo_view_lat', 'id' => 'woo_view_lat', 'value' => isset($woo_view_meta_options['woo_view_lat']) && $woo_view_meta_options['woo_view_lat'] ? $woo_view_meta_options['woo_view_lat'] : ''));
                woocommerce_wp_hidden_input(array('name' => 'woo_view_lng', 'id' => 'woo_view_lng', 'value' => isset($woo_view_meta_options['woo_view_lng']) && $woo_view_meta_options['woo_view_lng'] ? $woo_view_meta_options['woo_view_lng'] : ''));
                ?>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div align="center" class="woo_view_admin_canvas_wrapper">
                                <div id="woo_view_map_canvas"
                                     style="width:670px; height: 400px; border: 1px solid #E0E0DD;"></div>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        </div><?php 
            }
    /**
     * Voucher data meta box
     *
     * @since 1.2
     */
    public function data_meta_box($post)
    {
        wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
        $voucher = new WC_Voucher($post->ID);
        $default_fonts = array('Helvetica' => 'Helvetica', 'Courier' => 'Courier', 'Times' => 'Times', 'Roboto' => 'Roboto', 'Merriweather' => 'Merriweather');
        $available_fonts = array_merge(array('' => ''), $default_fonts);
        // since this little snippet of css applies only to the voucher post page, it's easier to have inline here
        ?>
		<style type="text/css">
			#misc-publishing-actions { display:none; }
			#edit-slug-box { display:none }
			.imgareaselect-outer { cursor: crosshair; }
		</style>
		<div id="voucher_options" class="panel woocommerce_options_panel">
			<div class="options_group">
				<?php 
        // Text color
        echo '<div class="options_group">';
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_font_select(array('id' => '_voucher', 'label' => __('Default Font', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'options' => $default_fonts, 'font_size_default' => 11));
        woocommerce_wp_text_input(array('id' => '_voucher_font_color', 'label' => __('Default Font color', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'default' => '#000000', 'description' => __('The default text color for the voucher.', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'class' => 'colorpick'));
        woocommerce_wp_select(array('id' => '_voucher_text_align', 'label' => __('Default Text Alignment', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'description' => __('The default text alignment', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'options' => array('L' => _x('Left', 'left justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'C' => _x('Center', 'center justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'R' => _x('Right', 'right justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN))));
        echo '</div>';
        // Product name position
        echo '<div class="options_group">';
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_position_picker(array('id' => 'product_name_pos', 'label' => __('Product Name Position', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => implode(',', $voucher->get_field_position('product_name')), 'description' => __('Optional position of the product name', WC_PDF_Product_Vouchers::TEXT_DOMAIN)));
        woocommerce_wp_hidden_input(array('id' => '_product_name_pos', 'class' => 'field_pos', 'value' => implode(',', $voucher->get_field_position('product_name'))));
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_font_select(array('id' => '_product_name', 'label' => __('Font', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'options' => $available_fonts));
        woocommerce_wp_text_input(array('id' => '_product_name_font_color', 'label' => __('Font color', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['product_name']['font']['color']) ? $voucher->voucher_fields['product_name']['font']['color'] : '', 'class' => 'colorpick'));
        woocommerce_wp_select(array('id' => '_product_name_text_align', 'label' => __('Text Alignment', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['product_name']['text_align']) ? $voucher->voucher_fields['product_name']['text_align'] : '', 'options' => array('' => '', 'L' => _x('Left', 'left justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'C' => _x('Center', 'center justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'R' => _x('Right', 'right justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN))));
        echo '</div>';
        // SKU position
        echo '<div class="options_group">';
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_position_picker(array('id' => 'product_sku_pos', 'label' => __('SKU Position', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => implode(',', $voucher->get_field_position('product_sku')), 'description' => __('Optional position of the product SKU', WC_PDF_Product_Vouchers::TEXT_DOMAIN)));
        woocommerce_wp_hidden_input(array('id' => '_product_sku_pos', 'class' => 'field_pos', 'value' => implode(',', $voucher->get_field_position('product_sku'))));
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_font_select(array('id' => '_product_sku', 'label' => __('Font', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'options' => $available_fonts));
        woocommerce_wp_text_input(array('id' => '_product_sku_font_color', 'label' => __('Font color', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['product_sku']['font']['color']) ? $voucher->voucher_fields['product_sku']['font']['color'] : '', 'class' => 'colorpick'));
        woocommerce_wp_select(array('id' => '_product_sku_text_align', 'label' => __('Text Alignment', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['product_sku']['text_align']) ? $voucher->voucher_fields['product_sku']['text_align'] : '', 'options' => array('' => '', 'L' => _x('Left', 'left justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'C' => _x('Center', 'center justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'R' => _x('Right', 'right justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN))));
        echo '</div>';
        // Voucher number position
        echo '<div class="options_group">';
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_position_picker(array('id' => 'voucher_number_pos', 'label' => __('Voucher Number Position', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => implode(',', $voucher->get_field_position('voucher_number')), 'description' => __('Optional position of the voucher number', WC_PDF_Product_Vouchers::TEXT_DOMAIN)));
        woocommerce_wp_hidden_input(array('id' => '_voucher_number_pos', 'class' => 'field_pos', 'value' => implode(',', $voucher->get_field_position('voucher_number'))));
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_font_select(array('id' => '_voucher_number', 'label' => __('Font', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'options' => $available_fonts));
        woocommerce_wp_text_input(array('id' => '_voucher_number_font_color', 'label' => __('Font color', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['voucher_number']['font']['color']) ? $voucher->voucher_fields['voucher_number']['font']['color'] : '', 'class' => 'colorpick'));
        woocommerce_wp_select(array('id' => '_voucher_number_text_align', 'label' => __('Text Alignment', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['voucher_number']['text_align']) ? $voucher->voucher_fields['voucher_number']['text_align'] : '', 'options' => array('' => '', 'L' => _x('Left', 'left justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'C' => _x('Center', 'center justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'R' => _x('Right', 'right justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN))));
        echo '</div>';
        // Product price
        echo '<div class="options_group">';
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_position_picker(array('id' => 'voucher_product_price_pos', 'label' => __('Product Price Position', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => implode(',', $voucher->get_field_position('voucher_product_price')), 'description' => __('Optional position of the product price', WC_PDF_Product_Vouchers::TEXT_DOMAIN)));
        woocommerce_wp_hidden_input(array('id' => '_voucher_product_price_pos', 'class' => 'field_pos', 'value' => implode(',', $voucher->get_field_position('voucher_product_price'))));
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_font_select(array('id' => '_voucher_product_price', 'label' => __('Font', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'options' => $available_fonts));
        woocommerce_wp_text_input(array('id' => '_voucher_product_price_font_color', 'label' => __('Font color', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['voucher_product_price']['font']['color']) ? $voucher->voucher_fields['voucher_product_price']['font']['color'] : '', 'class' => 'colorpick'));
        woocommerce_wp_select(array('id' => '_voucher_product_price_text_align', 'label' => __('Text Alignment', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['voucher_product_price']['text_align']) ? $voucher->voucher_fields['voucher_product_price']['text_align'] : '', 'options' => array('' => '', 'L' => _x('Left', 'left justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'C' => _x('Center', 'center justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'R' => _x('Right', 'right justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN))));
        echo '</div>';
        // Days to expiration
        echo '<div class="options_group">';
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_position_picker(array('id' => 'expiration_date_pos', 'label' => __('Expiration Date Position', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => implode(',', $voucher->get_field_position('expiration_date')), 'description' => __('Optional position of the voucher expiration date', WC_PDF_Product_Vouchers::TEXT_DOMAIN)));
        woocommerce_wp_hidden_input(array('id' => '_expiration_date_pos', 'class' => 'field_pos', 'value' => implode(',', $voucher->get_field_position('expiration_date'))));
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_font_select(array('id' => '_expiration_date', 'label' => __('Font', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'options' => $available_fonts));
        woocommerce_wp_text_input(array('id' => '_expiration_date_font_color', 'label' => __('Font color', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['expiration_date']['font']['color']) ? $voucher->voucher_fields['expiration_date']['font']['color'] : '', 'class' => 'colorpick'));
        woocommerce_wp_text_input(array('id' => '_days_to_expiry', 'label' => __('Days to Expiration', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'description' => __('Optional number of days after purchase until the voucher expires', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'placeholder' => __('days', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => $voucher->get_expiry()));
        woocommerce_wp_select(array('id' => '_expiration_date_text_align', 'label' => __('Text Alignment', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['expiration_date']['text_align']) ? $voucher->voucher_fields['expiration_date']['text_align'] : '', 'options' => array('' => '', 'L' => _x('Left', 'left justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'C' => _x('Center', 'center justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'R' => _x('Right', 'right justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN))));
        echo '</div>';
        // Voucher recipient position
        echo '<div class="options_group">';
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_position_picker(array('id' => 'recipient_name_pos', 'label' => __('Recipient Name Position', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => implode(',', $voucher->get_field_position('recipient_name')), 'description' => __('Optional position of the name of the receiving party.', WC_PDF_Product_Vouchers::TEXT_DOMAIN)));
        woocommerce_wp_hidden_input(array('id' => '_recipient_name_pos', 'class' => 'field_pos', 'value' => implode(',', $voucher->get_field_position('recipient_name'))));
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_font_select(array('id' => '_recipient_name', 'label' => __('Font', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'options' => $available_fonts));
        woocommerce_wp_text_input(array('id' => '_recipient_name_font_color', 'label' => __('Font color', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['recipient_name']['font']['color']) ? $voucher->voucher_fields['recipient_name']['font']['color'] : '', 'class' => 'colorpick'));
        woocommerce_wp_text_input(array('id' => '_recipient_name_max_length', 'label' => __('Max Length', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'description' => __('The maximum length of the recipient name field', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'placeholder' => __('No Limit', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => $voucher->get_user_input_field_max_length('recipient_name')));
        woocommerce_wp_text_input(array('id' => '_recipient_name_label', 'label' => __('Label', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'description' => __('The field label to show on the frontend/emails', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['recipient_name']['label']) ? $voucher->voucher_fields['recipient_name']['label'] : 'Recipient Name'));
        woocommerce_wp_checkbox(array('id' => '_recipient_name_is_enabled', 'label' => __('Enabled', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'description' => __('Display this field on the product page (useful if you want the Recipient Name option without printing it to the voucher)', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => $voucher->user_input_field_is_enabled('recipient_name') ? 'yes' : 'no'));
        woocommerce_wp_checkbox(array('id' => '_recipient_name_is_required', 'label' => __('Required', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'description' => __('Make this field required in order to add a voucher product to the cart', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => $voucher->user_input_field_is_required('recipient_name') ? 'yes' : 'no'));
        woocommerce_wp_select(array('id' => '_recipient_name_text_align', 'label' => __('Text Alignment', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['recipient_name']['text_align']) ? $voucher->voucher_fields['recipient_name']['text_align'] : '', 'options' => array('' => '', 'L' => _x('Left', 'left justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'C' => _x('Center', 'center justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'R' => _x('Right', 'right justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN))));
        echo '</div>';
        // Voucher recipient email option
        echo '<div class="options_group">';
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_position_picker(array('id' => 'recipient_email_pos', 'label' => __('Recipient Email Position', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => implode(',', $voucher->get_field_position('recipient_email_pos')), 'description' => __('Optional position of the user-supplied recipient email', WC_PDF_Product_Vouchers::TEXT_DOMAIN)));
        woocommerce_wp_hidden_input(array('id' => '_recipient_email_pos', 'class' => 'field_pos', 'value' => implode(',', $voucher->get_field_position('recipient_email_pos'))));
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_font_select(array('id' => '_recipient_email', 'label' => __('Font', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'options' => $available_fonts));
        woocommerce_wp_text_input(array('id' => '_recipient_email_font_color', 'label' => __('Font color', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['recipient_email']['font']['color']) ? $voucher->voucher_fields['recipient_email']['font']['color'] : '', 'class' => 'colorpick'));
        woocommerce_wp_text_input(array('id' => '_recipient_email_label', 'label' => __('Label', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'description' => __('The field label to show on the frontend/emails', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['recipient_email']['label']) ? $voucher->voucher_fields['recipient_email']['label'] : 'Recipient Email'));
        woocommerce_wp_checkbox(array('id' => '_recipient_email_is_enabled', 'label' => __('Enabled', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'description' => __('Display this field on the product page (useful if you want the Recipient Email option without printing it to the voucher)', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => $voucher->user_input_field_is_enabled('recipient_email') ? 'yes' : 'no'));
        woocommerce_wp_checkbox(array('id' => '_recipient_email_is_required', 'label' => __('Required', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'description' => __('Make this field required in order to add a voucher product to the cart', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => $voucher->user_input_field_is_required('recipient_email') ? 'yes' : 'no'));
        woocommerce_wp_select(array('id' => '_message_text_align', 'label' => __('Text Alignment', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['message']['text_align']) ? $voucher->voucher_fields['message']['text_align'] : '', 'options' => array('' => '', 'L' => _x('Left', 'left justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'C' => _x('Center', 'center justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'R' => _x('Right', 'right justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN))));
        echo '</div>';
        // Voucher message position
        echo '<div class="options_group">';
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_position_picker(array('id' => 'message_pos', 'label' => __('Message Position', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => implode(',', $voucher->get_field_position('message')), 'description' => __('Optional position of the user-supplied message', WC_PDF_Product_Vouchers::TEXT_DOMAIN)));
        woocommerce_wp_hidden_input(array('id' => '_message_pos', 'class' => 'field_pos', 'value' => implode(',', $voucher->get_field_position('message'))));
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_font_select(array('id' => '_message', 'label' => __('Font', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'options' => $available_fonts));
        woocommerce_wp_text_input(array('id' => '_message_font_color', 'label' => __('Font color', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['message']['font']['color']) ? $voucher->voucher_fields['message']['font']['color'] : '', 'class' => 'colorpick'));
        woocommerce_wp_text_input(array('id' => '_message_label', 'label' => __('Label', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'description' => __('The field label to show on the frontend/emails', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['message']['label']) ? $voucher->voucher_fields['message']['label'] : 'Message to Recipient'));
        woocommerce_wp_text_input(array('id' => '_message_max_length', 'label' => __('Max Length', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'description' => __('The maximum length of the message field', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'placeholder' => __('No Limit', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => $voucher->get_user_input_field_max_length('message')));
        woocommerce_wp_checkbox(array('id' => '_message_is_enabled', 'label' => __('Enabled', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'description' => __('Display this field on the product page (useful if you want the customer to be able to add a personalized message that will be included in the recipient email without printing it to the voucher)', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => $voucher->user_input_field_is_enabled('message') ? 'yes' : 'no'));
        woocommerce_wp_checkbox(array('id' => '_message_is_required', 'label' => __('Required', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'description' => __('Make this field required in order to add a voucher product to the cart', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => $voucher->user_input_field_is_required('message') ? 'yes' : 'no'));
        woocommerce_wp_select(array('id' => '_message_text_align', 'label' => __('Text Alignment', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'value' => isset($voucher->voucher_fields['message']['text_align']) ? $voucher->voucher_fields['message']['text_align'] : '', 'options' => array('' => '', 'L' => _x('Left', 'left justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'C' => _x('Center', 'center justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN), 'R' => _x('Right', 'right justified', WC_PDF_Product_Vouchers::TEXT_DOMAIN))));
        echo '</div>';
        ?>
			</div>
		</div>
		<?php 
        WC_PDF_Product_Vouchers_Admin_Vouchers::wc_vouchers_wp_color_picker_js();
    }