当前位置: 首页>>代码示例>>PHP>>正文


PHP get_woocommerce_currencies函数代码示例

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


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

示例1: get_settings

 /**
  * Get settings array
  *
  * @return array
  */
 public function get_settings()
 {
     $currency_code_options = get_woocommerce_currencies();
     foreach ($currency_code_options as $code => $name) {
         $currency_code_options[$code] = $name . ' (' . get_woocommerce_currency_symbol($code) . ')';
     }
     $settings = apply_filters('woocommerce_general_settings', array(array('title' => __('General Options', 'woocommerce'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'), array('title' => __('Base Location', 'woocommerce'), 'desc' => __('This is the base location for your business. Tax rates will be based on this country.', 'woocommerce'), 'id' => 'woocommerce_default_country', 'css' => 'min-width:350px;', 'default' => 'GB', 'type' => 'single_select_country', 'desc_tip' => true), array('title' => __('Selling Location(s)', 'woocommerce'), 'desc' => __('This option lets you limit which countries you are willing to sell to.', 'woocommerce'), 'id' => 'woocommerce_allowed_countries', 'default' => 'all', 'type' => 'select', 'class' => 'wc-enhanced-select', 'css' => 'min-width: 350px;', 'desc_tip' => true, 'options' => array('all' => __('Sell to all countries', 'woocommerce'), 'specific' => __('Sell to specific countries only', 'woocommerce'))), array('title' => __('Specific Countries', 'woocommerce'), 'desc' => '', 'id' => 'woocommerce_specific_allowed_countries', 'css' => 'min-width: 350px;', 'default' => '', 'type' => 'multi_select_countries'), array('title' => __('Default Customer Address', 'woocommerce'), 'id' => 'woocommerce_default_customer_address', 'desc_tip' => __('This option determines the customers default address (before they input their details).', 'woocommerce'), 'desc' => sprintf(__('Note: If you choose to Geolocate the user address, the %sMaxMind GeoLite Database%s will be periodically downloaded and stored in your wp-content directory.', 'woocommerce'), '<a href="http://dev.maxmind.com/geoip/legacy/geolite/">', '</a>'), 'default' => 'geolocation', 'type' => 'select', 'class' => 'wc-enhanced-select', 'options' => array('' => __('No address', 'woocommerce'), 'base' => __('Shop base address', 'woocommerce'), 'geolocation' => __('Geolocate address', 'woocommerce'))), array('title' => __('Store Notice', 'woocommerce'), 'desc' => __('Enable site-wide store notice text', 'woocommerce'), 'id' => 'woocommerce_demo_store', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Store Notice Text', 'woocommerce'), 'desc' => '', 'id' => 'woocommerce_demo_store_notice', 'default' => __('This is a demo store for testing purposes &mdash; no orders shall be fulfilled.', 'woocommerce'), 'type' => 'text', 'css' => 'min-width:300px;', 'autoload' => false), array('title' => __('API', 'woocommerce'), 'desc' => __('Enable the REST API', 'woocommerce'), 'id' => 'woocommerce_api_enabled', 'type' => 'checkbox', 'default' => 'yes'), array('type' => 'sectionend', 'id' => 'general_options'), array('title' => __('Currency Options', 'woocommerce'), 'type' => 'title', 'desc' => __('The following options affect how prices are displayed on the frontend.', 'woocommerce'), 'id' => 'pricing_options'), array('title' => __('Currency', 'woocommerce'), 'desc' => __('This controls what currency prices are listed at in the catalog and which currency gateways will take payments in.', 'woocommerce'), 'id' => 'woocommerce_currency', 'css' => 'min-width:350px;', 'default' => 'GBP', 'type' => 'select', 'class' => 'wc-enhanced-select', 'desc_tip' => true, 'options' => $currency_code_options), array('title' => __('Currency Position', 'woocommerce'), 'desc' => __('This controls the position of the currency symbol.', 'woocommerce'), 'id' => 'woocommerce_currency_pos', 'css' => 'min-width:350px;', 'class' => 'wc-enhanced-select', 'default' => 'left', 'type' => 'select', 'options' => array('left' => __('Left', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . '99.99)', 'right' => __('Right', 'woocommerce') . ' (99.99' . get_woocommerce_currency_symbol() . ')', 'left_space' => __('Left with space', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ' 99.99)', 'right_space' => __('Right with space', 'woocommerce') . ' (99.99 ' . get_woocommerce_currency_symbol() . ')'), 'desc_tip' => true), array('title' => __('Thousand Separator', 'woocommerce'), 'desc' => __('This sets the thousand separator of displayed prices.', 'woocommerce'), 'id' => 'woocommerce_price_thousand_sep', 'css' => 'width:50px;', 'default' => ',', 'type' => 'text', 'desc_tip' => true), array('title' => __('Decimal Separator', 'woocommerce'), 'desc' => __('This sets the decimal separator of displayed prices.', 'woocommerce'), 'id' => 'woocommerce_price_decimal_sep', 'css' => 'width:50px;', 'default' => '.', 'type' => 'text', 'desc_tip' => true), array('title' => __('Number of Decimals', 'woocommerce'), 'desc' => __('This sets the number of decimal points shown in displayed prices.', 'woocommerce'), 'id' => 'woocommerce_price_num_decimals', 'css' => 'width:50px;', 'default' => '2', 'desc_tip' => true, 'type' => 'number', 'custom_attributes' => array('min' => 0, 'step' => 1)), array('type' => 'sectionend', 'id' => 'pricing_options')));
     return apply_filters('woocommerce_get_settings_' . $this->id, $settings);
 }
开发者ID:abcode619,项目名称:wpstuff,代码行数:14,代码来源:class-wc-settings-general.php

示例2: get_settings

 /**
  * Get settings array.
  *
  * @return array
  */
 public function get_settings()
 {
     $currency_code_options = get_woocommerce_currencies();
     foreach ($currency_code_options as $code => $name) {
         $currency_code_options[$code] = $name . ' (' . get_woocommerce_currency_symbol($code) . ')';
     }
     $settings = apply_filters('woocommerce_general_settings', array(array('title' => __('General Options', 'woocommerce'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'), array('title' => __('Base Location', 'woocommerce'), 'desc' => __('This is the base location for your business. Tax rates will be based on this country.', 'woocommerce'), 'id' => 'woocommerce_default_country', 'css' => 'min-width:350px;', 'default' => 'GB', 'type' => 'single_select_country', 'desc_tip' => true), array('title' => __('Selling Location(s)', 'woocommerce'), 'desc' => __('This option lets you limit which countries you are willing to sell to.', 'woocommerce'), 'id' => 'woocommerce_allowed_countries', 'default' => 'all', 'type' => 'select', 'class' => 'wc-enhanced-select', 'css' => 'min-width: 350px;', 'desc_tip' => true, 'options' => array('all' => __('Sell to all countries', 'woocommerce'), 'specific' => __('Sell to specific countries only', 'woocommerce'))), array('title' => __('Sell to Specific Countries', 'woocommerce'), 'desc' => '', 'id' => 'woocommerce_specific_allowed_countries', 'css' => 'min-width: 350px;', 'default' => '', 'type' => 'multi_select_countries'), array('title' => __('Shipping Location(s)', 'woocommerce'), 'desc' => __('Choose which countries you want to ship to, or choose to ship to all locations you sell to.', 'woocommerce'), 'id' => 'woocommerce_ship_to_countries', 'default' => '', 'type' => 'select', 'class' => 'wc-enhanced-select', 'desc_tip' => true, 'options' => array('' => __('Ship to all countries you sell to', 'woocommerce'), 'all' => __('Ship to all countries', 'woocommerce'), 'specific' => __('Ship to specific countries only', 'woocommerce'), 'disabled' => __('Disable shipping &amp; shipping calculations', 'woocommerce'))), array('title' => __('Ship to Specific Countries', 'woocommerce'), 'desc' => '', 'id' => 'woocommerce_specific_ship_to_countries', 'css' => '', 'default' => '', 'type' => 'multi_select_countries'), array('title' => __('Default Customer Location', 'woocommerce'), 'id' => 'woocommerce_default_customer_address', 'desc_tip' => __('This option determines a customers default location. The MaxMind GeoLite Database will be periodically downloaded to your wp-content directory if using geolocation.', 'woocommerce'), 'default' => 'geolocation', 'type' => 'select', 'class' => 'wc-enhanced-select', 'options' => array('' => __('No location by default', 'woocommerce'), 'base' => __('Shop base address', 'woocommerce'), 'geolocation' => __('Geolocate', 'woocommerce'), 'geolocation_ajax' => __('Geolocate (with page caching support)', 'woocommerce'))), array('title' => __('Enable Taxes', 'woocommerce'), 'desc' => __('Enable taxes and tax calculations', 'woocommerce'), 'id' => 'woocommerce_calc_taxes', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Store Notice', 'woocommerce'), 'desc' => __('Enable site-wide store notice text', 'woocommerce'), 'id' => 'woocommerce_demo_store', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Store Notice Text', 'woocommerce'), 'desc' => '', 'id' => 'woocommerce_demo_store_notice', 'default' => __('This is a demo store for testing purposes &mdash; no orders shall be fulfilled.', 'woocommerce'), 'type' => 'textarea', 'css' => 'width:350px; height: 65px;', 'autoload' => false), array('type' => 'sectionend', 'id' => 'general_options'), array('title' => __('Currency Options', 'woocommerce'), 'type' => 'title', 'desc' => __('The following options affect how prices are displayed on the frontend.', 'woocommerce'), 'id' => 'pricing_options'), array('title' => __('Currency', 'woocommerce'), 'desc' => __('This controls what currency prices are listed at in the catalog and which currency gateways will take payments in.', 'woocommerce'), 'id' => 'woocommerce_currency', 'css' => 'min-width:350px;', 'default' => 'GBP', 'type' => 'select', 'class' => 'wc-enhanced-select', 'desc_tip' => true, 'options' => $currency_code_options), array('title' => __('Currency Position', 'woocommerce'), 'desc' => __('This controls the position of the currency symbol.', 'woocommerce'), 'id' => 'woocommerce_currency_pos', 'css' => 'min-width:350px;', 'class' => 'wc-enhanced-select', 'default' => 'left', 'type' => 'select', 'options' => array('left' => __('Left', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . '99.99)', 'right' => __('Right', 'woocommerce') . ' (99.99' . get_woocommerce_currency_symbol() . ')', 'left_space' => __('Left with space', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ' 99.99)', 'right_space' => __('Right with space', 'woocommerce') . ' (99.99 ' . get_woocommerce_currency_symbol() . ')'), 'desc_tip' => true), array('title' => __('Thousand Separator', 'woocommerce'), 'desc' => __('This sets the thousand separator of displayed prices.', 'woocommerce'), 'id' => 'woocommerce_price_thousand_sep', 'css' => 'width:50px;', 'default' => ',', 'type' => 'text', 'desc_tip' => true), array('title' => __('Decimal Separator', 'woocommerce'), 'desc' => __('This sets the decimal separator of displayed prices.', 'woocommerce'), 'id' => 'woocommerce_price_decimal_sep', 'css' => 'width:50px;', 'default' => '.', 'type' => 'text', 'desc_tip' => true), array('title' => __('Number of Decimals', 'woocommerce'), 'desc' => __('This sets the number of decimal points shown in displayed prices.', 'woocommerce'), 'id' => 'woocommerce_price_num_decimals', 'css' => 'width:50px;', 'default' => '2', 'desc_tip' => true, 'type' => 'number', 'custom_attributes' => array('min' => 0, 'step' => 1)), array('type' => 'sectionend', 'id' => 'pricing_options')));
     return apply_filters('woocommerce_get_settings_' . $this->id, $settings);
 }
开发者ID:unfulvio,项目名称:woocommerce,代码行数:14,代码来源:class-wc-settings-general.php

示例3: get_settings

 /**
  * Get settings array
  *
  * @return array
  */
 public function get_settings()
 {
     $currency_code_options = get_woocommerce_currencies();
     foreach ($currency_code_options as $code => $name) {
         $currency_code_options[$code] = $name . ' (' . get_woocommerce_currency_symbol($code) . ')';
     }
     return apply_filters('woocommerce_general_settings', array(array('title' => __('General Options', 'woocommerce'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'), array('title' => __('Base Location', 'woocommerce'), 'desc' => __('This is the base location for your business. Tax rates will be based on this country.', 'woocommerce'), 'id' => 'woocommerce_default_country', 'css' => 'min-width:350px;', 'default' => 'GB', 'type' => 'single_select_country', 'desc_tip' => true), array('title' => __('Selling Location(s)', 'woocommerce'), 'desc' => __('This option lets you limit which countries you are willing to sell to.', 'woocommerce'), 'id' => 'woocommerce_allowed_countries', 'default' => 'all', 'type' => 'select', 'class' => 'chosen_select', 'css' => 'min-width: 350px;', 'desc_tip' => true, 'options' => array('all' => __('Sell to all countries', 'woocommerce'), 'specific' => __('Sell to specific countries only', 'woocommerce'))), array('title' => __('Specific Countries', 'woocommerce'), 'desc' => '', 'id' => 'woocommerce_specific_allowed_countries', 'css' => 'min-width: 350px;', 'default' => '', 'type' => 'multi_select_countries'), array('title' => __('Store Notice', 'woocommerce'), 'desc' => __('Enable site-wide store notice text', 'woocommerce'), 'id' => 'woocommerce_demo_store', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Store Notice Text', 'woocommerce'), 'desc' => '', 'id' => 'woocommerce_demo_store_notice', 'default' => __('This is a demo store for testing purposes &mdash; no orders shall be fulfilled.', 'woocommerce'), 'type' => 'text', 'css' => 'min-width:300px;', 'autoload' => false), array('title' => __('API', 'woocommerce'), 'desc' => __('Enable the REST API', 'woocommerce'), 'id' => 'woocommerce_api_enabled', 'type' => 'checkbox', 'default' => 'yes'), array('type' => 'sectionend', 'id' => 'general_options'), array('title' => __('Currency Options', 'woocommerce'), 'type' => 'title', 'desc' => __('The following options affect how prices are displayed on the frontend.', 'woocommerce'), 'id' => 'pricing_options'), array('title' => __('Currency', 'woocommerce'), 'desc' => __('This controls what currency prices are listed at in the catalog and which currency gateways will take payments in.', 'woocommerce'), 'id' => 'woocommerce_currency', 'css' => 'min-width:350px;', 'default' => 'GBP', 'type' => 'select', 'class' => 'chosen_select', 'desc_tip' => true, 'options' => $currency_code_options), array('title' => __('Currency Position', 'woocommerce'), 'desc' => __('This controls the position of the currency symbol.', 'woocommerce'), 'id' => 'woocommerce_currency_pos', 'css' => 'min-width:350px;', 'class' => 'chosen_select', 'default' => 'left', 'type' => 'select', 'options' => array('left' => __('Left', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . '99.99)', 'right' => __('Right', 'woocommerce') . ' (99.99' . get_woocommerce_currency_symbol() . ')', 'left_space' => __('Left with space', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ' 99.99)', 'right_space' => __('Right with space', 'woocommerce') . ' (99.99 ' . get_woocommerce_currency_symbol() . ')'), 'desc_tip' => true), array('title' => __('Thousand Separator', 'woocommerce'), 'desc' => __('This sets the thousand separator of displayed prices.', 'woocommerce'), 'id' => 'woocommerce_price_thousand_sep', 'css' => 'width:50px;', 'default' => ',', 'type' => 'text', 'desc_tip' => true), array('title' => __('Decimal Separator', 'woocommerce'), 'desc' => __('This sets the decimal separator of displayed prices.', 'woocommerce'), 'id' => 'woocommerce_price_decimal_sep', 'css' => 'width:50px;', 'default' => '.', 'type' => 'text', 'desc_tip' => true), array('title' => __('Number of Decimals', 'woocommerce'), 'desc' => __('This sets the number of decimal points shown in displayed prices.', 'woocommerce'), 'id' => 'woocommerce_price_num_decimals', 'css' => 'width:50px;', 'default' => '2', 'desc_tip' => true, 'type' => 'number', 'custom_attributes' => array('min' => 0, 'step' => 1)), array('type' => 'sectionend', 'id' => 'pricing_options'), array('title' => __('Styles and Scripts', 'woocommerce'), 'type' => 'title', 'id' => 'script_styling_options'), array('type' => 'frontend_styles'), array('title' => __('Scripts', 'woocommerce'), 'desc' => __('Enable Lightbox', 'woocommerce'), 'id' => 'woocommerce_enable_lightbox', 'default' => 'yes', 'desc_tip' => __('Include WooCommerce\'s lightbox. Product gallery images will open in a lightbox.', 'woocommerce'), 'type' => 'checkbox', 'checkboxgroup' => 'start'), array('desc' => __('Enable enhanced country select boxes', 'woocommerce'), 'id' => 'woocommerce_enable_chosen', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'end', 'desc_tip' => __('This will enable a script allowing the country fields to be searchable.', 'woocommerce'), 'autoload' => false), array('type' => 'sectionend', 'id' => 'script_styling_options')));
     // End general settings
 }
开发者ID:joshquila,项目名称:demo2-youse,代码行数:14,代码来源:class-wc-settings-general.php

示例4: test_get_woocommerce_currency_symbol

 /**
  * Test get_woocommerce_currency_symbol().
  *
  * @since 2.2
  */
 public function test_get_woocommerce_currency_symbol()
 {
     // default currency
     $this->assertEquals('&pound;', get_woocommerce_currency_symbol());
     // given specific currency
     $this->assertEquals('&#36;', get_woocommerce_currency_symbol('USD'));
     // each case
     foreach (array_keys(get_woocommerce_currencies()) as $currency_code) {
         $this->assertInternalType('string', get_woocommerce_currency_symbol($currency_code));
     }
 }
开发者ID:pelmered,项目名称:woocommerce,代码行数:16,代码来源:core-functions.php

示例5: get_currency_key_val

 private function get_currency_key_val()
 {
     $wc_currencies = get_woocommerce_currencies();
     $enabled_currency = $this->get_enabled_currencies();
     $return_currency = array();
     foreach ($enabled_currency as $curr) {
         if (isset($wc_currencies[$curr])) {
             $symbol = get_woocommerce_currency_symbol($curr);
             $symbol = !empty($symbol) ? ' [ ' . $symbol . ' ] ' : '';
             $return_currency[$curr] = $wc_currencies[$curr] . $symbol;
         }
     }
     return $return_currency;
 }
开发者ID:aelia-co,项目名称:WooCommerce-Role-Based-Price,代码行数:14,代码来源:class-aelia-currencyswitcher-integration.php

示例6: currency_conversion_js

 function currency_conversion_js()
 {
     if (is_admin()) {
         return;
     }
     // Scripts
     wp_register_script('moneyjs', get_template_directory_uri() . '/lib/plugins/currency-converter/assets/js/money.min.js', 'jquery', Null, true);
     wp_register_script('accountingjs', get_template_directory_uri() . '/lib/plugins/currency-converter/assets/js/accounting.min.js', 'jquery', Null, true);
     wp_enqueue_script('wc_currency_converter', get_template_directory_uri() . '/lib/plugins/currency-converter/assets/js/conversion.min.js', array('jquery', 'moneyjs', 'accountingjs', 'jquery-cookie'), Null, true);
     $symbols = array();
     if (function_exists('get_woocommerce_currencies')) {
         $codes = get_woocommerce_currencies();
         foreach ($codes as $code => $name) {
             $symbols[$code] = get_woocommerce_currency_symbol($code);
         }
     }
     $zero_replace = '.';
     for ($i = 0; $i < absint(get_option('woocommerce_price_num_decimals')); $i++) {
         $zero_replace .= '0';
     }
     $wc_currency_converter_params = array('current_currency' => isset($_COOKIE['woocommerce_current_currency']) ? $_COOKIE['woocommerce_current_currency'] : '', 'currencies' => json_encode($symbols), 'rates' => $this->rates, 'base' => $this->base, 'currency' => get_option('woocommerce_currency'), 'currency_pos' => get_option('woocommerce_currency_pos'), 'num_decimals' => absint(get_option('woocommerce_price_num_decimals')), 'trim_zeros' => get_option('woocommerce_price_trim_zeros') == 'yes' ? true : false, 'thousand_sep' => get_option('woocommerce_price_thousand_sep'), 'decimal_sep' => get_option('woocommerce_price_decimal_sep'), 'i18n_oprice' => __('Original price:', 'wc_currency_converter'), 'zero_replace' => $zero_replace);
     wp_localize_script('wc_currency_converter', 'wc_currency_converter_params', apply_filters('wc_currency_converter_params', $wc_currency_converter_params));
 }
开发者ID:junibrosas,项目名称:shoppingyourway,代码行数:23,代码来源:currency-converter.php

示例7: get_currencies

 /**
  * Gets list of WooCommerce currencies
  *
  * @return array
  */
 protected function get_currencies()
 {
     if (null === $this->currencies) {
         $this->currencies = array();
         foreach (get_woocommerce_currencies() as $currencyCode => $currencyName) {
             $this->currencies[$currencyCode] = "{$currencyName} ({$currencyCode})";
         }
     }
     return $this->currencies;
 }
开发者ID:LUUP-payments,项目名称:woocommerce-luup,代码行数:15,代码来源:class-wc-luup-abstract.php

示例8: currency_switcher

 function currency_switcher($args = array())
 {
     global $sitepress, $woocommerce_wpml;
     if (is_page(get_option('woocommerce_myaccount_page_id'))) {
         return '';
     }
     $settings = $woocommerce_wpml->get_settings();
     if (!isset($args['switcher_style'])) {
         $args['switcher_style'] = isset($settings['currency_switcher_style']) ? $settings['currency_switcher_style'] : 'dropdown';
     }
     if (!isset($args['orientation'])) {
         $args['orientation'] = isset($settings['wcml_curr_sel_orientation']) ? $settings['wcml_curr_sel_orientation'] : 'vertical';
     }
     if (!isset($args['format'])) {
         $args['format'] = isset($settings['wcml_curr_template']) && $settings['wcml_curr_template'] != '' ? $settings['wcml_curr_template'] : '%name% (%symbol%) - %code%';
     }
     $wc_currencies = get_woocommerce_currencies();
     if (!isset($settings['currencies_order'])) {
         $currencies = $this->get_currency_codes();
     } else {
         $currencies = $settings['currencies_order'];
     }
     if ($args['switcher_style'] == 'dropdown') {
         echo '<select class="wcml_currency_switcher">';
     } else {
         $args['orientation'] = $args['orientation'] == 'horizontal' ? 'curr_list_horizontal' : 'curr_list_vertical';
         echo '<ul class="wcml_currency_switcher ' . $args['orientation'] . '">';
     }
     foreach ($currencies as $currency) {
         if ($woocommerce_wpml->settings['currency_options'][$currency]['languages'][$sitepress->get_current_language()] == 1) {
             $selected = $currency == $this->get_client_currency() ? ' selected="selected"' : '';
             $currency_format = preg_replace(array('#%name%#', '#%symbol%#', '#%code%#'), array($wc_currencies[$currency], get_woocommerce_currency_symbol($currency), $currency), $args['format']);
             if ($args['switcher_style'] == 'dropdown') {
                 echo '<option value="' . $currency . '"' . $selected . '>' . $currency_format . '</option>';
             } else {
                 echo '<li rel="' . $currency . '" >' . $currency_format . '</li>';
             }
         }
     }
     if ($args['switcher_style'] == 'dropdown') {
         echo '</select>';
     } else {
         echo '</ul>';
     }
 }
开发者ID:StudioCreate,项目名称:Uncle-Hummer-WordPress-Theme,代码行数:45,代码来源:multi-currency-support.class.php

示例9: update

 /**
  * Update an order.
  *
  * ## OPTIONS
  *
  * <id>
  * : Product ID
  *
  * [--<field>=<value>]
  * : One or more fields to update.
  *
  * ## AVAILABLE FIELDS
  *
  * For available fields, see: wp wc order create --help
  *
  * ## EXAMPLES
  *
  *    wp wc order update 123 --status=completed
  *
  * @todo  gedex
  * @since 2.5.0
  */
 public function update($args, $assoc_args)
 {
     try {
         $id = $args[0];
         $data = apply_filters('woocommerce_cli_update_order_data', $this->unflatten_array($assoc_args));
         $update_totals = false;
         $order = wc_get_order($id);
         if (empty($order)) {
             throw new WC_CLI_Exception('woocommerce_cli_invalid_order_id', __('Order ID is invalid', 'woocommerce'));
         }
         $order_args = array('order_id' => $order->id);
         // customer note
         if (isset($data['note'])) {
             $order_args['customer_note'] = $data['note'];
         }
         // order status
         if (!empty($data['status'])) {
             $order->update_status($data['status'], isset($data['status_note']) ? $data['status_note'] : '');
         }
         // customer ID
         if (isset($data['customer_id']) && $data['customer_id'] != $order->get_user_id()) {
             // make sure customer exists
             if (false === get_user_by('id', $data['customer_id'])) {
                 throw new WC_CLI_Exception('woocommerce_cli_invalid_customer_id', __('Customer ID is invalid', 'woocommerce'));
             }
             update_post_meta($order->id, '_customer_user', $data['customer_id']);
         }
         // billing/shipping address
         $this->set_order_addresses($order, $data);
         $lines = array('line_item' => 'line_items', 'shipping' => 'shipping_lines', 'fee' => 'fee_lines', 'coupon' => 'coupon_lines');
         foreach ($lines as $line_type => $line) {
             if (isset($data[$line]) && is_array($data[$line])) {
                 $update_totals = true;
                 foreach ($data[$line] as $item) {
                     // item ID is always required
                     if (!array_key_exists('id', $item)) {
                         throw new WC_CLI_Exception('woocommerce_invalid_item_id', __('Order item ID is required', 'woocommerce'));
                     }
                     // create item
                     if (is_null($item['id'])) {
                         $this->set_item($order, $line_type, $item, 'create');
                     } elseif ($this->item_is_null($item)) {
                         // delete item
                         wc_delete_order_item($item['id']);
                     } else {
                         // update item
                         $this->set_item($order, $line_type, $item, 'update');
                     }
                 }
             }
         }
         // payment method (and payment_complete() if `paid` == true and order needs payment)
         if (isset($data['payment_details']) && is_array($data['payment_details'])) {
             // method ID
             if (isset($data['payment_details']['method_id'])) {
                 update_post_meta($order->id, '_payment_method', $data['payment_details']['method_id']);
             }
             // method title
             if (isset($data['payment_details']['method_title'])) {
                 update_post_meta($order->id, '_payment_method_title', $data['payment_details']['method_title']);
             }
             // mark as paid if set
             if ($order->needs_payment() && isset($data['payment_details']['paid']) && $this->is_true($data['payment_details']['paid'])) {
                 $order->payment_complete(isset($data['payment_details']['transaction_id']) ? $data['payment_details']['transaction_id'] : '');
             }
         }
         // set order currency
         if (isset($data['currency'])) {
             if (!array_key_exists($data['currency'], get_woocommerce_currencies())) {
                 throw new WC_CLI_Exception('woocommerce_invalid_order_currency', __('Provided order currency is invalid', 'woocommerce'));
             }
             update_post_meta($order->id, '_order_currency', $data['currency']);
         }
         // set order number
         if (isset($data['order_number'])) {
             update_post_meta($order->id, '_order_number', $data['order_number']);
         }
         // if items have changed, recalculate order totals
//.........这里部分代码省略.........
开发者ID:jgcopple,项目名称:drgaryschwantz,代码行数:101,代码来源:class-wc-cli-order.php

示例10: init_form_fields

 /**
  * Initialise Gateway Settings Form Fields
  */
 function init_form_fields()
 {
     $currency_code_options = get_woocommerce_currencies();
     unset($currency_code_options['MXN']);
     foreach ($currency_code_options as $code => $name) {
         $currency_code_options[$code] = $name . ' (' . get_woocommerce_currency_symbol($code) . ')';
     }
     $this->form_fields = array('enabled' => array('title' => __('Enable/Disable', 'pagofacil'), 'type' => 'checkbox', 'label' => __('Enable Pago Facil Gateway', 'pagofacil'), 'default' => 'yes'), 'title' => array('title' => __('Title', 'pagofacil'), 'type' => 'text', 'description' => __('This controls the title which the user sees during checkout.', 'pagofacil'), 'default' => __('Credit Card', 'pagofacil')), 'showdesc' => array('title' => __('Show Description', 'pagofacil'), 'type' => 'checkbox', 'label' => __('To Show Description', 'pagofacil'), 'default' => 'no'), 'description' => array('title' => __('Description', 'pagofacil'), 'type' => 'textarea', 'description' => __('This controls the description which the user sees during checkout.', 'pagofacil'), 'default' => __("Enter your Credit Card Details below.", 'pagofacil')), 'sucursal' => array('title' => __('Sucursal', 'pagofacil'), 'type' => 'text', 'description' => __('Please enter your Sucursal; this is needed in order to take payment.', 'pagofacil'), 'default' => ''), 'usuario' => array('title' => __('Usuario', 'pagofacil'), 'type' => 'text', 'description' => __('Please enter your Usuario; this is needed in order to take payment.', 'pagofacil'), 'default' => ''), 'sendemail' => array('title' => __('Enable PagoFacil Notifiaction Emails', 'pagofacil'), 'type' => 'checkbox', 'label' => __('Allow PagoFacil to Send Notification Emails.', 'pagofacil'), 'default' => 'no'), 'enabledivisa' => array('title' => __('Enable Divisa', 'pagofacil'), 'type' => 'checkbox', 'label' => __('Enable sending the Currency Code to Pago Facil via divisa parameter.', 'pagofacil'), 'default' => 'no'), 'divisa' => array('title' => __('Divisa', 'pagofacil'), 'desc' => __("This controls what currency that is being sent in divisa parameter to Pago Facil.", 'woocommerce'), 'default' => 'USD', 'type' => 'select', 'options' => $currency_code_options), 'testmode' => array('title' => __('Sandbox', 'pagofacil'), 'type' => 'checkbox', 'label' => __('Enable Sandbox', 'pagofacil'), 'default' => 'no'), 'cardtypes' => array('title' => __('Accepted Card Logos', 'pagofacil'), 'type' => 'multiselect', 'description' => __('Select which card types you accept to display the logos for on your checkout page.  This is purely cosmetic and optional, and will have no impact on the cards actually accepted by your account.', 'pagofacil'), 'default' => '', 'options' => $this->card_type_options), 'msi' => array('title' => __('Installments', 'pagofacil'), 'label' => __('Enable Installments', 'pagofacil'), 'type' => 'checkbox', 'default' => 'no'), 'msioptions' => array('title' => __('Installments Options', 'pagofacil'), 'label' => __('Installments Options', 'pagofacil'), 'type' => 'multiselect', 'default' => array('all'), 'options' => $this->msi_options));
 }
开发者ID:javolero,项目名称:WooComercePlugin,代码行数:12,代码来源:gateway-pagofacil-direct.php

示例11: esc_attr

                <input type='submit' name="wcml_file_path_options_table" value='<?php 
esc_attr(_e('Save', 'woocommerce-multilingual'));
?>
' class='button-secondary' />
            </p>
        </form>

    </div> <!-- .wcml-section-content -->

</div> <!-- .wcml-section -->


<div class="wcml-section">

<?php 
$wc_currencies = get_woocommerce_currencies();
$wc_currency = get_option('woocommerce_currency');
$active_languages = $sitepress->get_active_languages();
switch (get_option('woocommerce_currency_pos')) {
    case 'left':
        $positioned_price = sprintf('%s99.99', get_woocommerce_currency_symbol($wc_currency));
        break;
    case 'right':
        $positioned_price = sprintf('99.99%s', get_woocommerce_currency_symbol($wc_currency));
        break;
    case 'left_space':
        $positioned_price = sprintf('%s 99.99', get_woocommerce_currency_symbol($wc_currency));
        break;
    case 'right_space':
        $positioned_price = sprintf('99.99 %s', get_woocommerce_currency_symbol($wc_currency));
        break;
开发者ID:helgatheviking,项目名称:woocommerce-multilingual,代码行数:31,代码来源:settings.php

示例12: section_settings

        /**
         * Output section.
         *
         * @access public
         * @return void
         */
        public function section_settings($not_available_countries, $group = array())
        {
            if (!isset($group['name'])) {
                $group['name'] = '';
            }
            if (!isset($group['countries'])) {
                $group['countries'] = array();
            }
            if (!isset($group['currency'])) {
                $group['currency'] = get_option('woocommerce_currency');
            }
            if (!isset($group['empty_price_method'])) {
                $group['empty_price_method'] = '';
            }
            if (!isset($group['exchange_rate'])) {
                $group['exchange_rate'] = '1';
            }
            ?>
		<h3><?php 
            echo $group['name'] ? esc_html($group['name']) : __('Add Group', 'wc-price-based-country');
            ?>
</h3>
		<table class="form-table">

			<!-- Region name -->
			<tr valign="top">
				<th scope="row" class="titledesc">
					<label for="group_name"><?php 
            _e('Region Name', 'wc-price-based-country');
            ?>
</label>
					<?php 
            //echo $tip;
            ?>
				</th>
                <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) {
//.........这里部分代码省略.........
开发者ID:raminabsari,项目名称:phonicsschool,代码行数:101,代码来源:class-wc-settings-price-based-country.php

示例13: porto_mobile_currency_switcher

function porto_mobile_currency_switcher()
{
    global $porto_settings;
    ob_start();
    if (!$porto_settings['wcml-switcher'] && has_nav_menu('currency_switcher')) {
        wp_nav_menu(array('theme_location' => 'currency_switcher', 'container' => '', 'menu_class' => 'currency-switcher accordion-menu show-arrow', 'before' => '', 'after' => '', 'depth' => 2, 'link_before' => '', 'link_after' => '', 'fallback_cb' => false, 'walker' => new porto_accordion_navwalker()));
    }
    if ($porto_settings['wcml-switcher'] && class_exists('WCML_Multi_Currency_Support')) {
        global $sitepress, $woocommerce_wpml;
        if (!is_page(get_option('woocommerce_myaccount_page_id'))) {
            $settings = $woocommerce_wpml->get_settings();
            $format = '%symbol% %code%';
            $wc_currencies = get_woocommerce_currencies();
            if (!isset($settings['currencies_order'])) {
                $currencies = $woocommerce_wpml->multi_currency_support->get_currency_codes();
            } else {
                $currencies = $settings['currencies_order'];
            }
            $active_c = '';
            $other_c = '';
            foreach ($currencies as $currency) {
                if ($woocommerce_wpml->settings['currency_options'][$currency]['languages'][$sitepress->get_current_language()] == 1) {
                    $selected = $currency == $woocommerce_wpml->multi_currency_support->get_client_currency() ? ' selected="selected"' : '';
                    $currency_format = preg_replace(array('#%name%#', '#%symbol%#', '#%code%#'), array($wc_currencies[$currency], get_woocommerce_currency_symbol($currency), $currency), $format);
                    if ($selected) {
                        $active_c .= $currency_format;
                    } else {
                        $other_c .= '<li rel="' . $currency . '" class="menu-item"><h5>' . $currency_format . '</h5></li>';
                    }
                }
            }
            ?>
            <ul id="menu-currency-switcher" class="currency-switcher accordion-menu show-arrow">
                <li class="menu-item<?php 
            if ($other_c) {
                echo ' has-sub';
            }
            ?>
 narrow">
                    <h5><?php 
            echo $active_c;
            ?>
</h5>
                    <?php 
            if ($other_c) {
                ?>
                        <span class="arrow"></span>
                        <ul class="sub-menu wcml-switcher">
                            <?php 
                echo $other_c;
                ?>
                        </ul>
                    <?php 
            }
            ?>
                </li>
            </ul>
        <?php 
        }
    }
    return apply_filters('porto_mobile_currency_switcher', str_replace('&nbsp;', '', ob_get_clean()));
}
开发者ID:booklein,项目名称:wpbookle,代码行数:62,代码来源:layout.php

示例14: dashboard_currency_dropdown

    function dashboard_currency_dropdown()
    {
        global $woocommerce_wpml, $sitepress;
        $current_dashboard_currency = $this->get_cookie_dashboard_currency();
        $wc_currencies = get_woocommerce_currencies();
        $order_currencies = $this->get_orders_currencies();
        ?>
            <select id="dropdown_dashboard_currency" style="display: none; margin : 10px; ">

                <?php 
        foreach ($order_currencies as $currency => $count) {
            ?>

                    <option value="<?php 
            echo $currency;
            ?>
" <?php 
            echo $current_dashboard_currency == $currency ? 'selected="selected"' : '';
            ?>
><?php 
            echo $wc_currencies[$currency];
            ?>
</option>

                <?php 
        }
        ?>

            </select>
        <?php 
        wc_enqueue_js("\n\n            jQuery(document).ready(function(){\n\n                var dashboard_dropdown = jQuery('#dropdown_dashboard_currency').clone();\n                jQuery('#dropdown_dashboard_currency').remove();\n                dashboard_dropdown.insertBefore('.sales-this-month a').show();\n                jQuery('#woocommerce_dashboard_status .wc_status_list li').css('display','table');\n\n            });\n\n            jQuery(document).on('change', '#dropdown_dashboard_currency', function(){\n               jQuery.ajax({\n                    url: ajaxurl,\n                    type: 'post',\n                    data: {action: 'wcml_dashboard_set_currency', currency: jQuery('#dropdown_dashboard_currency').val()},\n                    success: function(){location.reload();}\n                })\n            });\n        ");
    }
开发者ID:sergioblanco86,项目名称:git-gitlab.com-kinivo-kinivo.com,代码行数:32,代码来源:multi-currency.class.php

示例15: set_currency

 /**
  * Set order_currency
  * @param string $value
  * @throws WC_Data_Exception
  */
 public function set_currency($value)
 {
     if ($value && !in_array($value, array_keys(get_woocommerce_currencies()))) {
         $this->error('order_invalid_currency', __('Invalid currency code', 'woocommerce'));
     }
     $this->data['currency'] = $value ? $value : get_woocommerce_currency();
 }
开发者ID:tlovett1,项目名称:woocommerce,代码行数:12,代码来源:abstract-wc-order.php


注:本文中的get_woocommerce_currencies函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。