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

PHP wc_get_price_decimals函数代码示例

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

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



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

示例1: enqueue_scripts

 /**
  * Register the stylesheets for the public-facing side of the site.
  *
  * @since    1.0.0
  */
 public function enqueue_scripts()
 {
     global $post, $product;
     if (is_object($post) && class_exists('WooCommerce')) {
         $is_product_type_variable = 'false';
         if (function_exists('wc_get_product')) {
             $product = wc_get_product($post);
             if ($product) {
                 if ($product->is_type('variable') && is_single()) {
                     $is_product_type_variable = 'true';
                 }
             }
         }
         $attach_id = isset($_SESSION['attach_id']) && !empty($_SESSION['attach_id']) ? $_SESSION['attach_id'] : '';
         if (!empty($attach_id)) {
             $total_word = get_post_meta($attach_id, 'total_word', true);
         } else {
             $total_word = '';
         }
         if (!empty($attach_id)) {
             $total_character = get_post_meta($attach_id, 'total_character', true);
         } else {
             $total_character = '';
         }
         wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/woocommerce-price-per-word-public.js', array('jquery'), $this->version, false);
         if (wp_script_is($this->plugin_name)) {
             wp_localize_script($this->plugin_name, 'woocommerce_price_per_word_params', apply_filters('woocommerce_price_per_word_params', array('ajax_url' => admin_url('admin-ajax.php'), 'woocommerce_price_per_word_params_nonce' => wp_create_nonce("woocommerce_price_per_word_params_nonce"), 'total_word' => $total_word, 'total_character' => $total_character, 'is_product_type_variable' => $is_product_type_variable, 'woocommerce_currency_symbol_js' => get_woocommerce_currency_symbol(), 'woocommerce_price_num_decimals' => wc_get_price_decimals(), 'aewcppw_word_character' => $this->wppw_get_product_type(), 'aewcppw_allow_users_to_enter_qty' => $this->aewcppw_allow_users_to_enter_qty())));
         }
         wp_enqueue_script($this->plugin_name . '-bn', plugin_dir_url(__FILE__) . 'js/woocommerce-price-per-word-bn.js', array('jquery'), $this->version, false);
     }
 }
开发者ID:angelleye,项目名称:woocommerce-price-per-word,代码行数:36,代码来源:class-woocommerce-price-per-word-public.php


示例2: add_rate

 /**
  * Add a rate
  *
  * Add a shipping rate. If taxes are not set they will be calculated based on cost.
  *
  * @param array $args (default: array())
  */
 public function add_rate($args = array())
 {
     $defaults = array('id' => '', 'label' => '', 'cost' => '0', 'taxes' => '', 'calc_tax' => 'per_order');
     $args = wp_parse_args($args, $defaults);
     extract($args);
     // Id and label are required
     if (!$id || !$label) {
         return;
     }
     // Handle cost
     $total_cost = round(is_array($cost) ? array_sum($cost) : $cost, wc_get_price_decimals());
     // Taxes - if not an array and not set to false, calc tax based on cost and passed calc_tax variable
     // This saves shipping methods having to do complex tax calculations
     if (!is_array($taxes) && $taxes !== false && $total_cost > 0 && $this->is_taxable()) {
         $taxes = array();
         switch ($calc_tax) {
             case "per_item":
                 // If we have an array of costs we can look up each items tax class and add tax accordingly
                 if (is_array($cost)) {
                     $cart = WC()->cart->get_cart();
                     foreach ($cost as $cost_key => $amount) {
                         if (!isset($cart[$cost_key])) {
                             continue;
                         }
                         $_product = $cart[$cost_key]['data'];
                         $rates = WC_Tax::get_shipping_tax_rates($_product->get_tax_class());
                         $item_taxes = WC_Tax::calc_shipping_tax($amount, $rates);
                         // Sum the item taxes
                         foreach (array_keys($taxes + $item_taxes) as $key) {
                             $taxes[$key] = (isset($item_taxes[$key]) ? $item_taxes[$key] : 0) + (isset($taxes[$key]) ? $taxes[$key] : 0);
                         }
                     }
                     // Add any cost for the order - order costs are in the key 'order'
                     if (isset($cost['order'])) {
                         $rates = WC_Tax::get_shipping_tax_rates();
                         $item_taxes = WC_Tax::calc_shipping_tax($cost['order'], $rates);
                         // Sum the item taxes
                         foreach (array_keys($taxes + $item_taxes) as $key) {
                             $taxes[$key] = (isset($item_taxes[$key]) ? $item_taxes[$key] : 0) + (isset($taxes[$key]) ? $taxes[$key] : 0);
                         }
                     }
                 }
                 break;
             default:
                 $rates = WC_Tax::get_shipping_tax_rates();
                 $taxes = WC_Tax::calc_shipping_tax($total_cost, $rates);
                 break;
         }
     }
     $this->rates[] = new WC_Shipping_Rate($id, $label, $total_cost, $taxes, $this->id);
 }
开发者ID:amusiiko,项目名称:armo,代码行数:58,代码来源:abstract-wc-shipping-method.php


示例3: sv_wc_csv_export_localize_price_items_columns

/**
 * Uses the WooCommerce currency display settings to format CSV price values instead of machine-readable values
 *
 * @param array $item_data the data "items" columns in the CSV Export file
 * @return array - updated item data
 */
function sv_wc_csv_export_localize_price_items_columns($item_data)
{
    $decimals = wc_get_price_decimals();
    $decimal_separator = wc_get_price_decimal_separator();
    $thousand_separator = wc_get_price_thousand_separator();
    $price_data = array('subtotal', 'subtotal_tax', 'total', 'total_tax', 'refunded');
    // localize price for each piece of price data
    foreach ($price_data as $data_key) {
        if (isset($item_data[$data_key])) {
            $item_data[$data_key] = number_format($item_data[$data_key], $decimals, $decimal_separator, $thousand_separator);
        }
    }
    return $item_data;
}
开发者ID:skyverge,项目名称:wc-plugins-snippets,代码行数:20,代码来源:modify-price-output-for-currency.php


示例4: __construct

 /**
  * Constructor for the cart class. Loads options and hooks in the init method.
  */
 public function __construct()
 {
     $this->prices_include_tax = wc_prices_include_tax();
     $this->round_at_subtotal = get_option('woocommerce_tax_round_at_subtotal') == 'yes';
     $this->tax_display_cart = get_option('woocommerce_tax_display_cart');
     $this->dp = wc_get_price_decimals();
     $this->display_totals_ex_tax = $this->tax_display_cart == 'excl';
     $this->display_cart_ex_tax = $this->tax_display_cart == 'excl';
     add_action('wp_loaded', array($this, 'init'));
     // Get cart after WP and plugins are loaded.
     add_action('wp', array($this, 'maybe_set_cart_cookies'), 99);
     // Set cookies
     add_action('shutdown', array($this, 'maybe_set_cart_cookies'), 0);
     // Set cookies before shutdown and ob flushing
     add_action('woocommerce_add_to_cart', array($this, 'calculate_totals'), 20, 0);
     add_action('woocommerce_applied_coupon', array($this, 'calculate_totals'), 20, 0);
 }
开发者ID:nightbook,项目名称:woocommerce,代码行数:20,代码来源:class-wc-cart.php


示例5: admin_scripts

 /**
  * Enqueue scripts
  */
 public function admin_scripts()
 {
     global $post;
     get_currentuserinfo();
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     // Register scripts
     wp_register_script('woocommerce_admin', WC()->plugin_url() . '/assets/js/admin/woocommerce_admin' . $suffix . '.js', array('jquery', 'jquery-blockui', 'jquery-ui-sortable', 'jquery-ui-widget', 'jquery-ui-core', 'jquery-tiptip'), WC_VERSION);
     wp_register_script('jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array('jquery'), '2.66', true);
     wp_register_script('jquery-tiptip', WC()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip' . $suffix . '.js', array('jquery'), WC_VERSION, true);
     wp_register_script('accounting', WC()->plugin_url() . '/assets/js/admin/accounting' . $suffix . '.js', array('jquery'), '0.3.2');
     wp_register_script('round', WC()->plugin_url() . '/assets/js/admin/round' . $suffix . '.js', array('jquery'), WC_VERSION);
     wp_register_script('wc-admin-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes' . $suffix . '.js', array('jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'accounting', 'round', 'wc-enhanced-select', 'plupload-all', 'stupidtable'), WC_VERSION);
     wp_register_script('qrcode', WC()->plugin_url() . '/assets/js/admin/jquery.qrcode.min.js', array('jquery'), WC_VERSION);
     wp_register_script('stupidtable', WC()->plugin_url() . '/assets/js/stupidtable/stupidtable' . $suffix . '.js', array('jquery'), WC_VERSION);
     wp_register_script('wc-admin-notices', WC()->plugin_url() . '/assets/js/admin/woocommerce_notices' . $suffix . '.js', array('jquery'), WC_VERSION, true);
     // Select2 is the replacement for chosen
     wp_register_script('select2', WC()->plugin_url() . '/assets/js/select2/select2' . $suffix . '.js', array('jquery'), '3.5.2');
     wp_register_script('wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array('jquery', 'select2'), WC_VERSION);
     wp_localize_script('select2', 'wc_select_params', array('i18n_matches_1' => _x('One result is available, press enter to select it.', 'enhanced select', 'woocommerce'), 'i18n_matches_n' => _x('%qty% results are available, use up and down arrow keys to navigate.', 'enhanced select', 'woocommerce'), 'i18n_no_matches' => _x('No matches found', 'enhanced select', 'woocommerce'), 'i18n_ajax_error' => _x('Loading failed', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_1' => _x('Please enter 1 or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_n' => _x('Please enter %qty% or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_1' => _x('Please delete 1 character', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_n' => _x('Please delete %qty% characters', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_n' => _x('You can only select %qty% items', 'enhanced select', 'woocommerce'), 'i18n_load_more' => _x('Loading more results…', 'enhanced select', 'woocommerce'), 'i18n_searching' => _x('Searching…', 'enhanced select', 'woocommerce')));
     wp_localize_script('wc-enhanced-select', 'wc_enhanced_select_params', array('ajax_url' => admin_url('admin-ajax.php'), 'search_products_nonce' => wp_create_nonce('search-products'), 'search_customers_nonce' => wp_create_nonce('search-customers')));
     // Accounting
     wp_localize_script('accounting', 'accounting_params', array('mon_decimal_point' => wc_get_price_decimal_separator()));
     // WooCommerce admin pages
     wp_enqueue_script('woocommerce_admin');
     wp_enqueue_script('iris');
     wp_enqueue_script('wc-enhanced-select');
     wp_enqueue_script('jquery-ui-sortable');
     wp_enqueue_script('jquery-ui-autocomplete');
     $locale = localeconv();
     $decimal = isset($locale['decimal_point']) ? $locale['decimal_point'] : '.';
     $params = array('i18n_decimal_error' => sprintf(__('Please enter in decimal (%s) format without thousand separators.', 'woocommerce'), $decimal), 'i18n_mon_decimal_error' => sprintf(__('Please enter in monetary decimal (%s) format without thousand separators and currency symbols.', 'woocommerce'), wc_get_price_decimal_separator()), 'i18n_country_iso_error' => __('Please enter in country code with two capital letters.', 'woocommerce'), 'i18_sale_less_than_regular_error' => __('Please enter in a value less than the regular price.', 'woocommerce'), 'decimal_point' => $decimal, 'mon_decimal_point' => wc_get_price_decimal_separator());
     wp_localize_script('woocommerce_admin', 'woocommerce_admin', $params);
     // Meta boxes
     wp_enqueue_media();
     wp_enqueue_script('wc-admin-product-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-product' . $suffix . '.js', array('wc-admin-meta-boxes'), WC_VERSION);
     wp_enqueue_script('wc-admin-variation-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-product-variation' . $suffix . '.js', array('wc-admin-meta-boxes'), WC_VERSION);
     $params = array('post_id' => isset($post->ID) ? $post->ID : '', 'plugin_url' => WC()->plugin_url(), 'ajax_url' => admin_url('admin-ajax.php'), 'woocommerce_placeholder_img_src' => wc_placeholder_img_src(), 'add_variation_nonce' => wp_create_nonce("add-variation"), 'link_variation_nonce' => wp_create_nonce("link-variations"), 'delete_variations_nonce' => wp_create_nonce("delete-variations"), 'i18n_link_all_variations' => esc_js(__('Are you sure you want to link all variations? This will create a new variation for each and every possible combination of variation attributes (max 50 per run).', 'woocommerce')), 'i18n_enter_a_value' => esc_js(__('Enter a value', 'woocommerce')), 'i18n_enter_a_value_fixed_or_percent' => esc_js(__('Enter a value (fixed or %)', 'woocommerce')), 'i18n_delete_all_variations' => esc_js(__('Are you sure you want to delete all variations? This cannot be undone.', 'woocommerce')), 'i18n_last_warning' => esc_js(__('Last warning, are you sure?', 'woocommerce')), 'i18n_choose_image' => esc_js(__('Choose an image', 'woocommerce')), 'i18n_set_image' => esc_js(__('Set variation image', 'woocommerce')), 'i18n_variation_added' => esc_js(__("variation added", 'woocommerce')), 'i18n_variations_added' => esc_js(__("variations added", 'woocommerce')), 'i18n_no_variations_added' => esc_js(__("No variations added", 'woocommerce')), 'i18n_remove_variation' => esc_js(__('Are you sure you want to remove this variation?', 'woocommerce')), 'i18n_scheduled_sale_start' => esc_js(__('Sale start date (YYYY-MM-DD format or leave blank)', 'woocommerce')), 'i18n_scheduled_sale_end' => esc_js(__('Sale end date  (YYYY-MM-DD format or leave blank)', 'woocommerce')));
     wp_localize_script('wc-admin-variation-meta-boxes', 'woocommerce_admin_meta_boxes_variations', $params);
     $params = array('remove_item_notice' => __('Are you sure you want to remove the selected items? If you have previously reduced this item\'s stock, or this order was submitted by a customer, you will need to manually restore the item\'s stock.', 'woocommerce'), 'i18n_select_items' => __('Please select some items.', 'woocommerce'), 'i18n_do_refund' => __('Are you sure you wish to process this refund? This action cannot be undone.', 'woocommerce'), 'i18n_delete_refund' => __('Are you sure you wish to delete this refund? This action cannot be undone.', 'woocommerce'), 'i18n_delete_tax' => __('Are you sure you wish to delete this tax column? This action cannot be undone.', 'woocommerce'), 'remove_item_meta' => __('Remove this item meta?', 'woocommerce'), 'remove_attribute' => __('Remove this attribute?', 'woocommerce'), 'name_label' => __('Name', 'woocommerce'), 'remove_label' => __('Remove', 'woocommerce'), 'click_to_toggle' => __('Click to toggle', 'woocommerce'), 'values_label' => __('Value(s)', 'woocommerce'), 'text_attribute_tip' => __('Enter some text, or some attributes by pipe (|) separating values.', 'woocommerce'), 'visible_label' => __('Visible on the product page', 'woocommerce'), 'used_for_variations_label' => __('Used for variations', 'woocommerce'), 'new_attribute_prompt' => __('Enter a name for the new attribute term:', 'woocommerce'), 'calc_totals' => __('Calculate totals based on order items, discounts, and shipping?', 'woocommerce'), 'calc_line_taxes' => __('Calculate line taxes? This will calculate taxes based on the customers country. If no billing/shipping is set it will use the store base country.', 'woocommerce'), 'copy_billing' => __('Copy billing information to shipping information? This will remove any currently entered shipping information.', 'woocommerce'), 'load_billing' => __('Load the customer\'s billing information? This will remove any currently entered billing information.', 'woocommerce'), 'load_shipping' => __('Load the customer\'s shipping information? This will remove any currently entered shipping information.', 'woocommerce'), 'featured_label' => __('Featured', 'woocommerce'), 'prices_include_tax' => esc_attr(get_option('woocommerce_prices_include_tax')), 'round_at_subtotal' => esc_attr(get_option('woocommerce_tax_round_at_subtotal')), 'no_customer_selected' => __('No customer selected', 'woocommerce'), 'plugin_url' => WC()->plugin_url(), 'ajax_url' => admin_url('admin-ajax.php'), 'order_item_nonce' => wp_create_nonce('order-item'), 'add_attribute_nonce' => wp_create_nonce('add-attribute'), 'save_attributes_nonce' => wp_create_nonce('save-attributes'), 'calc_totals_nonce' => wp_create_nonce('calc-totals'), 'get_customer_details_nonce' => wp_create_nonce('get-customer-details'), 'search_products_nonce' => wp_create_nonce('search-products'), 'grant_access_nonce' => wp_create_nonce('grant-access'), 'revoke_access_nonce' => wp_create_nonce('revoke-access'), 'add_order_note_nonce' => wp_create_nonce('add-order-note'), 'delete_order_note_nonce' => wp_create_nonce('delete-order-note'), 'calendar_image' => WC()->plugin_url() . '/assets/images/calendar.png', 'post_id' => isset($post->ID) ? $post->ID : '', 'base_country' => WC()->countries->get_base_country(), 'currency_format_num_decimals' => wc_get_price_decimals(), 'currency_format_symbol' => get_woocommerce_currency_symbol(), 'currency_format_decimal_sep' => esc_attr(wc_get_price_decimal_separator()), 'currency_format_thousand_sep' => esc_attr(wc_get_price_thousand_separator()), 'currency_format' => esc_attr(str_replace(array('%1$s', '%2$s'), array('%s', '%v'), get_woocommerce_price_format())), 'rounding_precision' => WC_ROUNDING_PRECISION, 'tax_rounding_mode' => WC_TAX_ROUNDING_MODE, 'product_types' => array_map('sanitize_title', get_terms('product_type', array('hide_empty' => false, 'fields' => 'names'))), 'default_attribute_visibility' => apply_filters('default_attribute_visibility', false), 'default_attribute_variation' => apply_filters('default_attribute_variation', false), 'i18n_download_permission_fail' => __('Could not grant access - the user may already have permission for this file or billing email is not set. Ensure the billing email is set, and the order has been saved.', 'woocommerce'), 'i18n_permission_revoke' => __('Are you sure you want to revoke access to this download?', 'woocommerce'), 'i18n_tax_rate_already_exists' => __('You cannot add the same tax rate twice!', 'woocommerce'), 'i18n_product_type_alert' => __('Your product has variations! Before changing the product type, it is a good idea to delete the variations to avoid errors in the stock reports.', 'woocommerce'));
     wp_localize_script('wc-admin-meta-boxes', 'woocommerce_admin_meta_boxes', $params);
 }
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:44,代码来源:class-wc-admin-assets-frontend.php


示例6: get_variation_prices

 /**
  * Get an array of all sale and regular prices from all variations. This is used for example when displaying the price range at variable product level or seeing if the variable product is on sale.
  *
  * Can be filtered by plugins which modify costs, but otherwise will include the raw meta costs unlike get_price() which runs costs through the woocommerce_get_price filter.
  * This is to ensure modified prices are not cached, unless intended.
  *
  * @param  bool $display Are prices for display? If so, taxes will be calculated.
  * @return array() Array of RAW prices, regular prices, and sale prices with keys set to variation ID.
  */
 public function get_variation_prices($display = false)
 {
     global $wp_filter;
     /**
      * Transient name for storing prices for this product (note: Max transient length is 45)
      * @since 2.5.0 a single transient is used per product for all prices, rather than many transients per product.
      */
     $transient_name = 'wc_var_prices_' . $this->id;
     /**
      * Create unique cache key based on the tax location (affects displayed/cached prices), product version and active price filters.
      * DEVELOPERS should filter this hash if offering conditonal pricing to keep it unique.
      * @var string
      */
     if ($display) {
         $price_hash = array(get_option('woocommerce_tax_display_shop', 'excl'), WC_Tax::get_rates());
     } else {
         $price_hash = array(false);
     }
     $filter_names = array('woocommerce_variation_prices_price', 'woocommerce_variation_prices_regular_price', 'woocommerce_variation_prices_sale_price');
     foreach ($filter_names as $filter_name) {
         if (!empty($wp_filter[$filter_name])) {
             $price_hash[$filter_name] = array();
             foreach ($wp_filter[$filter_name] as $priority => $callbacks) {
                 $price_hash[$filter_name][] = array_values(wp_list_pluck($callbacks, 'function'));
             }
         }
     }
     $price_hash = md5(json_encode(apply_filters('woocommerce_get_variation_prices_hash', $price_hash, $this, $display)));
     // If the value has already been generated, we don't need to grab the values again.
     if (empty($this->prices_array[$price_hash])) {
         // Get value of transient
         $prices_array = array_filter((array) json_decode(strval(get_transient($transient_name)), true));
         // If the product version has changed, reset cache
         if (empty($prices_array['version']) || $prices_array['version'] !== WC_Cache_Helper::get_transient_version('product')) {
             $this->prices_array = array('version' => WC_Cache_Helper::get_transient_version('product'));
         }
         // If the prices are not stored for this hash, generate them
         if (empty($prices_array[$price_hash])) {
             $prices = array();
             $regular_prices = array();
             $sale_prices = array();
             $variation_ids = $this->get_children(true);
             foreach ($variation_ids as $variation_id) {
                 if ($variation = $this->get_child($variation_id)) {
                     $price = apply_filters('woocommerce_variation_prices_price', $variation->price, $variation, $this);
                     $regular_price = apply_filters('woocommerce_variation_prices_regular_price', $variation->regular_price, $variation, $this);
                     $sale_price = apply_filters('woocommerce_variation_prices_sale_price', $variation->sale_price, $variation, $this);
                     // Skip empty prices
                     if ('' === $price) {
                         continue;
                     }
                     // If sale price does not equal price, the product is not yet on sale
                     if ($sale_price === $regular_price || $sale_price !== $price) {
                         $sale_price = $regular_price;
                     }
                     // If we are getting prices for display, we need to account for taxes
                     if ($display) {
                         if ('incl' === get_option('woocommerce_tax_display_shop')) {
                             $price = '' === $price ? '' : $variation->get_price_including_tax(1, $price);
                             $regular_price = '' === $regular_price ? '' : $variation->get_price_including_tax(1, $regular_price);
                             $sale_price = '' === $sale_price ? '' : $variation->get_price_including_tax(1, $sale_price);
                         } else {
                             $price = '' === $price ? '' : $variation->get_price_excluding_tax(1, $price);
                             $regular_price = '' === $regular_price ? '' : $variation->get_price_excluding_tax(1, $regular_price);
                             $sale_price = '' === $sale_price ? '' : $variation->get_price_excluding_tax(1, $sale_price);
                         }
                     }
                     $prices[$variation_id] = wc_format_decimal($price, wc_get_price_decimals());
                     $regular_prices[$variation_id] = wc_format_decimal($regular_price, wc_get_price_decimals());
                     $sale_prices[$variation_id] = wc_format_decimal($sale_price . '.00', wc_get_price_decimals());
                 }
             }
             asort($prices);
             asort($regular_prices);
             asort($sale_prices);
             $prices_array[$price_hash] = array('price' => $prices, 'regular_price' => $regular_prices, 'sale_price' => $sale_prices);
             set_transient($transient_name, json_encode($prices_array), DAY_IN_SECONDS * 30);
         }
         /**
          * Give plugins one last chance to filter the variation prices array which has been generated.
          */
         $this->prices_array[$price_hash] = apply_filters('woocommerce_variation_prices', $prices_array[$price_hash], $this, $display);
     }
     /**
      * Return the values.
      */
     return $this->prices_array[$price_hash];
 }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:97,代码来源:class-wc-product-variable.php


示例7: get_index

 /**
  * Get the site index.
  *
  * This endpoint describes the capabilities of the site.
  *
  * @since 2.3
  * @return array Index entity
  */
 public function get_index()
 {
     // General site data
     $available = array('store' => array('name' => get_option('blogname'), 'description' => get_option('blogdescription'), 'URL' => get_option('siteurl'), 'wc_version' => WC()->version, 'routes' => array(), 'meta' => array('timezone' => wc_timezone_string(), 'currency' => get_woocommerce_currency(), 'currency_format' => get_woocommerce_currency_symbol(), 'currency_position' => get_option('woocommerce_currency_pos'), 'thousand_separator' => get_option('woocommerce_price_decimal_sep'), 'decimal_separator' => get_option('woocommerce_price_thousand_sep'), 'price_num_decimals' => wc_get_price_decimals(), 'tax_included' => wc_prices_include_tax(), 'weight_unit' => get_option('woocommerce_weight_unit'), 'dimension_unit' => get_option('woocommerce_dimension_unit'), 'ssl_enabled' => 'yes' === get_option('woocommerce_force_ssl_checkout'), 'permalinks_enabled' => '' !== get_option('permalink_structure'), 'links' => array('help' => 'http://woothemes.github.io/woocommerce-rest-api-docs/'))));
     // Find the available routes
     foreach ($this->get_routes() as $route => $callbacks) {
         $data = array();
         $route = preg_replace('#\\(\\?P(<\\w+?>).*?\\)#', '$1', $route);
         foreach (self::$method_map as $name => $bitmask) {
             foreach ($callbacks as $callback) {
                 // Skip to the next route if any callback is hidden
                 if ($callback[1] & self::HIDDEN_ENDPOINT) {
                     continue 3;
                 }
                 if ($callback[1] & $bitmask) {
                     $data['supports'][] = $name;
                 }
                 if ($callback[1] & self::ACCEPT_DATA) {
                     $data['accepts_data'] = true;
                 }
                 // For non-variable routes, generate links
                 if (strpos($route, '<') === false) {
                     $data['meta'] = array('self' => get_woocommerce_api_url($route));
                 }
             }
         }
         $available['store']['routes'][$route] = apply_filters('woocommerce_api_endpoints_description', $data);
     }
     return apply_filters('woocommerce_api_index', $available);
 }
开发者ID:abesamislyndon,项目名称:femaccms,代码行数:38,代码来源:class-wc-api-server.php


示例8: get_main_chart

    /**
     * Get the main chart.
     *
     * @return string
     */
    public function get_main_chart()
    {
        global $wp_locale;
        if (empty($this->show_categories)) {
            ?>
			<div class="chart-container">
				<p class="chart-prompt"><?php 
            _e('&larr; Choose a category to view stats', 'woocommerce');
            ?>
</p>
			</div>
			<?php 
        } else {
            $chart_data = array();
            $index = 0;
            foreach ($this->show_categories as $category) {
                $category = get_term($category, 'product_cat');
                $product_ids = $this->get_products_in_category($category->term_id);
                $category_chart_data = array();
                for ($i = 0; $i <= $this->chart_interval; $i++) {
                    $interval_total = 0;
                    switch ($this->chart_groupby) {
                        case 'day':
                            $time = strtotime(date('Ymd', strtotime("+{$i} DAY", $this->start_date))) * 1000;
                            break;
                        case 'month':
                        default:
                            $time = strtotime(date('Ym', strtotime("+{$i} MONTH", $this->start_date)) . '01') * 1000;
                            break;
                    }
                    foreach ($product_ids as $id) {
                        if (isset($this->item_sales_and_times[$time][$id])) {
                            $interval_total += $this->item_sales_and_times[$time][$id];
                        }
                    }
                    $category_chart_data[] = array($time, (double) wc_format_decimal($interval_total, wc_get_price_decimals()));
                }
                $chart_data[$category->term_id]['category'] = $category->name;
                $chart_data[$category->term_id]['data'] = $category_chart_data;
                $index++;
            }
            ?>
			<div class="chart-container">
				<div class="chart-placeholder main"></div>
			</div>
			<script type="text/javascript">
				var main_chart;

				jQuery(function(){
					var drawGraph = function( highlight ) {
						var series = [
							<?php 
            $index = 0;
            foreach ($chart_data as $data) {
                $color = isset($this->chart_colours[$index]) ? $this->chart_colours[$index] : $this->chart_colours[0];
                $width = $this->barwidth / sizeof($chart_data);
                $offset = $width * $index;
                $series = $data['data'];
                foreach ($series as $key => $series_data) {
                    $series[$key][0] = $series_data[0] + $offset;
                }
                echo '{
										label: "' . esc_js($data['category']) . '",
										data: jQuery.parseJSON( "' . json_encode($series) . '" ),
										color: "' . $color . '",
										bars: {
											fillColor: "' . $color . '",
											fill: true,
											show: true,
											lineWidth: 1,
											align: "center",
											barWidth: ' . $width * 0.75 . ',
											stack: false
										},
										' . $this->get_currency_tooltip() . ',
										enable_tooltip: true,
										prepend_label: true
									},';
                $index++;
            }
            ?>
						];

						if ( highlight !== 'undefined' && series[ highlight ] ) {
							highlight_series = series[ highlight ];

							highlight_series.color = '#9c5d90';

							if ( highlight_series.bars ) {
								highlight_series.bars.fillColor = '#9c5d90';
							}

							if ( highlight_series.lines ) {
								highlight_series.lines.lineWidth = 5;
							}
//.........这里部分代码省略.........
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:101,代码来源:class-wc-report-sales-by-category.php


示例9: foreach

?>

		<?php 
if (wc_tax_enabled()) {
    ?>
			<?php 
    foreach ($order->get_tax_totals() as $code => $tax) {
        ?>
				<tr>
					<td class="label"><?php 
        echo $tax->label;
        ?>
:</td>
					<td class="total"><?php 
        if (($refunded = $order->get_total_tax_refunded_by_rate_id($tax->rate_id)) > 0) {
            echo '<del>' . strip_tags($tax->formatted_amount) . '</del> <ins>' . wc_price(WC_Tax::round($tax->amount, wc_get_price_decimals()) - WC_Tax::round($refunded, wc_get_price_decimals()), array('currency' => $order->get_order_currency())) . '</ins>';
        } else {
            echo $tax->formatted_amount;
        }
        ?>
</td>
					<td width="1%"></td>
				</tr>
			<?php 
    }
    ?>
		<?php 
}
?>

		<?php 
开发者ID:robbenz,项目名称:plugs,代码行数:31,代码来源:html-order-items.php


示例10: add_rate

 /**
  * Add a shipping rate. If taxes are not set they will be calculated based on cost.
  * @param array $args (default: array())
  */
 public function add_rate($args = array())
 {
     $args = wp_parse_args($args, array('id' => '', 'label' => '', 'cost' => '0', 'taxes' => '', 'calc_tax' => 'per_order', 'meta_data' => array()));
     // ID and label are required
     if (!$args['id'] || !$args['label']) {
         return;
     }
     // Total up the cost
     $total_cost = is_array($args['cost']) ? array_sum($args['cost']) : $args['cost'];
     $taxes = $args['taxes'];
     // Taxes - if not an array and not set to false, calc tax based on cost and passed calc_tax variable. This saves shipping methods having to do complex tax calculations.
     if (!is_array($taxes) && $taxes !== false && $total_cost > 0 && $this->is_taxable()) {
         $taxes = 'per_item' === $args['calc_tax'] ? $this->get_taxes_per_item($args['cost']) : WC_Tax::calc_shipping_tax($total_cost, WC_Tax::get_shipping_tax_rates());
     }
     // Round the total cost after taxes have been calculated.
     $total_cost = wc_format_decimal($total_cost, wc_get_price_decimals());
     // Create rate object
     $rate = new WC_Shipping_Rate($args['id'], $args['label'], $total_cost, $taxes, $this->id);
     if (!empty($args['meta_data'])) {
         foreach ($args['meta_data'] as $key => $value) {
             $rate->add_meta_data($key, $value);
         }
     }
     $this->rates[$args['id']] = $rate;
 }
开发者ID:KristoferN,项目名称:woocommerce,代码行数:29,代码来源:abstract-wc-shipping-method.php


示例11: admin_scripts

 /**
  * Enqueue scripts
  */
 public function admin_scripts()
 {
     global $wp_query, $post, $current_user;
     get_currentuserinfo();
     $screen = get_current_screen();
     $wc_screen_id = sanitize_title(__('WooCommerce', 'woocommerce'));
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     // Register scripts
     wp_register_script('woocommerce_admin', WC()->plugin_url() . '/assets/js/admin/woocommerce_admin' . $suffix . '.js', array('jquery', 'jquery-blockui', 'jquery-ui-sortable', 'jquery-ui-widget', 'jquery-ui-core', 'jquery-tiptip'), WC_VERSION);
     wp_register_script('jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array('jquery'), '2.70', true);
     wp_register_script('jquery-tiptip', WC()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip' . $suffix . '.js', array('jquery'), WC_VERSION, true);
     wp_register_script('accounting', WC()->plugin_url() . '/assets/js/admin/accounting' . $suffix . '.js', array('jquery'), '0.4.2');
     wp_register_script('round', WC()->plugin_url() . '/assets/js/admin/round' . $suffix . '.js', array('jquery'), WC_VERSION);
     wp_register_script('wc-admin-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes' . $suffix . '.js', array('jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'accounting', 'round', 'wc-enhanced-select', 'plupload-all', 'stupidtable'), WC_VERSION);
     wp_register_script('zeroclipboard', WC()->plugin_url() . '/assets/js/zeroclipboard/jquery.zeroclipboard' . $suffix . '.js', array('jquery'), WC_VERSION);
     wp_register_script('qrcode', WC()->plugin_url() . '/assets/js/jquery-qrcode/jquery.qrcode' . $suffix . '.js', array('jquery'), WC_VERSION);
     wp_register_script('stupidtable', WC()->plugin_url() . '/assets/js/stupidtable/stupidtable' . $suffix . '.js', array('jquery'), WC_VERSION);
     // Chosen is @deprecated (2.3) in favour of select2, but is registered for backwards compat
     wp_register_script('ajax-chosen', WC()->plugin_url() . '/assets/js/chosen/ajax-chosen.jquery' . $suffix . '.js', array('jquery', 'chosen'), WC_VERSION);
     wp_register_script('chosen', WC()->plugin_url() . '/assets/js/chosen/chosen.jquery' . $suffix . '.js', array('jquery'), WC_VERSION);
     // Select2 is the replacement for chosen
     wp_register_script('select2', WC()->plugin_url() . '/assets/js/select2/select2' . $suffix . '.js', array('jquery'), '3.5.2');
     wp_register_script('wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array('jquery', 'select2'), WC_VERSION);
     wp_localize_script('wc-enhanced-select', 'wc_enhanced_select_params', array('i18n_matches_1' => _x('One result is available, press enter to select it.', 'enhanced select', 'woocommerce'), 'i18n_matches_n' => _x('%qty% results are available, use up and down arrow keys to navigate.', 'enhanced select', 'woocommerce'), 'i18n_no_matches' => _x('No matches found', 'enhanced select', 'woocommerce'), 'i18n_ajax_error' => _x('Loading failed', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_1' => _x('Please enter 1 or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_n' => _x('Please enter %qty% or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_1' => _x('Please delete 1 character', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_n' => _x('Please delete %qty% characters', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_n' => _x('You can only select %qty% items', 'enhanced select', 'woocommerce'), 'i18n_load_more' => _x('Loading more results&hellip;', 'enhanced select', 'woocommerce'), 'i18n_searching' => _x('Searching&hellip;', 'enhanced select', 'woocommerce'), 'ajax_url' => admin_url('admin-ajax.php'), 'search_products_nonce' => wp_create_nonce('search-products'), 'search_customers_nonce' => wp_create_nonce('search-customers')));
     // Accounting
     wp_localize_script('accounting', 'accounting_params', array('mon_decimal_point' => wc_get_price_decimal_separator()));
     // WooCommerce admin pages
     if (in_array($screen->id, wc_get_screen_ids())) {
         wp_enqueue_script('woocommerce_admin');
         wp_enqueue_script('iris');
         wp_enqueue_script('wc-enhanced-select');
         wp_enqueue_script('jquery-ui-sortable');
         wp_enqueue_script('jquery-ui-autocomplete');
         $locale = localeconv();
         $decimal = isset($locale['decimal_point']) ? $locale['decimal_point'] : '.';
         $params = array('i18n_decimal_error' => sprintf(__('Please enter in decimal (%s) format without thousand separators.', 'woocommerce'), $decimal), 'i18n_mon_decimal_error' => sprintf(__('Please enter in monetary decimal (%s) format without thousand separators and currency symbols.', 'woocommerce'), wc_get_price_decimal_separator()), 'i18n_country_iso_error' => __('Please enter in country code with two capital letters.', 'woocommerce'), 'i18_sale_less_than_regular_error' => __('Please enter in a value less than the regular price.', 'woocommerce'), 'decimal_point' => $decimal, 'mon_decimal_point' => wc_get_price_decimal_separator());
         wp_localize_script('woocommerce_admin', 'woocommerce_admin', $params);
     }
     // Edit product category pages
     if (in_array($screen->id, array('edit-product_cat'))) {
         wp_enqueue_media();
     }
     // Products
     if (in_array($screen->id, array('edit-product'))) {
         wp_enqueue_script('woocommerce_quick-edit', WC()->plugin_url() . '/assets/js/admin/quick-edit' . $suffix . '.js', array('jquery'), WC_VERSION);
     }
     // Meta boxes
     if (in_array($screen->id, array('product', 'edit-product'))) {
         wp_enqueue_media();
         wp_enqueue_script('wc-admin-product-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-product' . $suffix . '.js', array('wc-admin-meta-boxes'), WC_VERSION);
         wp_enqueue_script('wc-admin-variation-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-product-variation' . $suffix . '.js', array('wc-admin-meta-boxes'), WC_VERSION);
         $params = array('post_id' => isset($post->ID) ? $post->ID : '', 'plugin_url' => WC()->plugin_url(), 'ajax_url' => admin_url('admin-ajax.php'), 'woocommerce_placeholder_img_src' => wc_placeholder_img_src(), 'add_variation_nonce' => wp_create_nonce('add-variation'), 'link_variation_nonce' => wp_create_nonce('link-variations'), 'delete_variations_nonce' => wp_create_nonce('delete-variations'), 'load_variations_nonce' => wp_create_nonce('load-variations'), 'save_variations_nonce' => wp_create_nonce('save-variations'), 'bulk_edit_variations_nonce' => wp_create_nonce('bulk-edit-variations'), 'i18n_link_all_variations' => esc_js(__('Are you sure you want to link all variations? This will create a new variation for each and every possible combination of variation attributes (max 50 per run).', 'woocommerce')), 'i18n_enter_a_value' => esc_js(__('Enter a value', 'woocommerce')), 'i18n_enter_a_value_fixed_or_percent' => esc_js(__('Enter a value (fixed or %)', 'woocommerce')), 'i18n_delete_all_variations' => esc_js(__('Are you sure you want to delete all variations? This cannot be undone.', 'woocommerce')), 'i18n_last_warning' => esc_js(__('Last warning, are you sure?', 'woocommerce')), 'i18n_choose_image' => esc_js(__('Choose an image', 'woocommerce')), 'i18n_set_image' => esc_js(__('Set variation image', 'woocommerce')), 'i18n_variation_added' => esc_js(__("variation added", 'woocommerce')), 'i18n_variations_added' => esc_js(__("variations added", 'woocommerce')), 'i18n_no_variations_added' => esc_js(__("No variations added", 'woocommerce')), 'i18n_remove_variation' => esc_js(__('Are you sure you want to remove this variation?', 'woocommerce')), 'i18n_scheduled_sale_start' => esc_js(__('Sale start date (YYYY-MM-DD format or leave blank)', 'woocommerce')), 'i18n_scheduled_sale_end' => esc_js(__('Sale end date  (YYYY-MM-DD format or leave blank)', 'woocommerce')), 'i18n_edited_variations' => esc_js(__('Save changes before changing page?', 'woocommerce')), 'i18n_variation_count_single' => esc_js(__('%qty% variation', 'woocommerce')), 'i18n_variation_count_plural' => esc_js(__('%qty% variations', 'woocommerce')), 'variations_per_page' => absint(apply_filters('woocommerce_admin_meta_boxes_variations_per_page', 10)));
         wp_localize_script('wc-admin-variation-meta-boxes', 'woocommerce_admin_meta_boxes_variations', $params);
     }
     if (in_array(str_replace('edit-', '', $screen->id), wc_get_order_types('order-meta-boxes'))) {
         wp_enqueue_script('wc-admin-order-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-order' . $suffix . '.js', array('wc-admin-meta-boxes'), WC_VERSION);
         wp_enqueue_script('wc-admin-order-meta-boxes-modal', WC()->plugin_url() . '/assets/js/admin/order-backbone-modal' . $suffix . '.js', array('underscore', 'backbone', 'wc-admin-order-meta-boxes'), WC_VERSION);
         $params = array('countries' => json_encode(array_merge(WC()->countries->get_allowed_country_states(), WC()->countries->get_shipping_country_states())), 'i18n_select_state_text' => esc_attr__('Select an option&hellip;', 'woocommerce'));
         wp_localize_script('wc-admin-order-meta-boxes', 'woocommerce_admin_meta_boxes_order', $params);
     }
     if (in_array($screen->id, array('shop_coupon', 'edit-shop_coupon'))) {
         wp_enqueue_script('wc-admin-coupon-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-coupon' . $suffix . '.js', array('wc-admin-meta-boxes'), WC_VERSION);
     }
     if (in_array(str_replace('edit-', '', $screen->id), array_merge(array('shop_coupon', 'product'), wc_get_order_types('order-meta-boxes')))) {
         $params = array('remove_item_notice' => __('Are you sure you want to remove the selected items? If you have previously reduced this item\'s stock, or this order was submitted by a customer, you will need to manually restore the item\'s stock.', 'woocommerce'), 'i18n_select_items' => __('Please select some items.', 'woocommerce'), 'i18n_do_refund' => __('Are you sure you wish to process this refund? This action cannot be undone.', 'woocommerce'), 'i18n_delete_refund' => __('Are you sure you wish to delete this refund? This action cannot be undone.', 'woocommerce'), 'i18n_delete_tax' => __('Are you sure you wish to delete this tax column? This action cannot be undone.', 'woocommerce'), 'remove_item_meta' => __('Remove this item meta?', 'woocommerce'), 'remove_attribute' => __('Remove this attribute?', 'woocommerce'), 'name_label' => __('Name', 'woocommerce'), 'remove_label' => __('Remove', 'woocommerce'), 'click_to_toggle' => __('Click to toggle', 'woocommerce'), 'values_label' => __('Value(s)', 'woocommerce'), 'text_attribute_tip' => __('Enter some text, or some attributes by pipe (|) separating values.', 'woocommerce'), 'visible_label' => __('Visible on the product page', 'woocommerce'), 'used_for_variations_label' => __('Used for variations', 'woocommerce'), 'new_attribute_prompt' => __('Enter a name for the new attribute term:', 'woocommerce'), 'calc_totals' => __('Calculate totals based on order items, discounts, and shipping?', 'woocommerce'), 'calc_line_taxes' => __('Calculate line taxes? This will calculate taxes based on the customers country. If no billing/shipping is set it will use the store base country.', 'woocommerce'), 'copy_billing' => __('Copy billing information to shipping information? This will remove any currently entered shipping information.', 'woocommerce'), 'load_billing' => __('Load the customer\'s billing information? This will remove any currently entered billing information.', 'woocommerce'), 'load_shipping' => __('Load the customer\'s shipping information? This will remove any currently entered shipping information.', 'woocommerce'), 'featured_label' => __('Featured', 'woocommerce'), 'prices_include_tax' => esc_attr(get_option('woocommerce_prices_include_tax')), 'round_at_subtotal' => esc_attr(get_option('woocommerce_tax_round_at_subtotal')), 'no_customer_selected' => __('No customer selected', 'woocommerce'), 'plugin_url' => WC()->plugin_url(), 'ajax_url' => admin_url('admin-ajax.php'), 'order_item_nonce' => wp_create_nonce('order-item'), 'add_attribute_nonce' => wp_create_nonce('add-attribute'), 'save_attributes_nonce' => wp_create_nonce('save-attributes'), 'calc_totals_nonce' => wp_create_nonce('calc-totals'), 'get_customer_details_nonce' => wp_create_nonce('get-customer-details'), 'search_products_nonce' => wp_create_nonce('search-products'), 'grant_access_nonce' => wp_create_nonce('grant-access'), 'revoke_access_nonce' => wp_create_nonce('revoke-access'), 'add_order_note_nonce' => wp_create_nonce('add-order-note'), 'delete_order_note_nonce' => wp_create_nonce('delete-order-note'), 'calendar_image' => WC()->plugin_url() . '/assets/images/calendar.png', 'post_id' => isset($post->ID) ? $post->ID : '', 'base_country' => WC()->countries->get_base_country(), 'currency_format_num_decimals' => wc_get_price_decimals(), 'currency_format_symbol' => get_woocommerce_currency_symbol(), 'currency_format_decimal_sep' => esc_attr(wc_get_price_decimal_separator()), 'currency_format_thousand_sep' => esc_attr(wc_get_price_thousand_separator()), 'currency_format' => esc_attr(str_replace(array('%1$s', '%2$s'), array('%s', '%v'), get_woocommerce_price_format())), 'rounding_precision' => WC_ROUNDING_PRECISION, 'tax_rounding_mode' => WC_TAX_ROUNDING_MODE, 'product_types' => array_map('sanitize_title', get_terms('product_type', array('hide_empty' => false, 'fields' => 'names'))), 'i18n_download_permission_fail' => __('Could not grant access - the user may already have permission for this file or billing email is not set. Ensure the billing email is set, and the ord 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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