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

PHP wc_format_localized_decimal函数代码示例

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

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



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

示例1: 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


示例2: 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


示例3: get_dimensions

 /**
  * Returns formatted dimensions.
  * @return string
  */
 public function get_dimensions()
 {
     $dimensions = implode(' x ', array_filter(array(wc_format_localized_decimal($this->get_length()), wc_format_localized_decimal($this->get_width()), wc_format_localized_decimal($this->get_height()))));
     if (!empty($dimensions)) {
         $dimensions .= ' ' . get_option('woocommerce_dimension_unit');
     }
     return apply_filters('woocommerce_product_dimensions', $dimensions, $this);
 }
开发者ID:nishitlangaliya,项目名称:woocommerce,代码行数:12,代码来源:abstract-wc-product.php


示例4: test_wc_format_localized_decimal

 /**
  * Test wc_format_localized_decimal().
  *
  * @since 2.2
  */
 public function test_wc_format_localized_decimal()
 {
     $this->assertEquals('1.17', wc_format_localized_decimal('1.17'));
 }
开发者ID:jimlove7273,项目名称:woocommerce,代码行数:9,代码来源:functions.php


示例5: decimalInput

 private function decimalInput(array $attrs = array())
 {
     if (isset($attrs['value']) && (string) $attrs['value'] !== '') {
         $attrs['value'] = wc_format_localized_decimal($attrs['value']);
     }
     $attrs['class'] = (array) @$attrs['class'];
     $attrs['class'][] = 'wc_input_decimal input-text';
     return $this->input($attrs);
 }
开发者ID:kanhaiyasharma,项目名称:Bestswiss,代码行数:9,代码来源:WbsSettingsHtmlTools.php


示例6: 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


示例7: _e

		<?php 
if (wc_product_weight_enabled() || wc_product_dimensions_enabled()) {
    ?>
		<div class="dimension_fields">

			<?php 
    if (wc_product_weight_enabled()) {
        ?>
				<label>
					<span class="title"><?php 
        _e('Weight', 'woocommerce');
        ?>
</span>
					<span class="input-text-wrap">
						<input type="text" name="_weight" class="text weight" placeholder="<?php 
        echo wc_format_localized_decimal(0);
        ?>
" value="">
					</span>
				</label>
				<br class="clear" />
			<?php 
    }
    ?>

			<?php 
    if (wc_product_dimensions_enabled()) {
        ?>
				<div class="inline-edit-group dimensions">
					<div>
						<span class="title"><?php 
开发者ID:abesamislyndon,项目名称:femaccms,代码行数:31,代码来源:html-quick-edit-product.php


示例8: listProfiles

    private static function listProfiles(array $profiles)
    {
        $current_profile_id = WBS_Profile_Manager::instance()->current_profile_id();
        ?>
            <table id="woowbs_shipping_methods" class="wc_shipping widefat">
                <thead>
                <tr>
                    <th class="name">   <?php 
        esc_html_e('Name', 'woowbs');
        ?>
                  </th>
                    <th>                <?php 
        esc_html_e('Destination', 'woowbs');
        ?>
           </th>
                    <th>                <?php 
        esc_html_e('Weight', 'woowbs');
        ?>
                </th>
                    <th>                <?php 
        esc_html_e('Subtotal', 'woowbs');
        ?>
              </th>
                    <th>                <?php 
        esc_html_e('Cost', 'woowbs');
        ?>
                  </th>
                    <th class="status"> <?php 
        esc_html_e('Active', 'woowbs');
        ?>
                </th>
                    <th>                <?php 
        esc_html_e('Actions');
        ?>
                         </th>
                </tr>
                </thead>
                <tbody>
                <?php 
        /** @var WC_Weight_Based_Shipping[] $profiles */
        ?>
                <?php 
        foreach ($profiles as $profile) {
            ?>
                    <tr
                        <?php 
            echo $profile->profile_id === $current_profile_id ? 'class="wbs-current"' : null;
            ?>
                        data-settings-url="<?php 
            echo esc_html(WbsRuleUrls::edit($profile));
            ?>
"
                        >
                        <td class="name"><?php 
            echo esc_html($profile->name);
            ?>
</td>

                        <td class="countries">
                            <?php 
            if ($profile->availability === 'all') {
                ?>
                                <?php 
                esc_html_e('Any', 'woowbs');
                ?>
                            <?php 
            } else {
                ?>
                                <?php 
                if ($profile->availability === 'excluding') {
                    ?>
                                    <?php 
                    esc_html_e('All except', 'woowbs');
                    ?>
                                <?php 
                }
                ?>
                                <?php 
                echo esc_html(join(', ', $profile->countries));
                ?>
                            <?php 
            }
            ?>
                        </td>

                        <?php 
            foreach (array($profile->weight, $profile->subtotal) as $range) {
                ?>
                            <td>
                                <?php 
                echo isset($range->min) || isset($range->max) ? ($range->minInclusive || !isset($range->min) ? '[' : '(') . esc_html(wc_format_localized_decimal((double) $range->min)) . '&nbsp;–&nbsp;' . (isset($range->max) ? esc_html(wc_format_localized_decimal($range->max)) : '<span style="font-family:monospace">&infin;</span>') . ($range->maxInclusive ? ']' : ')') : 'Any';
                ?>
                            </td>
                        <?php 
            }
            ?>

                        <td>
                            <?php 
            echo esc_html($profile->makeCostString());
//.........这里部分代码省略.........
开发者ID:kanhaiyasharma,项目名称:Bestswiss,代码行数:101,代码来源:WC_Weight_Based_Shipping.php


示例9: 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


示例10: esc_attr

" class="input-text wc_input_decimal" size="6" type="text" name="_length" value="<?php 
    echo esc_attr(wc_format_localized_decimal($product_object->get_length('edit')));
    ?>
" />
						<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($product_object->get_width('edit')));
    ?>
" />
						<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($product_object->get_height('edit')));
    ?>
" />
					</span>
					<?php 
    echo wc_help_tip(__('LxWxH in decimal form', 'woocommerce'));
    ?>
				</p><?php 
}
do_action('woocommerce_product_options_dimensions');
?>
	</div>

	<div class="options_group">
		<?php 
$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' => $product_object->get_shipping_class_id('edit'), 'class' => 'select short');
开发者ID:woocommerce,项目名称:woocommerce,代码行数:31,代码来源:html-product-data-shipping.php


示例11: get_products_list

 /**
  * Return the array with all products and all attributes values
  *
  * @return array The complete list of products with all attributes value
  */
 public function get_products_list($products = array())
 {
     $list = array();
     $products = empty($products) ? $this->products_list : $products;
     $products = apply_filters('yith_woocompare_exclude_products_from_list', $products);
     $fields = $this->fields();
     foreach ($products as $product_id) {
         $product = $this->wc_get_product($product_id);
         if (!$product) {
             continue;
         }
         $product->fields = array();
         // custom attributes
         foreach ($fields as $field => $name) {
             switch ($field) {
                 case 'title':
                     $product->fields[$field] = $product->get_title();
                     break;
                 case 'price':
                     $product->fields[$field] = $product->get_price_html();
                     break;
                 case 'image':
                     $product->fields[$field] = intval(get_post_thumbnail_id($product_id));
                     break;
                 case 'description':
                     $product->fields[$field] = apply_filters('woocommerce_short_description', $product->post->post_excerpt);
                     break;
                 case 'stock':
                     $availability = $product->get_availability();
                     if (empty($availability['availability'])) {
                         $availability['availability'] = __('In stock', 'yith-woocommerce-compare');
                     }
                     $product->fields[$field] = sprintf('<span class="%s">%s</span>', esc_attr($availability['class']), esc_html($availability['availability']));
                     break;
                 case 'weight':
                     if ($weight = $product->get_weight()) {
                         $weight = wc_format_localized_decimal($weight) . ' ' . esc_attr(get_option('woocommerce_weight_unit'));
                     } else {
                         $weight = '-';
                     }
                     $product->fields[$field] = sprintf('<span>%s</span>', esc_html($weight));
                     break;
                 case 'dimensions':
                     if (!($dimensions = $product->get_dimensions())) {
                         $dimensions = '-';
                     }
                     $product->fields[$field] = sprintf('<span>%s</span>', esc_html($dimensions));
                     break;
                 default:
                     if (taxonomy_exists($field)) {
                         $product->fields[$field] = array();
                         $terms = get_the_terms($product_id, $field);
                         if (!empty($terms)) {
                             foreach ($terms as $term) {
                                 $term = sanitize_term($term, $field);
                                 $product->fields[$field][] = $term->name;
                             }
                         }
                         $product->fields[$field] = implode(', ', $product->fields[$field]);
                     } else {
                         do_action_ref_array('yith_woocompare_field_' . $field, array($product, &$product->fields));
                     }
                     break;
             }
         }
         $list[] = $product;
     }
     return $list;
 }
开发者ID:websideas,项目名称:Mondova,代码行数:74,代码来源:class.yith-woocompare-frontend.php


示例12: section_settings


//.........这里部分代码省略.........
                <td class="forminp forminp-text">
                	<input name="group_name" id="group_name" type="text" value="<?php 
            echo esc_attr($group['name']);
            ?>
"/> 
                	<?php 
            //echo $description;
            ?>
                </td>
			</tr>

			<!-- Country multiselect -->			
			<tr valign="top">
				<th scope="row" class="titledesc">
					<label for="group_countries"><?php 
            _e('Countries', 'wc-price-based-country');
            ?>
</label>
				</th>
				<td class="forminp">
					<select multiple="multiple" name="group_countries[]" style="width:350px" data-placeholder="<?php 
            _e('Choose countries&hellip;', 'woocommerce');
            ?>
" title="Country" class="chosen_select">
						<?php 
            $countries = WC()->countries->countries;
            asort($countries);
            foreach ($countries as $key => $val) {
                if (!in_array($key, $not_available_countries)) {
                    echo '<option value="' . esc_attr($key) . '" ' . selected(in_array($key, $group['countries']), true, false) . '>' . $val . '</option>';
                }
            }
            ?>
					</select>
					<!-- <a class="select_all button" href="#"><?php 
            _e('Select all', 'woocommerce');
            ?>
</a> <a class="select_none button" href="#"><?php 
            _e('Select none', 'woocommerce');
            ?>
</a> -->
				</td>
			</tr>

			<!-- Currency select -->			
			<tr valign="top">
				<th scope="row" class="titledesc">
					<label for="group_currency"><?php 
            _e('Currency', 'woocommerce');
            ?>
</label>
					<?php 
            //echo $tip;
            ?>
				</th>
				<td class="forminp forminp-select">
					<select name="group_currency" id="group_currency" class="chosen_select">
						<?php 
            foreach (get_woocommerce_currencies() as $code => $name) {
                echo '<option value="' . esc_attr($code) . '" ' . selected($group['currency'], $code) . '>' . $name . ' (' . get_woocommerce_currency_symbol($code) . ')' . '</option>';
            }
            ?>
					</select>
				</td>
			</tr>
			

			<!-- Exchange rate -->			
			<tr valign="top">
				<th scope="row" class="titledesc">
					<label for="exchange_rate"><?php 
            _e('Exchange Rate', 'wc-price-based-country');
            ?>
</label>
					<img class="help_tip" data-tip="<?php 
            echo esc_attr(__("For each product, if select autocalculate, product's price will be the result of multiplying the default price by this exchange rate.", 'wc-price-based-country'));
            ?>
" src="<?php 
            echo WC()->plugin_url();
            ?>
/assets/images/help.png" height="16" width="16" />
				</th>
                <td class="forminp forminp-text">                	
                	1 <?php 
            echo get_option('woocommerce_currency');
            ?>
 = <input name="exchange_rate" id="exchange_rate" type="text" class="short wc_input_decimal" value="<?php 
            echo wc_format_localized_decimal($group['exchange_rate']);
            ?>
"/> 
                	<?php 
            //echo $description;
            ?>
                </td>
			</tr>

		</table>

		<?php 
        }
开发者ID:raminabsari,项目名称:phonicsschool,代码行数:101,代码来源:class-wc-settings-price-based-country.php


示例13: output

    /**
     * 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">
//.........这里部分代码省略.........
开发者ID:vkolova,项目名称:bgscena,代码行数:101,代码来源:class-wc-meta-box-product-data.php


示例14: esc_url

        $variation_data['variation_backorders'][0] = $_backorders;
        $variation_data['variation_taxclass'][0] = $_tax_class;
        $variation_data['variation_shippingclass'][0] = $shipping_class;
        $variation_data['variation_attributes'][0] = $filter_attributes;
        $variation_data['tax_class_options'][0] = $tax_class_options;
        $variation_data['variation_post_status'][0] = $variation_post_status;
        $variation_data['_downloadable_files'][0] = $_downloadable_files;
        $variation_data['placeholder_image'][0] = esc_url(wc_placeholder_img_src());
        $variation_data['post_id'][0] = $post_id;
        // Locale formatting
        $_regular_price = wc_format_localized_price($_regular_price);
        $_sale_price = wc_format_localized_price($_sale_price);
        $_weight = wc_format_localized_decimal($_weight);
        $_length = wc_format_localized_decimal($_length);
        $_width = wc_format_localized_decimal($_width);
        $_height = wc_format_localized_decimal($_height);
        // Stock BW compat
        if ('' !== $_stock) {
            $_manage_stock = 'yes';
        }
        ?>
            <tr data-variation_data='<?php 
        echo json_encode($variation_data);
        ?>
'>
            <?php 
        include 'variation-item.php';
        $loop++;
        ?>
            </tr>
            <?php 
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:31,代码来源:load_variation_template.php


示例15: decimal_field

    public function decimal_field($value)
    {
        $option_value = WC_Admin_Settings::get_option($value['id']);
        if (!empty($option_value)) {
            update_option($value['id'], wc_format_decimal($option_value));
        }
        if (empty($option_value)) {
            $option_value = $value['default'];
        }
        $value['class'] .= 'wc_input_decimal';
        if ($value['desc_tip']) {
            $value['desc_tip'] = $value['desc'];
        }
        ?>
		<tr valign="top">
			<th scope="row" class="titledesc">
				<label for="<?php 
        echo esc_attr($value['id']);
        ?>
"><?php 
        echo esc_html($value['title']);
        ?>
</label>
				<?php 
        if (!empty($value['desc_tip'])) {
            ?>
					<img class="help_tip" data-tip="<?php 
            echo esc_attr(wp_kses_post($value['desc_tip']));
            ?>
" src="<?php 
            echo WC()->plugin_url();
            ?>
/assets/images/help.png" height="16" width="16" />
				<?php 
        }
        ?>
			</th>
			<td class="forminp forminp-attachment wc-gzdp-attachment-wrapper">
				<input 
					id="<?php 
        echo esc_attr($value['id']);
        ?>
" 
					name="<?php 
        echo esc_attr($value['id']);
        ?>
" 
					type="text"
					style="<?php 
        echo esc_attr($value['css']);
        ?>
"
					value="<?php 
        echo wc_format_localized_decimal($option_value);
        ?>
"
					class="<?php 
        echo esc_attr($value['class']);
        ?>
"
				/>
				<div class="clear"></div>
				<?php 
        if ($value['desc'] && empty($value['desc_tip'])) {
            ?>
					<p class="description"><?php 
            echo wp_kses_post($value['desc']);
            ?>
</p>
				<?php 
        }
        ?>
			</td>
		</tr>
		<?php 
    }
开发者ID:radscheit,项目名称:unicorn,代码行数:76,代码来源:class-wc-gzdp-admin.php


示例16: array

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wc_format_localized_price函数代码示例发布时间:2022-05-23
下一篇:
PHP wc_format_list_of_items函数代码示例发布时间: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