Ejemplo n.º 1
3
 public function add_vendor_field()
 {
     global $woocommerce, $post;
     echo '<div class="options_group">';
     woocommerce_wp_text_input(array('id' => '_vendor', 'label' => 'Производитель', 'placeholder' => '', 'description' => 'Если не заполенено, то не учавствует в выгрузке маркета', 'type' => 'text'));
     echo '</div>';
 }
function wpuw_add_custom_general_fields()
{
    global $woocommerce, $post;
    $terms = wp_get_post_terms($post->ID, 'product_cat');
    foreach ($terms as $term) {
        $categories[] = $term->slug;
    }
    if (!empty($categories) && in_array('credit', $categories)) {
        echo '<div class="options_group">';
        woocommerce_wp_text_input(array('id' => '_credits_amount', 'label' => __('Credit Amount (' . get_woocommerce_currency_symbol() . ')', 'woocommerce'), 'placeholder' => '0.00', 'desc_tip' => 'true', 'description' => __('The amount of credits for this product in currency format.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
        echo '</div>';
    }
}
    public static function output()
    {
        global $post, $thepostid;
        $thepostid = $post->ID;
        $_product = wc_get_product($thepostid);
        $terms = array();
        $delivery_time = $_product->gzd_product->delivery_time;
        woocommerce_wp_select(array('id' => '_unit', 'label' => __('Unit', 'woocommerce-germanized'), 'options' => array_merge(array('none' => __('Select unit', 'woocommerce-germanized')), WC_germanized()->units->get_units()), 'desc_tip' => true, 'description' => __('Needed if selling on a per unit basis', 'woocommerce-germanized')));
        woocommerce_wp_text_input(array('id' => '_unit_base', 'label' => __('Unit Base', 'woocommerce-germanized'), 'data_type' => 'decimal', 'desc_tip' => true, 'description' => __('Unit price per amount (e.g. 100)', 'woocommerce-germanized')));
        woocommerce_wp_text_input(array('id' => '_unit_price_regular', 'label' => __('Regular Unit Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
        woocommerce_wp_text_input(array('id' => '_unit_price_sale', 'label' => __('Sale Unit Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
        if (version_compare(WC()->version, '2.3', '<')) {
            return;
        }
        ?>
		
		<p class="form-field">
			<label for="delivery_time"><?php 
        _e('Delivery Time', 'woocommerce-germanized');
        ?>
</label>
			<input type="hidden" class="wc-product-search wc-gzd-delivery-time-search" style="width: 50%" id="delivery_time" name="delivery_time" data-minimum_input_length="1" data-allow_clear="true" data-placeholder="<?php 
        _e('Search for a delivery time&hellip;', 'woocommerce-germanized');
        ?>
" data-action="woocommerce_gzd_json_search_delivery_time" data-multiple="false" data-selected="<?php 
        echo $delivery_time ? $delivery_time->name : '';
        ?>
" value="<?php 
        echo $delivery_time ? $delivery_time->term_id : '';
        ?>
" />
		</p>
		
		<?php 
    }
/**
 * Adds the option to set the product as coming soon for single products.
 *
 * @since  1.0.0
 * @access public
 * @uses   woocommerce_wp_checkbox()
 * @uses   woocommerce_wp_text_input()
 */
function ss_wc_write_coming_soon_tab_panel()
{
    echo '<div class="options_group">';
    woocommerce_wp_checkbox(array('id' => '_set_coming_soon', 'label' => __('Set for Coming Soon?', 'ss-wc-coming-soon'), 'desc_tip' => true, 'description' => __('Make sure that you have set the stock to "Out of Stock".', 'ss-wc-coming-soon'), 'wrapper_class' => 'hide_if_variable'));
    woocommerce_wp_text_input(array('id' => '_coming_soon_label', 'label' => __('Coming Soon Label', 'ss-wc-coming-soon'), 'placeholder' => __('Coming Soon', 'ss-wc-coming-soon'), 'desc_tip' => true, 'description' => __('Enter the label you want to show if coming soon is set. Default: Coming Soon', 'ss-wc-coming-soon'), 'wrapper_class' => 'hide_if_variable'));
    echo '</div>';
}
Ejemplo n.º 5
1
/**
 * Create new fields for variations
 *
*/
function variable_fields($loop, $variation_data, $variation)
{
    global $post;
    if (!$post) {
        $post = get_post($variation->ID);
    }
    ?>
	<tr>
		<td>
		</br>
			<?php 
    //$_pg_field = $variation_data['_pg_field'][0]
    $variation_id = $variation->ID;
    $_pg_field = get_post_meta($variation_id, '_pg_field', true);
    /*
    echo "</br>"; 
    var_dump($variation_data); 
    echo "</br>";
    echo "</br>";
    var_dump($variation); 
    echo "</br>";
    echo "</br>";
    var_dump($_pg_field); 
    echo "</br>";
    echo "</br>"."_pg_field : ". $_pg_field ."</br>";
    echo "</br>";
    */
    woocommerce_wp_text_input(array('id' => '_pg_field[' . $loop . ']', 'label' => __('Product Generator Data', 'woocommerce'), 'placeholder' => 'angle="33" lux="100" luxD="100" minD="100" maxD="500"', 'desc_tip' => 'true', 'description' => __('Enter the Product Generator Data here.', 'woocommerce'), 'value' => $_pg_field));
    ?>
		</td>
	</tr>
    
    <?php 
}
 public function add_est_simple_field($post_id)
 {
     global $post, $thepostid, $product;
     $thepostid = $post->ID;
     $product = wc_get_product($thepostid);
     $get_value = 'eddwc_get_';
     $get_value .= $product->get_type();
     echo '<div class="options_group show_if_simple hide_if_external show_if_variable">';
     $type = eddwc_option('display_type');
     $field_type = 'number';
     $fieldClass = '';
     $custom_attributes = '';
     $value = $get_value($thepostid);
     if ($type == 'general_date') {
         $field_type = 'hidden';
         $custom_attributes = array('date-type' => 'range_select');
     } else {
         if ($value != '') {
             $value = explode(',', $value);
             if (isset($value[0]) && isset($value[1]) && $value[0] > $value[1]) {
                 $value = $value[0];
             } else {
                 if (isset($value[0]) && !isset($value[1])) {
                     $value = $value[0];
                 } else {
                     $value = $value[1];
                 }
             }
         }
     }
     woocommerce_wp_text_input(array('id' => EDDWCP_METAKEY, 'label' => __('Est. Dispatch Date:', EDDWC_TXT), 'placeholder' => __('number', EDDWC_TXT), 'type' => $field_type, 'wrapper_class' => $fieldClass, 'value' => $value, 'custom_attributes' => $custom_attributes));
     echo '</div>';
 }
Ejemplo n.º 7
1
 /**
  * Add custom fields to Product General Tab.
  *
  * @subpackage	Product
  */
 function woo_add_custom_general_fields()
 {
     global $woocommerce, $post;
     echo '<div class="options_group">';
     echo '<h2>Book Details</h2>';
     woocommerce_wp_text_input(array('id' => '_amazon_link', 'label' => __('Amazon Link', 'woocommerce'), 'placeholder' => 'Amazon link', 'desc_tip' => true, 'description' => __('Enter Amazon link here.', 'woocommerce')));
     woocommerce_wp_text_input(array('id' => '_isbn', 'label' => __('ISBN', 'woocommerce'), 'placeholder' => 'ISBN', 'desc_tip' => true, 'description' => __('Enter ISBN here.', 'woocommerce')));
     woocommerce_wp_text_input(array('id' => '_number_of_pages', 'label' => __('No of Pages', 'woocommerce'), 'placeholder' => 'No of pages', 'desc_tip' => true, 'description' => __('Enter number of pages here.', 'woocommerce')));
     woocommerce_wp_select(array('id' => '_book_format', 'label' => __('Book Format', 'woocommerce'), 'desc_tip' => true, 'description' => __('Select Book Format.', 'woocommerce'), 'options' => array('paperback' => __('Paperback', 'woocommerce'), 'hardcover' => __('Hardcover', 'woocommerce'), 'ebook' => __('eBook', 'woocommerce'))));
     woocommerce_wp_select(array('id' => '_print_type', 'label' => __('Print Type', 'woocommerce'), 'desc_tip' => true, 'description' => __('Select Print Type.', 'woocommerce'), 'options' => array('colour' => __('Colour', 'woocommerce'), 'black' => __('Black & White', 'woocommerce'))));
     echo '</div>';
 }
Ejemplo n.º 8
0
/**
 * Display the custom WCRC fields on every product edit page
 */
function woo_refercheck_add_custom_general_fields()
{
    global $woocommerce, $post;
    // read the current referrers list
    $referrers = get_post_meta($post->ID, '_woo_refercheck_referrers', true);
    // convert to array
    $ref_array = json_decode($referrers);
    // build the value of the textarea
    $theval = '';
    if (count($ref_array) > 0) {
        $i = 0;
        foreach ($ref_array as $item) {
            $theval .= $item;
            if ($i != count($ref_array) - 1) {
                $theval .= PHP_EOL;
            }
            $i++;
        }
    }
    // start the HTML output for the custom fields
    echo '<div class="options_group">';
    // create and output the checkbox
    woocommerce_wp_checkbox(array('id' => '_woo_refercheck_checkbox', 'label' => __('Limit to referrer(s)', 'woo-refercheck'), 'description' => __('Select if the display of this product should be limited to the specified referrer(s).', 'woo-refercheck')));
    // create and output the text field
    woocommerce_wp_textarea_input(array('id' => '_woo_refercheck_referrers', 'label' => __('Allowed referrer(s)', 'woo-refercheck'), 'placeholder' => '', 'desc_tip' => 'true', 'description' => __('Add the full HTTP addresseses of allowed referrer(s) for this product, one per line.', 'woo-refercheck'), 'value' => $theval));
    woocommerce_wp_text_input(array('id' => '_woo_refercheck_target', 'label' => __('Redirect to', 'woo-refercheck'), 'placeholder' => 'http://', 'desc_tip' => 'true', 'description' => __('Enter the absolute URL to redirect to when this product is accessed form an unallowed referer.', 'woo-refercheck')));
    // complete the HTML output
    echo '</div>';
}
Ejemplo n.º 9
0
/**
 * Creates the Referfriend Meta Box in the admin control panel when in the Giftcard Post Type.  Allows you to create a giftcard manually.
 * @param  [type] $post
 * @return [type]
 */
function rf_meta_box($post)
{
    global $woocommerce;
    wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
    ?>
	<style type="text/css">
		#edit-slug-box, #minor-publishing-actions { display:none }

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

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

	<div class="panel woocommerce_options_panel">
	<?php 
    woocommerce_wp_select(array('id' => 'rf_coupon_type', 'label' => __('Coupon Type', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Coupon Type', 'mg_referfriend'), 'options' => wc_get_coupon_types()));
    woocommerce_wp_text_input(array('id' => 'rf_coupon_amount', 'label' => __('Coupon Amount', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Coupon Amount', 'mg_referfriend'), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
    woocommerce_wp_select(array('id' => 'rf_type', 'label' => __('Type', 'mg_referfriend'), 'placeholder' => '', 'options' => array('' => '', '1' => 'Refered by Email', '2' => 'Refered by share link')));
    // Description
    woocommerce_wp_textarea_input(array('id' => 'rf_description', 'label' => __('Description', 'rpgiftcards'), 'placeholder' => '', 'description' => __('Description', 'rpgiftcards')));
    woocommerce_wp_text_input(array('id' => 'rf_product_id', 'label' => __('Product IDs', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Product IDs', 'mg_referfriend'), 'type' => 'number'));
    woocommerce_wp_text_input(array('id' => 'rf_usage', 'label' => __('Usage', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Usage', 'mg_referfriend')));
    woocommerce_wp_text_input(array('id' => 'rf_limit', 'label' => __('Limit', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Limit', 'mg_referfriend')));
    woocommerce_wp_text_input(array('id' => 'rf_expiry_date', 'label' => __('Expiry Date', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Expiry Date', 'mg_referfriend')));
    echo '</div>';
}
/**
 * Add the custom field to the Edit Product page 
 */
function woo_add_button_text_field()
{
    echo '<div class="options_group">';
    // Custom fields will be created here...
    woocommerce_wp_text_input(array('id' => 'custom-add-to-cart-text', 'label' => __('Custom Add to Cart Text', 'woocommerce'), 'placeholder' => 'Add to Cart', 'desc_tip' => 'true', 'description' => __('Enter any text here that will override the original Add to Cart button text.', 'woocommerce')));
    echo '</div>';
}
 /**
  * Add the field in the product data box
  */
 public function add_video_field()
 {
     echo '<div class="options_group">';
     // Expirey
     woocommerce_wp_text_input(array('id' => '_video_url', 'label' => __('Featured Video URL', 'yit'), 'placeholder' => __('Video URL', 'yit'), 'desc_tip' => true, 'description' => sprintf(__('Enter the URL for the video you want to show in place of the featured image in the product detail page. (the services enabled are: %s).', 'yit'), implode(', ', $this->services))));
     echo '</div>';
 }
Ejemplo n.º 12
0
 public function add_field_funkwoocost()
 {
     global $woocommerce, $post;
     echo '<div class="options_group">';
     woocommerce_wp_text_input(array('id' => '_funkwoocost', 'label' => sprintf(__('Product Cost (%s)', 'funkwoocost'), get_woocommerce_currency_symbol()), 'placeholder' => '', 'description' => __('Add product cost for profit report.', 'funkwoocost'), 'type' => 'number'));
     echo '</div>';
 }
function woo_add_custom_wholesale_price_fields()
{
    global $woocommerce, $post;
    echo '<div class="options_group">';
    woocommerce_wp_text_input(array('id' => '_wholesale_price', 'label' => __('Wholesale Price (' . get_woocommerce_currency_symbol() . ')', 'woocommerce'), 'desc_tip' => 'true', 'description' => __('Price will be applicable only for wholesale customers', 'woocommerce')));
    echo '</div>';
}
/**
 * Create new fields for new variations
 *
*/
function variable_fields_js()
{
    ?>
	<tr>
		<td>
			<?php 
    // Text Field
    woocommerce_wp_text_input(array('id' => '_retailer_price[ + loop + ]', 'label' => __('Retailer Price', 'woocommerce'), 'placeholder' => '0', 'data_type' => 'price', 'wrapper_class' => 'form-row form-row-first', 'value' => ''));
    ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php 
    // Text Field
    woocommerce_wp_text_input(array('id' => '_retailer_price_sale[ + loop + ]', 'label' => __('Retailer Sale Price', 'woocommerce'), 'placeholder' => '0', 'data_type' => 'price', 'wrapper_class' => 'form-row form-row-last', 'value' => ''));
    ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php 
    // Number Field
    woocommerce_wp_text_input(array('id' => '_minimum_quantity[ + loop + ]', 'label' => __('Minimum Quantity for Retailer', 'woocommerce'), 'desc_tip' => 'true', 'description' => __('Enter the custom number here.', 'woocommerce'), 'value' => '', 'custom_attributes' => array('step' => 'any', 'min' => '1')));
    ?>
		</td>
	</tr>
<?php 
}
 /**
  * Render simple product points earned / maximum discount fields
  *
  * @since 1.0
  */
 public function render_simple_product_fields()
 {
     // points earned
     woocommerce_wp_text_input(array('id' => '_wc_points_earned', 'wrapper_class' => 'show_if_simple', 'class' => 'short', 'label' => __('Points Earned', 'wc_points_rewards'), 'description' => __('This can be either a fixed number of points earned for purchasing this product, or a percentage which assigns points based on the price. For example, if you want to award points equal to double the normal rate, enter 200%.  This setting modifies the global Points Conversion Rate and overrides any category value.  Use 0 to assign no points for this product, and empty to use the global/category settings.', 'wc_points_rewards'), 'desc_tip' => true, 'type' => 'text'));
     // maximum discount allowed on product
     woocommerce_wp_text_input(array('id' => '_wc_points_max_discount', 'class' => 'short', 'wrapper_class' => 'show_if_simple', 'label' => __('Maximum Points Discount', 'wc_points_rewards'), 'description' => __('Enter either a fixed maximum discount amount or percentage which restricts the amount of points that can be redeemed for a discount based on the product price. For example, if you want to restrict the discount on this product to a maximum of 50%, enter 50%, or enter 5 to restrict the maximum discount to $5.  This setting overrides the global/category defaults, use 0 to disable point discounts for this product, and blank to use the global/category default.', 'wc_points_rewards'), 'desc_tip' => true, 'type' => 'text'));
 }
Ejemplo n.º 16
0
 /**
  * Adding price note options on WooCommerce single product general section.
  *
  * @return void
  */
 public static function awspn_add_custom_general_field()
 {
     echo '<div class="options_group">';
     // Product per note separator
     woocommerce_wp_text_input(array('id' => 'awspn_product_price_note_separator', 'label' => __('Note Separator', 'woo-set-price-note'), 'placeholder' => '/', 'desc_tip' => 'true', 'description' => __('Enter separator between price and note, like, "/", "-", "per", etc', 'woo-set-price-note')));
     // Product per note text
     woocommerce_wp_text_input(array('id' => 'awspn_product_price_note', 'label' => __('Price Note', 'woo-set-price-note'), 'placeholder' => 'Piece', 'desc_tip' => 'true', 'description' => __('Enter price note that you want to display with product price, like, Offer, Unit, Edition, etc.', 'woo-set-price-note')));
     echo '</div>';
 }
    /**
     * Admin min/max settings display / save.
     */
    public static function min_max_count_admin_option()
    {
        ?>
<div class="options_group"><?php 
        woocommerce_wp_text_input(array('id' => '_wcpb_min_qty_limit', 'type' => 'number', 'label' => __('Min Items', 'woocommerce'), 'desc_tip' => 'false', 'description' => __('Minimum allowed quantity of items in the bundle.', 'woocommerce-product-bundles-min-max-items')));
        woocommerce_wp_text_input(array('id' => '_wcpb_max_qty_limit', 'type' => 'number', 'label' => __('Max Items', 'woocommerce'), 'desc_tip' => 'false', 'description' => __('Maximum allowed quantity of items in the bundle.', 'woocommerce-product-bundles-min-max-items')));
        ?>
</div><?php 
    }
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);
}
function woo_add_custom_general_fields()
{
    global $woocommerce, $post;
    echo '<div id="thong_tin_hoa_chat" class="panel woocommerce_options_panel"><div class="options_group">';
    woocommerce_wp_text_input(array('id' => '_ten_hoa_hoc_field', 'label' => __('Tển hoá học', 'woocommerce'), 'placeholder' => 'Calcium Hypochlorite', 'desc_tip' => 'true', 'description' => __('Enter the custom value here.', 'woocommerce')));
    woocommerce_wp_textarea_input(array('id' => '_ten_goi_khac_field', 'label' => __('Các tên gọi khác', 'woocommerce'), 'placeholder' => 'Tên gọi 1, Tên gọi 2, Tên gọi 3', 'desc_tip' => 'true', 'description' => __('Enter the custom value here.', 'woocommerce')));
    woocommerce_wp_text_input(array('id' => '_cong_thuc_hoa_hoc_field', 'label' => __('Công thức hoá học', 'woocommerce'), 'placeholder' => 'Ca(OCl)2', 'desc_tip' => 'true', 'description' => __('Enter the custom value here.', 'woocommerce')));
    woocommerce_wp_text_input(array('id' => '_ham_luong_hoa_chat_field', 'label' => __('Hàm lượng hoá chất', 'woocommerce'), 'placeholder' => '%', 'desc_tip' => 'true', 'description' => __('Enter the custom value here.', 'woocommerce')));
    woocommerce_wp_text_input(array('id' => '_xuat_xu_field', 'label' => __('Xuất xứ', 'woocommerce'), 'placeholder' => '', 'desc_tip' => 'true', 'description' => __('Enter the custom value here.', 'woocommerce')));
    woocommerce_wp_text_input(array('id' => '_dong_goi_field', 'label' => __('Đóng gói', 'woocommerce'), 'placeholder' => 'Kg/1thùng', 'desc_tip' => 'true', 'description' => __('Enter the custom value here.', 'woocommerce')));
    echo '</div></div>';
}
 function wsbs_calculator_tab_options()
 {
     global $post, $woocommerce, $product;
     // Start a container
     echo "<div id=\"calculator_tab_data\" class=\"panel woocommerce_options_panel\">";
     // Boolean calculator
     woocommerce_wp_checkbox(array('id' => '_calculatorscript_active', 'label' => __('Enable Calculator', 'wsbs'), 'value' => esc_attr($post->_calculatorscript_active)));
     // Calculator value
     woocommerce_wp_text_input(array('id' => '_calculatorscript_value', 'label' => __('Calculator value', 'wsbs'), 'description' => __('This package contains ... m<sup>2</sup> (e.g. 1.5)', 'woocommerce'), 'value' => $post->_calculatorscript_value));
     // Close the container
     echo "</div>";
 }
 public function points_add_custom_settings()
 {
     global $woocommerce, $post;
     echo '<div class="options_group show-if-points">';
     // Commission Price pulled from WooCommerce Core
     woocommerce_wp_text_input(array('id' => '_regular_price', 'label' => __('Commission Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
     // Create a number field, for example for UPC
     woocommerce_wp_text_input(array('id' => 'points_product_cost', 'label' => __('Points Cost', 'woocommerce'), 'placeholder' => '', 'desc_tip' => 'true', 'description' => __('Enter the amount of points this product costs.', 'woocommerce'), 'type' => 'number'));
     // Individual product
     woocommerce_wp_checkbox(array('id' => '_sold_individually', 'label' => __('Sold Individually', 'woocommerce'), 'description' => __('Enable this to only allow one of this item to be bought in a single order', 'woocommerce')));
     echo '</div>';
 }
 public function add_to_metabox()
 {
     global $post;
     echo '<div class="options_group">';
     // Checkbox
     woocommerce_wp_checkbox(array('id' => '_wc_extension_boilerplate_checkbox', 'wrapper_class' => 'show_if_simple', 'label' => __('Sample Checkbox', 'woocommerce-extension-boilerplate'), 'description' => __('This is a sample checkbox.', 'woocommerce-extension-boilerplate')));
     // Number
     woocommerce_wp_text_input(array('id' => '_wc_extension_boilerplate_number', 'class' => 'show_if_simple', 'label' => __('Sample Number Field', 'woocommerce-extension-boilerplate'), 'desc_tip' => 'true', 'description' => __('This is a sample number field', 'woocommerce-extension-boilerplate'), 'type' => 'decimal'));
     // Text
     woocommerce_wp_text_input(array('id' => '_wc_extension_boilerplate_textbox', 'class' => 'show_if_simple', 'label' => __('Sample Text Field', 'woocommerce-extension-boilerplate'), 'desc_tip' => 'true', 'description' => __('This is a sample text field', 'woocommerce-extension-boilerplate')));
     do_action('wc_extension_boilerplate_product_options');
     echo '</div>';
 }
 public static function output()
 {
     global $post, $thepostid;
     $thepostid = $post->ID;
     $_product = wc_get_product($thepostid);
     $terms = array();
     woocommerce_wp_select(array('id' => '_unit', 'label' => __('Unit', 'woocommerce-germanized'), 'options' => array_merge(array('none' => __('Select unit', 'woocommerce-germanized')), WC_germanized()->units->get_units()), 'desc_tip' => true, 'description' => __('Needed if selling on a per unit basis', 'woocommerce-germanized')));
     woocommerce_wp_text_input(array('id' => '_unit_product', 'label' => __('Product Units', 'woocommerce-germanized'), 'data_type' => 'decimal', 'desc_tip' => true, 'description' => __('Number of units included per default product price. Example: 1000 ml.', 'woocommerce-germanized')));
     woocommerce_wp_text_input(array('id' => '_unit_base', 'label' => __('Base Price Units', 'woocommerce-germanized'), 'data_type' => 'decimal', 'desc_tip' => true, 'description' => __('Base price units. Example base price: 0,99 € / 100 ml. Insert 100 as base price unit amount.', 'woocommerce-germanized')));
     woocommerce_wp_checkbox(array('id' => '_unit_price_auto', 'label' => __('Calculation', 'woocommerce-germanized'), 'description' => '<span class="wc-gzd-premium-desc">' . __('Calculate base prices automatically.', 'woocommerce-germanized') . '</span> <a href="https://vendidero.de/woocommerce-germanized#buy" target="_blank" class="wc-gzd-pro">pro</a>'));
     woocommerce_wp_text_input(array('id' => '_unit_price_regular', 'label' => __('Regular Base Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
     woocommerce_wp_text_input(array('id' => '_unit_price_sale', 'label' => __('Sale Base Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
 }
 function meta_box()
 {
     global $woocommerce, $post;
     $order = new WC_Order($post->ID);
     $order_discount = $order->get_total_discount();
     $order_tax = $order->get_total_tax();
     $order_subtotal = $order->get_subtotal_to_display();
     $order_total = $order->get_formatted_order_total();
     get_payment_gateway_fields('paypal');
     woocommerce_wp_select(array('id' => 'payment_type', 'label' => '', 'value' => 'default', 'options' => ins_get_payment_methods(), 'class' => 'chosen-select'));
     woocommerce_wp_select(array('id' => 'add_coupon', 'label' => '', 'value' => 'default', 'options' => ins_get_coupons(), 'class' => 'chosen-select'));
     woocommerce_wp_text_input(array('id' => 'sub_total', 'label' => __('Order Subtotal', 'instore'), 'placeholder' => 0.0, 'value' => $order_subtotal));
     woocommerce_wp_text_input(array('id' => 'order_tax', 'label' => __('Order Tax', 'instore'), 'placeholder' => 0.0, 'value' => $order_tax));
     woocommerce_wp_text_input(array('id' => 'applied_discount', 'label' => __('Applied Discount', 'instore'), 'placeholder' => 0.0, 'value' => $order_discount));
 }
Ejemplo n.º 25
0
/**
 * Contents of the rental options product tab.
 */
function rental_options_product_tab_content()
{
    global $post;
    ?>
<div id='rental_options' class='panel woocommerce_options_panel'><?php 
    ?>
<div class='options_group'><?php 
    woocommerce_wp_checkbox(array('id' => '_enable_renta_option', 'label' => __('Enable rental option X', 'woocommerce')));
    woocommerce_wp_text_input(array('id' => '_text_input_y', 'label' => __('What is the value of Y', 'woocommerce'), 'desc_tip' => 'true', 'description' => __('A handy description field', 'woocommerce'), 'type' => 'text'));
    print_r(wc_get_product($post));
    ?>
</div>

  </div><?php 
}
 public function product_settings_fields()
 {
     global $woocommerce, $post;
     echo '<div id="fees_product_data" class="fee_panel panel woocommerce_options_panel wc-metaboxes-wrapper">';
     echo '<div class="options_group">';
     // Text Field - Fee Name
     woocommerce_wp_text_input(array('id' => 'product-fee-name', 'label' => __('Fee Name', 'woocommerce-product-fees'), 'data_type' => 'text', 'placeholder' => __('Product Fee', 'placeholder', 'woocommerce-product-fees'), 'desc_tip' => 'true', 'description' => __('This will be shown at checkout descriping the added fee.', 'woocommerce-product-fees')));
     // Text Field - Fee Amount
     woocommerce_wp_text_input(array('id' => 'product-fee-amount', 'label' => __('Fee Amount', 'woocommerce-product-fees') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price', 'desc_tip' => 'true', 'description' => __('Enter a monetary decimal without any currency symbols or thousand seperators. This field also accepts percentages.', 'woocommerce-product-fees')));
     echo '</div>';
     echo '<div class="options_group">';
     // Check Box - Fee Multiply Option
     woocommerce_wp_checkbox(array('id' => 'product-fee-multiplier', 'label' => __('Multiply Fee by Quantity', 'woocommerce-product-fees'), 'desc_tip' => 'true', 'description' => __('Multiply the fee by the quanitity of this product that is added to the cart.', 'woocommerce-product-fees')));
     echo '</div>';
     echo '</div>';
 }
 public function variation_settings_fields($loop, $variation_data, $variation)
 {
     // Set placeholders based on global product level fees.
     $parent_id = $variation->post_parent;
     if (get_post_meta($parent_id, 'product-fee-name', true) != '' && get_post_meta($parent_id, 'product-fee-amount', true) != '') {
         $placeholders = array('name' => get_post_meta($parent_id, 'product-fee-name', true), 'amount' => get_post_meta($parent_id, 'product-fee-amount', true));
     } else {
         $placeholders = array('name' => __('Product Fee', 'woocommerce-product-fees'), 'amount' => __('Monetary Decimal or Percentage', 'woocommerce-product-fees'));
     }
     // Text Field - Fee Name
     woocommerce_wp_text_input(array('id' => 'product-fee-name[' . $variation->ID . ']', 'label' => __('Fee Name', 'woocommerce-product-fees'), 'data_type' => 'text', 'placeholder' => $placeholders['name'], 'value' => get_post_meta($variation->ID, 'product-fee-name', true), 'wrapper_class' => "form-row form-row-first"));
     // Text Field - Fee Amount
     woocommerce_wp_text_input(array('id' => 'product-fee-amount[' . $variation->ID . ']', 'label' => __('Fee Amount', 'woocommerce-product-fees') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price', 'placeholder' => $placeholders['amount'], 'value' => get_post_meta($variation->ID, 'product-fee-amount', true), 'wrapper_class' => "form-row form-row-last"));
     // Check Box - Fee Multiply Option
     woocommerce_wp_checkbox(array('id' => 'product-fee-multiplier[' . $variation->ID . ']', 'label' => __('Multiply Fee by Quantity', 'woocommerce-product-fees'), 'value' => get_post_meta($variation->ID, 'product-fee-multiplier', true), 'wrapper_class' => "product-fee-multiplier"));
     do_action('wcpf_add_variation_settings');
 }
 function meta_box()
 {
     global $woocommerce, $post;
     // Providers
     echo '<p class="form-field tracking_provider_field"><label for="tracking_provider">' . __('Provider:', 'shipment-tracker') . '</label><br/><select id="tracking_provider" name="tracking_provider" class="chosen_select">';
     $selected_provider = get_post_meta($post->ID, '_tracking_provider', true);
     foreach ($this->providers as $provider => $url) {
         echo '<option value="' . sanitize_title($provider) . '" ' . selected(sanitize_title($provider), $selected_provider, true) . '>' . $provider . '</option>';
     }
     echo '</select> ';
     woocommerce_wp_text_input(array('id' => 'tracking_number', 'label' => __('Tracking number:', 'shipment-tracker'), 'placeholder' => '', 'description' => '', 'value' => get_post_meta($post->ID, '_tracking_number', true)));
     woocommerce_wp_text_input(array('id' => 'date_shipped', 'label' => __('Date shipped:', 'shipment-tracker'), 'placeholder' => 'YYYY-MM-DD', 'description' => '', 'class' => 'date-picker-field', 'value' => ($date = get_post_meta($post->ID, '_date_shipped', true)) ? date('Y-m-d', $date) : ''));
     // Live preview
     echo '<p class="preview_tracking_link">' . __('Preview:', 'shipment-tracker') . ' <a href="" target="_blank">' . __('Click here to track your shipment', 'shipment-tracker') . '</a></p>';
     $provider_array = array();
     foreach ($this->providers as $provider => $url) {
         $provider_array[sanitize_title($provider)] = urlencode($url);
     }
     wc_enqueue_js("\n\t\t\t\tjQuery('p.custom_tracking_link_field, p.custom_tracking_provider_field').hide();\n\n\t\t\t\tjQuery('input#custom_tracking_link, input#tracking_number, #tracking_provider').change(function(){\n\n\t\t\t\t\tvar tracking = jQuery('input#tracking_number').val();\n\t\t\t\t\tvar provider = jQuery('#tracking_provider').val();\n\t\t\t\t\tvar providers = jQuery.parseJSON( '" . json_encode($provider_array) . "' );\n\n\t\t\t\t\tvar postcode = jQuery('#_shipping_postcode').val();\n\n\t\t\t\t\tif ( ! postcode )\n\t\t\t\t\t\tpostcode = jQuery('#_billing_postcode').val();\n\n\t\t\t\t\tpostcode = encodeURIComponent( postcode );\n\n\t\t\t\t\tvar link = '';\n\n\t\t\t\t\tif ( providers[ provider ] ) {\n\t\t\t\t\t\tlink = providers[provider];\n\t\t\t\t\t\tlink = link.replace( '%7BTRACKING_URL%7D', tracking );\n\t\t\t\t\t\tlink = link.replace( '%7BPOSTCODE%7D', postcode );\n\t\t\t\t\t\tlink = decodeURIComponent( link );\n\n\t\t\t\t\t\tjQuery('p.custom_tracking_link_field, p.custom_tracking_provider_field').hide();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery('p.custom_tracking_link_field, p.custom_tracking_provider_field').show();\n\n\t\t\t\t\t\tlink = jQuery('input#custom_tracking_link').val();\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( link ) {\n\t\t\t\t\t\tjQuery('p.preview_tracking_link a').attr('href', link);\n\t\t\t\t\t\tjQuery('p.preview_tracking_link').show();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery('p.preview_tracking_link').hide();\n\t\t\t\t\t}\n\n\t\t\t\t}).change();\n\t\t\t");
 }
 public function product_settings_fields()
 {
     global $woocommerce, $post;
     echo '<div id="fees_product_data" class="fee_panel panel woocommerce_options_panel wc-metaboxes-wrapper">';
     echo '<div class="options_group">';
     // Text Field - Fee Name
     woocommerce_wp_text_input(array('id' => 'product-fee-name', 'label' => __('Fee Name', 'woocommerce-product-fees'), 'data_type' => 'text', 'placeholder' => __('Product Fee', 'placeholder', 'woocommerce-product-fees'), 'desc_tip' => 'true', 'description' => __('This will be shown at checkout descriping the added fee.', 'woocommerce-product-fees')));
     // Load product's base currency. It will be used to show the Admin which
     // fees can be calculated automatically
     $product_base_currency = WooCommerce_Product_Fees_Currency_Helper::get_product_base_currency($post->ID);
     // Get a list of the enabled currencies. We will need to display one price
     // field for each. By using the merge/unique trick, we can make sure that
     // product's base currency is always the first in the list (the enabled_currencies()
     // method returns them sorted alphabetically)
     $enabled_currencies = array_unique(array_merge(array($product_base_currency), WooCommerce_Product_Fees_Currency_Helper::enabled_currencies()));
     $placeholder = '';
     foreach ($enabled_currencies as $currency) {
         $field_description = __('Enter a monetary decimal without any currency symbols or thousand separators. This field also accepts percentages.', 'woocommerce-product-fees');
         // For additional currencies, add an extra description to explain that the
         // fees can be calculated automatically
         if ($currency != $product_base_currency) {
             $field_description = ' ' . sprintf(__('If you leave this field empty, its value will be calculated automatically, by converting the base amount in %s to this currency.', 'woocommerce-product-fees'), $product_base_currency);
         }
         // If we have more than one currency, show a different placeholder for
         // the base currency and the additional ones, to help the admin to understand
         // which ones can be calculated automatically. When a single currency is
         // used, the placeholder can be left empty, as the field's purpose is
         // obvious
         if (count($enabled_currencies) > 1) {
             $placeholder = $currency === $product_base_currency ? __('Base amount', 'woocommerce-product-fees') : __('Auto', 'woocommerce-product-fees');
         }
         // Text Field - Fee Amount
         woocommerce_wp_text_input(array('id' => 'product-fee-amount-' . $currency, 'label' => __('Fee Amount', 'woocommerce-product-fees') . ' (' . $currency . ')', 'data_type' => 'price', 'desc_tip' => 'true', 'description' => $field_description, 'name' => 'product-fee-amount[' . $currency . ']', 'placeholder' => $placeholder));
     }
     echo '</div>';
     echo '<div class="options_group">';
     // Check Box - Fee Multiply Option
     woocommerce_wp_checkbox(array('id' => 'product-fee-multiplier', 'label' => __('Multiply Fee by Quantity', 'woocommerce-product-fees'), 'desc_tip' => 'true', 'description' => __('Multiply the fee by the quanitity of this product that is added to the cart.', 'woocommerce-product-fees')));
     echo '</div>';
     echo '</div>';
 }
/**
 * Coupon data meta box
 * 
 * Displays the meta box
 */
function woocommerce_coupon_data_meta_box($post)
{
    global $woocommerce;
    wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
    ?>
	<style type="text/css">
		#edit-slug-box { display:none }
	</style>
	<div id="coupon_options" class="panel woocommerce_options_panel">
		<?php 
    // Type
    woocommerce_wp_select(array('id' => 'discount_type', 'label' => __('Discount type', 'woocommerce'), 'options' => $woocommerce->get_coupon_discount_types()));
    // Amount
    woocommerce_wp_text_input(array('id' => 'coupon_amount', 'label' => __('Coupon amount', 'woocommerce'), 'placeholder' => __('0.00', 'woocommerce'), 'description' => __('Enter an amount e.g. 2.99', 'woocommerce')));
    // Individual use
    woocommerce_wp_checkbox(array('id' => 'individual_use', 'label' => __('Individual use', 'woocommerce'), 'description' => __('Check this box if the coupon cannot be used in conjunction with other coupons', 'woocommerce')));
    // Apply before tax
    woocommerce_wp_checkbox(array('id' => 'apply_before_tax', 'label' => __('Apply before tax', 'woocommerce'), 'description' => __('Check this box if the coupon should be applied before calculating cart tax', 'woocommerce')));
    // Free Shipping
    woocommerce_wp_checkbox(array('id' => 'free_shipping', 'label' => __('Enable free shipping', 'woocommerce'), 'description' => sprintf(__('Check this box if the coupon enables free shipping (see <a href="%s">Free Shipping</a>)', 'woocommerce'), admin_url('admin.php?page=woocommerce&tab=shipping_methods&subtab=shipping-free_shipping'))));
    // Product ids
    woocommerce_wp_text_input(array('id' => 'product_ids', 'label' => __('Product IDs', 'woocommerce'), 'placeholder' => __('N/A', 'woocommerce'), 'description' => __('(optional) Comma separate IDs which need to be in the cart to use this coupon or, for "Product Discounts", which products are discounted.', 'woocommerce')));
    // Exclude Product ids
    woocommerce_wp_text_input(array('id' => 'exclude_product_ids', 'label' => __('Exclude Product IDs', 'woocommerce'), 'placeholder' => __('N/A', 'woocommerce'), 'description' => __('(optional) Comma separate IDs which must not be in the cart to use this coupon or, for "Product Discounts", which products are not discounted.', 'woocommerce')));
    // Usage limit
    woocommerce_wp_text_input(array('id' => 'usage_limit', 'label' => __('Usage limit', 'woocommerce'), 'placeholder' => __('Unlimited usage', 'woocommerce'), 'description' => __('(optional) How many times this coupon can be used before it is void', 'woocommerce')));
    // Expiry date
    woocommerce_wp_text_input(array('id' => 'expiry_date', 'label' => __('Expiry date', 'woocommerce'), 'placeholder' => __('Never expire', 'woocommerce'), 'description' => __('(optional) The date this coupon will expire, <code>YYYY-MM-DD</code>', 'woocommerce'), 'class' => 'short date-picker'));
    do_action('woocommerce_coupon_options');
    ?>
	</div>
	<?php 
}