• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wc_format_localized_price函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wc_format_localized_price函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_format_localized_price函数的具体用法?PHP wc_format_localized_price怎么用?PHP wc_format_localized_price使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wc_format_localized_price函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: init_form_fields

 public function init_form_fields()
 {
     $zakladni = array('enabled' => array('title' => 'Povolit', 'type' => 'checkbox', 'label' => 'Aktivovat a zobrazit v nabídce dostupných možností dopravy.', 'default' => 'no'), 'dpd_parcelshop_nazev' => array('title' => 'Název', 'type' => 'text', 'description' => 'Název pro zobrazení v eshopu.', 'default' => 'DPD ParcelShop', 'css' => 'width: 300px;'), 'dpd_parcelshop_zakladni-cena' => array('title' => 'Základní cena', 'type' => 'price', 'description' => 'Pokud nebude cena vyplněna, tak bude nulová.', 'default' => '', 'css' => 'width: 100px;', 'placeholder' => wc_format_localized_price(0)), 'dpd_parcelshop_dobirka' => array('title' => 'Poplatek za dobírku', 'type' => 'price', 'description' => 'Pro fungování dodatečného poplatku za dobírku je třeba použít plugin <a href="https://wordpress.org/plugins/woocommerce-pay-for-payment/">WooCommerce Pay for Payment</a> a nastavit u něj stejný poplatek za dobírku (menu Pokladna - Hotově při doručení).', 'default' => '', 'css' => 'width: 100px;', 'placeholder' => wc_format_localized_price(0)));
     $slovensko = array('dpd_parcelshop_zakladni-cena-slovensko' => array('title' => 'Základní cena (Slovensko)', 'type' => 'price', 'description' => 'Pokud nebude cena vyplněna, tak bude nulová.', 'default' => '', 'css' => 'width: 100px;', 'placeholder' => wc_format_localized_price(0)), 'dpd_parcelshop_dobirka-slovensko' => array('title' => 'Poplatek za dobírku (Slovensko)', 'type' => 'price', 'description' => 'Pro fungování dodatečného poplatku za dobírku je třeba použít plugin <a href="https://wordpress.org/plugins/woocommerce-pay-for-payment/">WooCommerce Pay for Payment</a> a nastavit u něj stejný poplatek za dobírku (menu Pokladna - Hotově při doručení).', 'default' => '', 'css' => 'width: 100px;', 'placeholder' => wc_format_localized_price(0)));
     $zvolene_zeme = WC()->countries->get_shipping_countries();
     if (array_key_exists('SK', $zvolene_zeme)) {
         $this->form_fields = array_merge($zakladni, $slovensko);
     } else {
         $this->form_fields = $zakladni;
     }
 }
开发者ID:viktorjezekcz,项目名称:ceske-sluzby,代码行数:11,代码来源:class-ceske-sluzby-dpd-parcelshop.php


示例2: woocommerce_wp_text_input

/**
 * Output a text input box.
 *
 * @param array $field
 */
function woocommerce_wp_text_input($field)
{
    global $thepostid, $post;
    $thepostid = empty($thepostid) ? $post->ID : $thepostid;
    $field['placeholder'] = isset($field['placeholder']) ? $field['placeholder'] : '';
    $field['class'] = isset($field['class']) ? $field['class'] : 'short';
    $field['style'] = isset($field['style']) ? $field['style'] : '';
    $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
    $field['value'] = isset($field['value']) ? $field['value'] : get_post_meta($thepostid, $field['id'], true);
    $field['name'] = isset($field['name']) ? $field['name'] : $field['id'];
    $field['type'] = isset($field['type']) ? $field['type'] : 'text';
    $field['desc_tip'] = isset($field['desc_tip']) ? $field['desc_tip'] : false;
    $data_type = empty($field['data_type']) ? '' : $field['data_type'];
    switch ($data_type) {
        case 'price':
            $field['class'] .= ' wc_input_price';
            $field['value'] = wc_format_localized_price($field['value']);
            break;
        case 'decimal':
            $field['class'] .= ' wc_input_decimal';
            $field['value'] = wc_format_localized_decimal($field['value']);
            break;
        case 'stock':
            $field['class'] .= ' wc_input_stock';
            $field['value'] = wc_stock_amount($field['value']);
            break;
        case 'url':
            $field['class'] .= ' wc_input_url';
            $field['value'] = esc_url($field['value']);
            break;
        default:
            break;
    }
    // Custom attribute handling
    $custom_attributes = array();
    if (!empty($field['custom_attributes']) && is_array($field['custom_attributes'])) {
        foreach ($field['custom_attributes'] as $attribute => $value) {
            $custom_attributes[] = esc_attr($attribute) . '="' . esc_attr($value) . '"';
        }
    }
    echo '<p class="form-field ' . esc_attr($field['id']) . '_field ' . esc_attr($field['wrapper_class']) . '">
		<label for="' . esc_attr($field['id']) . '">' . wp_kses_post($field['label']) . '</label>';
    if (!empty($field['description']) && false !== $field['desc_tip']) {
        echo wc_help_tip($field['description']);
    }
    echo '<input type="' . esc_attr($field['type']) . '" class="' . esc_attr($field['class']) . '" style="' . esc_attr($field['style']) . '" name="' . esc_attr($field['name']) . '" id="' . esc_attr($field['id']) . '" value="' . esc_attr($field['value']) . '" placeholder="' . esc_attr($field['placeholder']) . '" ' . implode(' ', $custom_attributes) . ' /> ';
    if (!empty($field['description']) && false === $field['desc_tip']) {
        echo '<span class="description">' . wp_kses_post($field['description']) . '</span>';
    }
    echo '</p>';
}
开发者ID:woocommerce,项目名称:woocommerce,代码行数:56,代码来源:wc-meta-box-functions.php


示例3: woocommerce_wp_text_input

/**
 * Output a text input box.
 *
 * @access public
 * @param array $field
 * @return void
 */
function woocommerce_wp_text_input($field)
{
    global $thepostid, $post, $woocommerce;
    $thepostid = empty($thepostid) ? $post->ID : $thepostid;
    $field['placeholder'] = isset($field['placeholder']) ? $field['placeholder'] : '';
    $field['class'] = isset($field['class']) ? $field['class'] : 'short';
    $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
    $field['value'] = isset($field['value']) ? $field['value'] : get_post_meta($thepostid, $field['id'], true);
    $field['name'] = isset($field['name']) ? $field['name'] : $field['id'];
    $field['type'] = isset($field['type']) ? $field['type'] : 'text';
    $data_type = empty($field['data_type']) ? '' : $field['data_type'];
    switch ($data_type) {
        case 'price':
            $field['class'] .= ' wc_input_price';
            $field['value'] = wc_format_localized_price($field['value']);
            break;
        case 'decimal':
            $field['class'] .= ' wc_input_decimal';
            $field['value'] = wc_format_localized_decimal($field['value']);
            break;
    }
    // Custom attribute handling
    $custom_attributes = array();
    if (!empty($field['custom_attributes']) && is_array($field['custom_attributes'])) {
        foreach ($field['custom_attributes'] as $attribute => $value) {
            $custom_attributes[] = esc_attr($attribute) . '="' . esc_attr($value) . '"';
        }
    }
    echo '<p class="form-field ' . esc_attr($field['id']) . '_field ' . esc_attr($field['wrapper_class']) . '"><label for="' . esc_attr($field['id']) . '">' . wp_kses_post($field['label']) . '</label><input type="' . esc_attr($field['type']) . '" class="' . esc_attr($field['class']) . '" name="' . esc_attr($field['name']) . '" id="' . esc_attr($field['id']) . '" value="' . esc_attr($field['value']) . '" placeholder="' . esc_attr($field['placeholder']) . '" ' . implode(' ', $custom_attributes) . ' /> ';
    if (!empty($field['description'])) {
        if (isset($field['desc_tip']) && false !== $field['desc_tip']) {
            echo '<img class="help_tip" data-tip="' . esc_attr($field['description']) . '" src="' . esc_url(WC()->plugin_url()) . '/assets/images/help.png" height="16" width="16" />';
        } else {
            echo '<span class="description">' . wp_kses_post($field['description']) . '</span>';
        }
    }
    echo '</p>';
}
开发者ID:chhavinav,项目名称:fr.ilovejuice,代码行数:45,代码来源:wc-meta-box-functions.php


示例4: output

    /**
     * Output the metabox.
     *
     * @param WP_Post $post
     */
    public static function output($post)
    {
        wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
        $coupon = new WC_Coupon($post->ID);
        ?>
		<style type="text/css">
			#edit-slug-box, #minor-publishing-actions { display:none }
		</style>
		<div id="coupon_options" class="panel-wrap coupon_data">

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

			<ul class="coupon_data_tabs wc-tabs" style="display:none;">
				<?php 
        $coupon_data_tabs = apply_filters('woocommerce_coupon_data_tabs', array('general' => array('label' => __('General', 'woocommerce'), 'target' => 'general_coupon_data', 'class' => 'general_coupon_data'), 'usage_restriction' => array('label' => __('Usage restriction', 'woocommerce'), 'target' => 'usage_restriction_coupon_data', 'class' => ''), 'usage_limit' => array('label' => __('Usage limits', 'woocommerce'), 'target' => 'usage_limit_coupon_data', 'class' => '')));
        foreach ($coupon_data_tabs as $key => $tab) {
            ?>
<li class="<?php 
            echo $key;
            ?>
_options <?php 
            echo $key;
            ?>
_tab <?php 
            echo implode(' ', (array) $tab['class']);
            ?>
">
							<a href="#<?php 
            echo $tab['target'];
            ?>
"><?php 
            echo esc_html($tab['label']);
            ?>
</a>
						</li><?php 
        }
        ?>
			</ul>
			<div id="general_coupon_data" class="panel woocommerce_options_panel"><?php 
        // Type
        woocommerce_wp_select(array('id' => 'discount_type', 'label' => __('Discount type', 'woocommerce'), 'options' => wc_get_coupon_types()));
        // Amount
        woocommerce_wp_text_input(array('id' => 'coupon_amount', 'label' => __('Coupon amount', 'woocommerce'), 'placeholder' => wc_format_localized_price(0), 'description' => __('Value of the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // Free Shipping
        woocommerce_wp_checkbox(array('id' => 'free_shipping', 'label' => __('Allow free shipping', 'woocommerce'), 'description' => sprintf(__('Check this box if the coupon grants free shipping. A <a href="%s" target="_blank">free shipping method</a> must be enabled in your shipping zone and be set to require "a valid free shipping coupon" (see the "Free Shipping Requires" setting).', 'woocommerce'), 'https://docs.woocommerce.com/document/free-shipping/')));
        // Expiry date
        $expiry_date = $coupon->get_date_expires() ? date('Y-m-d', $coupon->get_date_expires()) : '';
        woocommerce_wp_text_input(array('id' => 'expiry_date', 'value' => esc_attr($expiry_date), 'label' => __('Coupon expiry date', 'woocommerce'), 'placeholder' => esc_attr__('YYYY-MM-DD', 'woocommerce'), 'description' => '', 'class' => 'date-picker', 'custom_attributes' => array('pattern' => "[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])")));
        do_action('woocommerce_coupon_options');
        ?>
</div>
			<div id="usage_restriction_coupon_data" class="panel woocommerce_options_panel"><?php 
        echo '<div class="options_group">';
        // minimum spend
        woocommerce_wp_text_input(array('id' => 'minimum_amount', 'label' => __('Minimum spend', 'woocommerce'), 'placeholder' => __('No minimum', 'woocommerce'), 'description' => __('This field allows you to set the minimum spend (subtotal, including taxes) allowed to use the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // maximum spend
        woocommerce_wp_text_input(array('id' => 'maximum_amount', 'label' => __('Maximum spend', 'woocommerce'), 'placeholder' => __('No maximum', 'woocommerce'), 'description' => __('This field allows you to set the maximum spend (subtotal, including taxes) allowed when using the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // Individual use
        woocommerce_wp_checkbox(array('id' => 'individual_use', 'label' => __('Individual use only', 'woocommerce'), 'description' => __('Check this box if the coupon cannot be used in conjunction with other coupons.', 'woocommerce')));
        // Exclude Sale Products
        woocommerce_wp_checkbox(array('id' => 'exclude_sale_items', 'label' => __('Exclude sale items', 'woocommerce'), 'description' => __('Check this box if the coupon should not apply to items on sale. Per-item coupons will only work if the item is not on sale. Per-cart coupons will only work if there are no sale items in the cart.', 'woocommerce')));
        echo '</div><div class="options_group">';
        // Product ids
        ?>
				<p class="form-field"><label><?php 
        _e('Products', 'woocommerce');
        ?>
</label>
				<input type="hidden" class="wc-product-search" data-multiple="true" style="width: 50%;" name="product_ids" data-placeholder="<?php 
        esc_attr_e('Search for a product&hellip;', 'woocommerce');
        ?>
" data-action="woocommerce_json_search_products_and_variations" data-selected="<?php 
        $product_ids = $coupon->get_product_ids();
        $json_ids = array();
        foreach ($product_ids as $product_id) {
            $product = wc_get_product($product_id);
            if (is_object($product)) {
                $json_ids[$product_id] = wp_kses_post($product->get_formatted_name());
            }
        }
        echo esc_attr(json_encode($json_ids));
        ?>
" value="<?php 
        echo implode(',', array_keys($json_ids));
        ?>
" /> <?php 
        echo wc_help_tip(__('Products which need to be in the cart to use this coupon or, for "Product Discounts", which products are discounted.', 'woocommerce'));
        ?>
</p>
				<?php 
        // Exclude Product ids
        ?>
				<p class="form-field"><label><?php 
        _e('Exclude products', 'woocommerce');
        ?>
//.........这里部分代码省略.........
开发者ID:johnulist,项目名称:woocommerce,代码行数:101,代码来源:class-wc-meta-box-coupon-data.php


示例5: init_form_fields

 /**
  * init_form_fields function.
  *
  * @access public
  * @return void
  */
 function init_form_fields()
 {
     $this->form_fields = array('enabled' => array('title' => __('Enable', 'woocommerce'), 'type' => 'checkbox', 'label' => __('Enable local delivery', 'woocommerce'), 'default' => 'no'), 'title' => array('title' => __('Title', 'woocommerce'), 'type' => 'text', 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce'), 'default' => __('Local Delivery', 'woocommerce'), 'desc_tip' => true), 'type' => array('title' => __('Fee Type', 'woocommerce'), 'type' => 'select', 'description' => __('How to calculate delivery charges', 'woocommerce'), 'default' => 'fixed', 'options' => array('fixed' => __('Fixed amount', 'woocommerce'), 'percent' => __('Percentage of cart total', 'woocommerce'), 'product' => __('Fixed amount per product', 'woocommerce')), 'desc_tip' => true), 'fee' => array('title' => __('Delivery Fee', 'woocommerce'), 'type' => 'price', 'description' => __('What fee do you want to charge for local delivery, disregarded if you choose free. Leave blank to disable.', 'woocommerce'), 'default' => '', 'desc_tip' => true, 'placeholder' => wc_format_localized_price(0)), 'codes' => array('title' => __('Zip/Post Codes', 'woocommerce'), 'type' => 'textarea', 'description' => __('What zip/post codes would you like to offer delivery to? Separate codes with a comma. Accepts wildcards, e.g. P* will match a postcode of PE30.', 'woocommerce'), 'default' => '', 'desc_tip' => true, 'placeholder' => '12345, 56789 etc'), 'availability' => array('title' => __('Method availability', 'woocommerce'), 'type' => 'select', 'default' => 'all', 'class' => 'availability', 'options' => array('all' => __('All allowed countries', 'woocommerce'), 'specific' => __('Specific Countries', 'woocommerce'))), 'countries' => array('title' => __('Specific Countries', 'woocommerce'), 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'default' => '', 'options' => WC()->countries->get_shipping_countries(), 'custom_attributes' => array('data-placeholder' => __('Select some countries', 'woocommerce'))));
 }
开发者ID:Joaquinsemp,项目名称:patriestausado,代码行数:10,代码来源:class-wc-shipping-local-delivery.php


示例6: array

<?php

if (!defined('ABSPATH')) {
    exit;
}
//Campos del formulario
$campos = array('activo' => array('title' => __('Enable/Disable', 'apg_free_shipping'), 'type' => 'checkbox', 'label' => __('Enable this shipping method', 'apg_free_shipping'), 'default' => 'yes'), 'title' => array('title' => __('Method Title', 'apg_free_shipping'), 'type' => 'text', 'description' => __('This controls the title which the user sees during checkout.', 'apg_free_shipping'), 'default' => $this->method_title, 'desc_tip' => true), 'requires' => array('title' => __('Free Shipping Requires...', 'apg_free_shipping'), 'type' => 'select', 'class' => 'wc-enhanced-select', 'options' => array('' => __('N/A', 'apg_free_shipping'), 'cupon' => __('A valid free shipping coupon', 'apg_free_shipping'), 'importe_minimo' => __('A minimum order amount (defined below)', 'apg_free_shipping'), 'cualquiera' => __('A minimum order amount OR a coupon', 'apg_free_shipping'), 'ambos' => __('A minimum order amount AND a coupon', 'apg_free_shipping'))), 'importe_minimo' => array('title' => __('Minimum Order Amount', 'apg_free_shipping'), 'type' => 'price', 'description' => __('Users will need to spend this amount to get free shipping (if enabled above).', 'apg_free_shipping'), 'default' => '0', 'desc_tip' => true, 'placeholder' => wc_format_localized_price(0)));
if (WC()->shipping->get_shipping_classes()) {
    $campos['clases_excluidas'] = array('title' => __('No shipping (Shipping class)', 'apg_free_shipping'), 'desc_tip' => sprintf(__("Select the shipping class where %s doesn't accept free shippings.", 'apg_free_shipping'), get_bloginfo('name')), 'css' => 'width: 450px;', 'default' => '', 'type' => 'multiselect', 'class' => 'wc-enhanced-select', 'options' => array('todas' => __('All enabled shipping class', 'apg_free_shipping')) + $this->clases_de_envio);
}
$campos['muestra'] = array('title' => __('Show only APG Free Shipping', 'apg_free_shipping'), 'type' => 'checkbox', 'label' => __("Don't show others shipping cost.", 'apg_free_shipping'), 'default' => 'no');
return $campos;
开发者ID:artprojectgroup,项目名称:woocommerce-apg-free-postcodestatecountry-shipping,代码行数:12,代码来源:campos.php


示例7: init_form_fields

 /**
  * Initialise Gateway Settings Form Fields.
  */
 public function init_form_fields()
 {
     $this->form_fields = array('enabled' => array('title' => __('Enable/Disable', 'woocommerce'), 'type' => 'checkbox', 'label' => __('Once disabled, this legacy method will no longer be available.', 'woocommerce'), 'default' => 'no'), 'title' => array('title' => __('Method Title', 'woocommerce'), 'type' => 'text', 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce'), 'default' => __('Free Shipping', 'woocommerce'), 'desc_tip' => true), 'availability' => array('title' => __('Method availability', 'woocommerce'), 'type' => 'select', 'default' => 'all', 'class' => 'availability wc-enhanced-select', 'options' => array('all' => __('All allowed countries', 'woocommerce'), 'specific' => __('Specific Countries', 'woocommerce'))), 'countries' => array('title' => __('Specific Countries', 'woocommerce'), 'type' => 'multiselect', 'class' => 'wc-enhanced-select', 'css' => 'width: 450px;', 'default' => '', 'options' => WC()->countries->get_shipping_countries(), 'custom_attributes' => array('data-placeholder' => __('Select some countries', 'woocommerce'))), 'requires' => array('title' => __('Free Shipping Requires...', 'woocommerce'), 'type' => 'select', 'class' => 'wc-enhanced-select', 'default' => '', 'options' => array('' => __('N/A', 'woocommerce'), 'coupon' => __('A valid free shipping coupon', 'woocommerce'), 'min_amount' => __('A minimum order amount (defined below)', 'woocommerce'), 'either' => __('A minimum order amount OR a coupon', 'woocommerce'), 'both' => __('A minimum order amount AND a coupon', 'woocommerce'))), 'min_amount' => array('title' => __('Minimum Order Amount', 'woocommerce'), 'type' => 'price', 'placeholder' => wc_format_localized_price(0), 'description' => __('Users will need to spend this amount to get free shipping (if enabled above).', 'woocommerce'), 'default' => '0', 'desc_tip' => true));
 }
开发者ID:unfulvio,项目名称:woocommerce,代码行数:7,代码来源:class-wc-shipping-legacy-free-shipping.php


示例8: load_variations

 /**
  * Load variations via AJAX
  */
 public static function load_variations()
 {
     ob_start();
     check_ajax_referer('load-variations', 'security');
     // Check permissions again and make sure we have what we need
     if (!current_user_can('edit_products') || empty($_POST['product_id']) || empty($_POST['attributes'])) {
         die(-1);
     }
     global $post;
     $product_id = absint($_POST['product_id']);
     $post = get_post($product_id);
     // Set $post global so its available like within the admin screens
     $per_page = !empty($_POST['per_page']) ? absint($_POST['per_page']) : 10;
     $page = !empty($_POST['page']) ? absint($_POST['page']) : 1;
     // Get attributes
     $attributes = array();
     foreach ($_POST['attributes'] as $key => $value) {
         $attributes[wc_clean($key)] = array_map('wc_clean', $value);
     }
     // Get tax classes
     $tax_classes = WC_Tax::get_tax_classes();
     $tax_class_options = array();
     $tax_class_options[''] = __('Standard', 'woocommerce');
     if (!empty($tax_classes)) {
         foreach ($tax_classes as $class) {
             $tax_class_options[sanitize_title($class)] = esc_attr($class);
         }
     }
     // Set backorder options
     $backorder_options = array('no' => __('Do not allow', 'woocommerce'), 'notify' => __('Allow, but notify customer', 'woocommerce'), 'yes' => __('Allow', 'woocommerce'));
     // set stock status options
     $stock_status_options = array('instock' => __('In stock', 'woocommerce'), 'outofstock' => __('Out of stock', 'woocommerce'));
     $parent_data = array('id' => $product_id, 'attributes' => $attributes, 'tax_class_options' => $tax_class_options, 'sku' => get_post_meta($product_id, '_sku', true), 'weight' => wc_format_localized_decimal(get_post_meta($product_id, '_weight', true)), 'length' => wc_format_localized_decimal(get_post_meta($product_id, '_length', true)), 'width' => wc_format_localized_decimal(get_post_meta($product_id, '_width', true)), 'height' => wc_format_localized_decimal(get_post_meta($product_id, '_height', true)), 'tax_class' => get_post_meta($product_id, '_tax_class', true), 'backorder_options' => $backorder_options, 'stock_status_options' => $stock_status_options);
     if (!$parent_data['weight']) {
         $parent_data['weight'] = wc_format_localized_decimal(0);
     }
     if (!$parent_data['length']) {
         $parent_data['length'] = wc_format_localized_decimal(0);
     }
     if (!$parent_data['width']) {
         $parent_data['width'] = wc_format_localized_decimal(0);
     }
     if (!$parent_data['height']) {
         $parent_data['height'] = wc_format_localized_decimal(0);
     }
     // Get variations
     $args = array('post_type' => 'product_variation', 'post_status' => array('private', 'publish'), 'posts_per_page' => $per_page, 'paged' => $page, 'orderby' => 'ID', 'order' => 'DESC', 'post_parent' => $product_id);
     $variations = get_posts($args);
     $loop = 0;
     if ($variations) {
         foreach ($variations as $variation) {
             $variation_id = absint($variation->ID);
             $variation_meta = get_post_meta($variation_id);
             $variation_data = array();
             $shipping_classes = get_the_terms($variation_id, 'product_shipping_class');
             $variation_fields = array('_sku' => '', '_stock' => '', '_regular_price' => '', '_sale_price' => '', '_weight' => '', '_length' => '', '_width' => '', '_height' => '', '_download_limit' => '', '_download_expiry' => '', '_downloadable_files' => '', '_downloadable' => '', '_virtual' => '', '_thumbnail_id' => '', '_sale_price_dates_from' => '', '_sale_price_dates_to' => '', '_manage_stock' => '', '_stock_status' => '', '_backorders' => null, '_tax_class' => null, '_variation_description' => '');
             foreach ($variation_fields as $field => $value) {
                 $variation_data[$field] = isset($variation_meta[$field][0]) ? maybe_unserialize($variation_meta[$field][0]) : $value;
             }
             // Add the variation attributes
             foreach ($variation_meta as $key => $value) {
                 if (0 !== strpos($key, 'attribute_')) {
                     continue;
                 }
                 /**
                  * Pre 2.4 handling where 'slugs' were saved instead of the full text attribute.
                  * Attempt to get full version of the text attribute from the parent.
                  */
                 if (sanitize_title($value[0]) === $value[0] && version_compare(get_post_meta($product_id, '_product_version', true), '2.4.0', '<')) {
                     foreach ($attributes as $attribute) {
                         if ($key !== 'attribute_' . sanitize_title($attribute['name'])) {
                             continue;
                         }
                         $text_attributes = wc_get_text_attributes($attribute['value']);
                         foreach ($text_attributes as $text_attribute) {
                             if (sanitize_title($text_attribute) === $value[0]) {
                                 $value[0] = $text_attribute;
                             }
                         }
                     }
                 }
                 $variation_data[$key] = $value[0];
             }
             // Formatting
             $variation_data['_regular_price'] = wc_format_localized_price($variation_data['_regular_price']);
             $variation_data['_sale_price'] = wc_format_localized_price($variation_data['_sale_price']);
             $variation_data['_weight'] = wc_format_localized_decimal($variation_data['_weight']);
             $variation_data['_length'] = wc_format_localized_decimal($variation_data['_length']);
             $variation_data['_width'] = wc_format_localized_decimal($variation_data['_width']);
             $variation_data['_height'] = wc_format_localized_decimal($variation_data['_height']);
             $variation_data['_thumbnail_id'] = absint($variation_data['_thumbnail_id']);
             $variation_data['image'] = $variation_data['_thumbnail_id'] ? wp_get_attachment_thumb_url($variation_data['_thumbnail_id']) : '';
             $variation_data['shipping_class'] = $shipping_classes && !is_wp_error($shipping_classes) ? current($shipping_classes)->term_id : '';
             // Stock BW compat
             if ('' !== $variation_data['_stock']) {
                 $variation_data['_manage_stock'] = 'yes';
             }
//.........这里部分代码省略.........
开发者ID:JodiWarren,项目名称:woocommerce,代码行数:101,代码来源:class-wc-ajax.php


示例9: init_form_fields

 /**
  * Init form fields.
  */
 public function init_form_fields()
 {
     $this->form_fields = array('enabled' => array('title' => __('Enable', 'woocommerce'), 'type' => 'checkbox', 'label' => __('Once disabled, this legacy method will no longer be available.', 'woocommerce'), 'default' => 'no'), 'title' => array('title' => __('Title', 'woocommerce'), 'type' => 'text', 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce'), 'default' => __('Local delivery', 'woocommerce'), 'desc_tip' => true), 'type' => array('title' => __('Fee type', 'woocommerce'), 'type' => 'select', 'class' => 'wc-enhanced-select', 'description' => __('How to calculate delivery charges', 'woocommerce'), 'default' => 'fixed', 'options' => array('fixed' => __('Fixed amount', 'woocommerce'), 'percent' => __('Percentage of cart total', 'woocommerce'), 'product' => __('Fixed amount per product', 'woocommerce')), 'desc_tip' => true), 'fee' => array('title' => __('Delivery fee', 'woocommerce'), 'type' => 'price', 'description' => __('What fee do you want to charge for local delivery, disregarded if you choose free. Leave blank to disable.', 'woocommerce'), 'default' => '', 'desc_tip' => true, 'placeholder' => wc_format_localized_price(0)), 'codes' => array('title' => __('Allowed ZIP/post codes', 'woocommerce'), 'type' => 'text', 'desc_tip' => __('What ZIP/post codes are available for local delivery?', 'woocommerce'), 'default' => '', 'description' => __('Separate codes with a comma. Accepts wildcards, e.g. <code>P*</code> will match a postcode of PE30. Also accepts a pattern, e.g. <code>NG1___</code> would match NG1 1AA but not NG10 1AA', 'woocommerce'), 'placeholder' => 'e.g. 12345, 56789'), 'availability' => array('title' => __('Method availability', 'woocommerce'), 'type' => 'select', 'default' => 'all', 'class' => 'availability wc-enhanced-select', 'options' => array('all' => __('All allowed countries', 'woocommerce'), 'specific' => __('Specific Countries', 'woocommerce'))), 'countries' => array('title' => __('Specific countries', 'woocommerce'), 'type' => 'multiselect', 'class' => 'wc-enhanced-select', 'css' => 'width: 450px;', 'default' => '', 'options' => WC()->countries->get_shipping_countries(), 'custom_attributes' => array('data-placeholder' => __('Select some countries', 'woocommerce'))));
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:7,代码来源:class-wc-shipping-legacy-local-delivery.php


示例10: output

    /**
     * Output the metabox
     */
    public static function output($post)
    {
        wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
        ?>
		<style type="text/css">
			#edit-slug-box, #minor-publishing-actions { display:none }
		</style>
		<div id="coupon_options" class="panel-wrap coupon_data">

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

			<ul class="coupon_data_tabs wc-tabs" style="display:none;">
				<?php 
        $coupon_data_tabs = apply_filters('woocommerce_coupon_data_tabs', array('general' => array('label' => __('General', 'woocommerce'), 'target' => 'general_coupon_data', 'class' => 'general_coupon_data'), 'usage_restriction' => array('label' => __('Usage Restriction', 'woocommerce'), 'target' => 'usage_restriction_coupon_data', 'class' => ''), 'usage_limit' => array('label' => __('Usage Limits', 'woocommerce'), 'target' => 'usage_limit_coupon_data', 'class' => '')));
        foreach ($coupon_data_tabs as $key => $tab) {
            ?>
<li class="<?php 
            echo $key;
            ?>
_options <?php 
            echo $key;
            ?>
_tab <?php 
            echo implode(' ', (array) $tab['class']);
            ?>
">
							<a href="#<?php 
            echo $tab['target'];
            ?>
"><?php 
            echo esc_html($tab['label']);
            ?>
</a>
						</li><?php 
        }
        ?>
			</ul>
			<div id="general_coupon_data" class="panel woocommerce_options_panel"><?php 
        // Type
        woocommerce_wp_select(array('id' => 'discount_type', 'label' => __('Discount type', 'woocommerce'), 'options' => wc_get_coupon_types()));
        // Amount
        woocommerce_wp_text_input(array('id' => 'coupon_amount', 'label' => __('Coupon amount', 'woocommerce'), 'placeholder' => wc_format_localized_price(0), 'description' => __('Value of the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // Free Shipping
        woocommerce_wp_checkbox(array('id' => 'free_shipping', 'label' => __('Allow free shipping', 'woocommerce'), 'description' => sprintf(__('Check this box if the coupon grants free shipping. The <a href="%s">free shipping method</a> must be enabled with the "must use coupon" setting.', 'woocommerce'), admin_url('admin.php?page=wc-settings&tab=shipping&section=WC_Shipping_Free_Shipping'))));
        // Apply before tax
        woocommerce_wp_checkbox(array('id' => 'apply_before_tax', 'label' => __('Apply before tax', 'woocommerce'), 'description' => __('Check this box if the coupon should be applied before calculating cart tax.', 'woocommerce')));
        // Expiry date
        woocommerce_wp_text_input(array('id' => 'expiry_date', 'label' => __('Coupon expiry date', 'woocommerce'), 'placeholder' => _x('YYYY-MM-DD', 'placeholder', 'woocommerce'), 'description' => '', 'class' => 'date-picker', 'custom_attributes' => array('pattern' => "[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])")));
        do_action('woocommerce_coupon_options');
        ?>
</div>
			<div id="usage_restriction_coupon_data" class="panel woocommerce_options_panel"><?php 
        echo '<div class="options_group">';
        // minimum spend
        woocommerce_wp_text_input(array('id' => 'minimum_amount', 'label' => __('Minimum spend', 'woocommerce'), 'placeholder' => __('No minimum', 'woocommerce'), 'description' => __('This field allows you to set the minimum subtotal needed to use the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // maximum spend
        woocommerce_wp_text_input(array('id' => 'maximum_amount', 'label' => __('Maximum spend', 'woocommerce'), 'placeholder' => __('No maximum', 'woocommerce'), 'description' => __('This field allows you to set the maximum subtotal allowed when using the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // Individual use
        woocommerce_wp_checkbox(array('id' => 'individual_use', 'label' => __('Individual use only', 'woocommerce'), 'description' => __('Check this box if the coupon cannot be used in conjunction with other coupons.', 'woocommerce')));
        // Exclude Sale Products
        woocommerce_wp_checkbox(array('id' => 'exclude_sale_items', 'label' => __('Exclude sale items', 'woocommerce'), 'description' => __('Check this box if the coupon should not apply to items on sale. Per-item coupons will only work if the item is not on sale. Per-cart coupons will only work if there are no sale items in the cart.', 'woocommerce')));
        echo '</div><div class="options_group">';
        // Product ids
        ?>
				<p class="form-field"><label for="product_ids"><?php 
        _e('Products', 'woocommerce');
        ?>
</label>
				<select id="product_ids" name="product_ids[]" class="ajax_chosen_select_products_and_variations" multiple="multiple" data-placeholder="<?php 
        _e('Search for a product&hellip;', 'woocommerce');
        ?>
">
					<?php 
        $product_ids = get_post_meta($post->ID, 'product_ids', true);
        if ($product_ids) {
            $product_ids = array_map('absint', explode(',', $product_ids));
            foreach ($product_ids as $product_id) {
                $product = wc_get_product($product_id);
                echo '<option value="' . esc_attr($product_id) . '" selected="selected">' . wp_kses_post($product->get_formatted_name()) . '</option>';
            }
        }
        ?>
				</select> <img class="help_tip" data-tip='<?php 
        _e('Products which need to be in the cart to use this coupon or, for "Product Discounts", which products are discounted.', 'woocommerce');
        ?>
' src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/help.png" height="16" width="16" /></p>
				<?php 
        // Exclude Product ids
        ?>
				<p class="form-field"><label for="exclude_product_ids"><?php 
        _e('Exclude products', 'woocommerce');
        ?>
</label>
				<select id="exclude_product_ids" name="exclude_product_ids[]" class="ajax_chosen_select_products_and_variations" multiple="multiple" data-placeholder="<?php 
//.........这里部分代码省略.........
开发者ID:anagio,项目名称:woocommerce,代码行数:101,代码来源:class-wc-meta-box-coupon-data.php


示例11: init_form_fields

 /**
  * Initialise Gateway Settings Form Fields
  *
  * @access public
  * @return void
  */
 function init_form_fields()
 {
     $this->form_fields = array('enabled' => array('title' => __('Enable/Disable', 'woocommerce'), 'type' => 'checkbox', 'label' => __('Enable this shipping method', 'woocommerce'), 'default' => 'no'), 'title' => array('title' => __('Method Title', 'woocommerce'), 'type' => 'text', 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce'), 'default' => __('International Delivery', 'woocommerce'), 'desc_tip' => true), 'availability' => array('title' => __('Availability', 'woocommerce'), 'type' => 'select', 'description' => '', 'default' => 'including', 'options' => array('including' => __('Selected countries', 'woocommerce'), 'excluding' => __('Excluding selected countries', 'woocommerce'))), 'countries' => array('title' => __('Countries', 'woocommerce'), 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'default' => '', 'options' => WC()->countries->get_shipping_countries(), 'custom_attributes' => array('data-placeholder' => __('Select some countries', 'woocommerce'))), 'tax_status' => array('title' => __('Tax Status', 'woocommerce'), 'type' => 'select', 'default' => 'taxable', 'options' => array('taxable' => __('Taxable', 'woocommerce'), 'none' => __('None', 'woocommerce'))), 'type' => array('title' => __('Cost Added...', 'woocommerce'), 'type' => 'select', 'default' => 'order', 'options' => array('order' => __('Per Order - charge shipping for the entire order as a whole', 'woocommerce'), 'item' => __('Per Item - charge shipping for each item individually', 'woocommerce'), 'class' => __('Per Class - charge shipping for each shipping class in an order', 'woocommerce'))), 'cost' => array('title' => __('Cost', 'woocommerce'), 'type' => 'price', 'placeholder' => wc_format_localized_price(0), 'description' => __('Cost excluding tax. Enter an amount, e.g. 2.50. Default is 0', 'woocommerce'), 'default' => '', 'desc_tip' => true), 'fee' => array('title' => __('Handling Fee', 'woocommerce'), 'type' => 'text', 'description' => __('Fee excluding tax. Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to disable.', 'woocommerce'), 'default' => '', 'desc_tip' => true, 'placeholder' => wc_format_localized_price(0)), 'minimum_fee' => array('title' => __('Minimum Handling Fee', 'woocommerce'), 'type' => 'decimal', 'description' => __('Enter a minimum fee amount. Fee\'s less than this will be increased. Leave blank to disable.', 'woocommerce'), 'default' => '', 'desc_tip' => true, 'placeholder' => wc_format_localized_decimal('0')));
 }
开发者ID:hoonio,项目名称:PhoneAfrika,代码行数:10,代码来源:class-wc-shipping-international-delivery.php


示例12: output_pre

    /**
     * Variable Products meta for WC pre 2.3
     */
    public static function output_pre($loop, $variation_data)
    {
        $variation_id = isset($variation_data['variation_post_id']) ? $variation_data['variation_post_id'] : -1;
        $delivery_times = get_the_terms($variation_id, 'product_delivery_time');
        $delivery_time = $delivery_times && !is_wp_error($delivery_times) ? current($delivery_times)->term_id : '';
        ?>
		<tr>
			<td>
				<label><?php 
        _e('Unit', 'woocommerce-germanized');
        ?>
:</label>
				<select name="variable_unit[<?php 
        echo $loop;
        ?>
]">
					<option value="parent" <?php 
        selected(is_null(isset($variation_data['_unit'][0]) ? $variation_data['_unit'][0] : null), true);
        ?>
><?php 
        _e('None', 'woocommerce-germanized');
        ?>
</option>
					<?php 
        foreach (WC_germanized()->units->get_units() as $key => $value) {
            echo '<option value="' . esc_attr($key) . '" ' . selected($key === (isset($variation_data['_unit'][0]) ? $variation_data['_unit'][0] : ''), true, false) . '>' . esc_html($value) . '</option>';
        }
        ?>
</select>
			</td>
			<td>
				<label for="variable_unit_base"><?php 
        echo __('Unit Base', 'woocommerce-germanized');
        ?>
:</label>
				<input class="input-text wc_input_decimal" size="6" type="text" name="variable_unit_base[<?php 
        echo $loop;
        ?>
]" value="<?php 
        echo isset($variation_data['_unit_base'][0]) ? esc_attr(wc_format_localized_decimal($variation_data['_unit_base'][0])) : '';
        ?>
" placeholder="" />
			</td>
		</tr>
		<tr>
			<td>
				<label for="variable_unit_price_regular"><?php 
        echo __('Regular Unit Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')';
        ?>
:</label>
				<input class="input-text wc_input_price" size="5" type="text" name="variable_unit_price_regular[<?php 
        echo $loop;
        ?>
]" value="<?php 
        echo isset($variation_data['_unit_price_regular'][0]) ? esc_attr(wc_format_localized_price($variation_data['_unit_price_regular'][0])) : '';
        ?>
" placeholder="" />
			</td>
			<td>
				<label for="variable_unit_price_sale"><?php 
        echo __('Sale Unit Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')';
        ?>
:</label>
				<input class="input-text wc_input_price" size="5" type="text" name="variable_unit_price_sale[<?php 
        echo $loop;
        ?>
]" value="<?php 
        echo isset($variation_data['_unit_price_sale'][0]) ? esc_attr(wc_format_localized_price($variation_data['_unit_price_sale'][0])) : '';
        ?>
" placeholder="" />
			</td>
		</tr>
		<tr>
			<td class="hide_if_variation_virtual">
				<label><?php 
        _e('Delivery Time', 'woocommerce-germanized');
        ?>
:</label> 
				<?php 
        $args = array('taxonomy' => 'product_delivery_time', 'hide_empty' => 0, 'show_option_none' => __('None', 'woocommerce-germanized'), 'name' => 'variable_delivery_time[' . $loop . ']', 'id' => '', 'selected' => isset($delivery_time) ? esc_attr($delivery_time) : '', 'echo' => 0);
        echo wp_dropdown_categories($args);
        ?>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="variable_cart_mini_desc_pre">
				<label for="variable_product_mini_desc"><?php 
        echo __('Optional Mini Description', 'woocommerce-germanized');
        ?>
:</label>
				<?php 
        wp_editor(htmlspecialchars_decode(isset($variation_data['_mini_desc'][0]) ? $variation_data['_mini_desc'][0] : ''), 'wc_gzd_product_mini_desc_' . $loop, array('textarea_name' => 'variable_product_mini_desc[' . $loop . ']', 'textarea_rows' => 5, 'media_buttons' => false, 'teeny' => true));
        ?>
			</td>
		</tr>
		<?php 
    }
开发者ID:shwetadubey,项目名称:upfit,代码行数:100,代码来源:class-wc-gzd-meta-box-product-data-variable.php


示例13: recurring_order_totals_meta_box_section


//.........这里部分代码省略.........

	<?php 
            if (WC_Subscriptions::is_woocommerce_pre('2.1')) {
                ?>
	<div class="totals_group">
		<h4><span class="tax_total_display inline_total"></span><?php 
                _e('Tax Totals', 'woocommerce-subscriptions');
                ?>
</h4>
		<ul class="totals">

			<li class="left">
				<label><?php 
                _e('Recurring Sales Tax:', 'woocommerce-subscriptions');
                ?>
</label>
				<input type="number" step="any" min="0" id="_order_recurring_tax_total" name="_order_recurring_tax_total" placeholder="0.00" value="&l 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wc_format_phone_number函数代码示例发布时间:2022-05-23
下一篇:
PHP wc_format_localized_decimal函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap