コード例 #1
1
 /**
  * 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);
 }
コード例 #2
0
 /**
  * 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);
 }
コード例 #3
0
 /**
  * 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
 }
コード例 #4
0
 /**
  * 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));
     }
 }
 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;
 }
コード例 #6
0
 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));
 }
コード例 #7
0
 /**
  * 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;
 }
 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>';
     }
 }
コード例 #9
0
 /**
  * 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
         if ($update_totals) {
             $order->calculate_totals();
         }
         // update order meta
         if (isset($data['order_meta']) && is_array($data['order_meta'])) {
             $this->set_order_meta($order->id, $data['order_meta']);
         }
         // update the order post to set customer note/modified date
         wc_update_order($order_args);
         wc_delete_shop_order_transients($order->id);
         do_action('woocommerce_cli_update_order', $order->id, $data);
         WP_CLI::success("Updated order {$order->id}.");
     } catch (WC_CLI_Exception $e) {
         WP_CLI::error($e->getMessage());
     }
 }
コード例 #10
0
 /**
  * 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));
 }
コード例 #11
0
                <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;
        /**
         * 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) {
                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 
        }
コード例 #13
0
ファイル: layout.php プロジェクト: booklein/wpbookle
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()));
}
    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        ");
    }
コード例 #15
0
 /**
  * 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();
 }
コード例 #16
0
 /**
  * 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 Cash Gateway', 'pagofacil'), 'default' => 'yes'), 'title' => array('title' => __('Title', 'pagofacil'), 'type' => 'text', 'description' => __('This controls the title which the user sees during checkout.', 'pagofacil'), 'default' => __('Cash', '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 Cash Details below.", 'pagofacil')), 'image' => array('title' => __('Imagen', 'pagofacil'), 'type' => 'text', 'description' => __('Esta imagen aparecerá durante el checkout. Esto es puramente estetico', 'pagofacil'), 'default' => plugins_url('logo_pagofacil.png', __FILE__)), 'sucursal' => array('title' => __('Sucursal pruducción', 'pagofacil'), 'type' => 'text', 'description' => __('Please enter your Sucursal; this is needed in order to take payment.', 'pagofacil'), 'default' => ''), 'usuario' => array('title' => __('Usuario pruducción', 'pagofacil'), 'type' => 'text', 'description' => __('Please enter your Usuario; this is needed in order to take payment.', 'pagofacil'), 'default' => ''), 'webhook' => array('title' => __('Notificaciones Automáticas', 'woocommerce'), 'type' => 'text', 'description' => __('Si requiere notificaciones automáticas, agrege esta URL dentro de la sección Webhook del panel de control de pagofacíl', 'woocommerce'), 'default' => plugins_url('webhook.php', __FILE__)), 'concept' => array('title' => __('Concepto', 'pagofacil'), 'type' => 'text', 'description' => __('Concepto que aparecera en la referencia de las tiendas de conveniencia.', 'pagofacil'), 'default' => get_bloginfo('name')), 'instructions' => array('title' => __('Instructions to pay', 'pagofacil'), 'type' => 'text', 'description' => __('Instrucciones que aparecera en la thank you page.', 'pagofacil'), 'default' => __('Las instrucciones para realizar tu pago han sido enviadas a tu correo electrónico.', 'pagofacil')), 'testmode' => array('title' => __('Sandbox', 'pagofacil'), 'type' => 'checkbox', 'label' => __('Enable Sandbox', 'pagofacil'), 'default' => 'no'), 'sucursal_test' => array('title' => __('Sucursal STAGE', 'pagofacil'), 'type' => 'text', 'description' => __('Please enter your Sucursal; this is needed in order to take payment.', 'pagofacil'), 'default' => ''), 'usuario_test' => array('title' => __('Usuario STAGE', 'pagofacil'), 'type' => 'text', 'description' => __('Please enter your Usuario; this is needed in order to take payment.', 'pagofacil'), 'default' => ''));
 }
コード例 #17
0
    function ts_woocommerce_multilingual_currency_switcher()
    {
        if (class_exists('woocommerce_wpml') && class_exists('WooCommerce') && class_exists('SitePress')) {
            global $sitepress, $woocommerce_wpml;
            if (!isset($woocommerce_wpml->multi_currency_support)) {
                return;
            }
            $settings = $woocommerce_wpml->get_settings();
            $format = isset($settings['wcml_curr_template']) && $settings['wcml_curr_template'] != '' ? $settings['wcml_curr_template'] : '%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'];
            }
            $selected_html = '';
            foreach ($currencies as $currency) {
                if ($woocommerce_wpml->settings['currency_options'][$currency]['languages'][$sitepress->get_current_language()] == 1) {
                    $currency_format = preg_replace(array('#%name%#', '#%symbol%#', '#%code%#'), array($wc_currencies[$currency], get_woocommerce_currency_symbol($currency), $currency), $format);
                    if ($currency == $woocommerce_wpml->multi_currency_support->get_client_currency()) {
                        $selected_html = '<a href="javascript: void(0)" class="wcml_selected_currency">' . $currency_format . '</a>';
                        break;
                    }
                }
            }
            echo '<div class="wcml_currency_switcher">';
            echo $selected_html;
            echo '<ul>';
            foreach ($currencies as $currency) {
                if ($woocommerce_wpml->settings['currency_options'][$currency]['languages'][$sitepress->get_current_language()] == 1) {
                    $currency_format = preg_replace(array('#%name%#', '#%symbol%#', '#%code%#'), array($wc_currencies[$currency], get_woocommerce_currency_symbol($currency), $currency), $format);
                    echo '<li rel="' . $currency . '" >' . $currency_format . '</li>';
                }
            }
            echo '</ul>';
            echo '</div>';
        } else {
            /* Demo html */
            ?>
			<div class="wcml_currency_switcher">
				<a href="javascript: void(0)" class="wcml_selected_currency">USD</a>
				<ul>
					<li rel="USD">USD</li>
					<li rel="EUR">EUR</li>
					<li rel="AUD">AUD</li>
				</ul>
			</div>
			<?php 
        }
    }
コード例 #18
0
ファイル: functions.php プロジェクト: Qualitair/ecommerce
 function media_center_get_currencies_menu()
 {
     $currencies_menu = '';
     if (class_exists('WCML_Multi_Currency_Support')) {
         global $woocommerce_wpml, $sitepress, $media_center_theme_options;
         if ($media_center_theme_options['currency_switcher_position'] == 'top_bar_left') {
             if ($media_center_theme_options['top_bar_left_menu_dropdown_trigger'] == 'hover') {
                 $data_hover = 'data-hover="dropdown"';
             } else {
                 $data_hover = '';
             }
         } elseif ($media_center_theme_options['currency_switcher_position'] == 'top_bar_right') {
             if ($media_center_theme_options['top_bar_right_menu_dropdown_trigger'] == 'hover') {
                 $data_hover = 'data-hover="dropdown"';
             } else {
                 $data_hover = '';
             }
         }
         $settings = $woocommerce_wpml->get_settings();
         if (!isset($settings['currencies_order'])) {
             $currencies = $woocommerce_wpml->multi_currency_support->get_currency_codes();
         } else {
             $currencies = $settings['currencies_order'];
         }
         if (!isset($args['format'])) {
             $args['format'] = isset($settings['wcml_curr_template']) && $settings['wcml_curr_template'] != '' ? $settings['wcml_curr_template'] : '%name% (%code%)';
         }
         $currencies_dropdown = '<ul class="mc_wcml_currency_switcher dropdown-menu">';
         $selected_currency = '';
         $wc_currencies = get_woocommerce_currencies();
         foreach ($currencies as $currency) {
             if ($woocommerce_wpml->settings['currency_options'][$currency]['languages'][$sitepress->get_current_language()] == 1) {
                 $currency_format = preg_replace(array('#%name%#', '#%symbol%#', '#%code%#'), array($wc_currencies[$currency], get_woocommerce_currency_symbol($currency), $currency), $args['format']);
                 if ($currency == $woocommerce_wpml->multi_currency_support->get_client_currency()) {
                     $selected_currency = '<a href="#" ' . $data_hover . ' class="dropdown-toggle" data-toggle="dropdown">' . $currency_format . '</a>';
                 }
                 $currencies_dropdown .= '<li><a data-currency="' . $currency . '" href="#">' . $currency_format . '</a></li>';
             }
         }
         $currencies_dropdown .= '</ul>';
         $currencies_menu = '<li class="dropdown">' . $selected_currency . $currencies_dropdown . '</li>';
     }
     return $currencies_menu;
 }
コード例 #19
0
 function currency_switcher($args = array())
 {
     global $sitepress, $woocommerce_wpml;
     if (is_page(wc_get_page_id('myaccount'))) {
         return '';
     }
     $settings = $woocommerce_wpml->get_settings();
     if (isset($settings['display_custom_prices']) && $settings['display_custom_prices']) {
         if (is_page(wc_get_page_id('cart')) || is_page(wc_get_page_id('checkout'))) {
             return '';
         } elseif (is_product()) {
             $current_product_id = wc_get_product()->id;
             $original_product_language = $woocommerce_wpml->products->get_original_product_language($current_product_id);
             if (!get_post_meta(apply_filters('translate_object_id', $current_product_id, get_post_type($current_product_id), true, $original_product_language), '_wcml_custom_prices_status', true)) {
                 return '';
             }
         }
     }
     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) {
             $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') {
                 $selected = $currency == $this->get_client_currency() ? ' selected="selected"' : '';
                 echo '<option value="' . $currency . '"' . $selected . '>' . $currency_format . '</option>';
             } else {
                 $selected = $currency == $this->get_client_currency() ? ' class="wcml-active-currency"' : '';
                 echo '<li rel="' . $currency . '" ' . $selected . ' >' . $currency_format . '</li>';
             }
         }
     }
     if ($args['switcher_style'] == 'dropdown') {
         echo '</select>';
     } else {
         echo '</ul>';
     }
 }
コード例 #20
0
    /**
     * generate_account_details_html function.
     */
    public function generate_paytpv_terminals_html()
    {
        ob_start();
        ?>
			<tr valign="top">
				<th class="titledesc"><?php 
        _e('Terminals', 'wc_paytpv');
        ?>
:</th>
				<td colspan="2" class="forminp" id="paytpv_terminals">
					<table class="tblterminals widefat wc_input_table sortable" style="font-size:80%" cellspacing="0">
						<thead>
							<tr>
								<th class="sort">&nbsp;</th>
								<th><?php 
        _e('Terminal Number', 'wc_paytpv');
        ?>
</th>
								<th><?php 
        _e('Password', 'wc_paytpv');
        ?>
</th>
								<th><?php 
        _e('Terminals available', 'wc_paytpv');
        ?>
</th>
								<th><?php 
        _e('Use 3D Secure', 'wc_paytpv');
        ?>
</th>
								<th><?php 
        _e('Currency', 'wc_paytpv');
        ?>
</th>
								<th><?php 
        _e('Use 3D Secure on purchases over', 'wc_paytpv');
        ?>
</th>
							</tr>
						</thead>
						<tbody class="accounts">
							<?php 
        $i = -1;
        $arrTerminals = array(__('Secure', 'wc_paytpv'), __('Non-Secure', 'wc_paytpv'), __('Both', 'wc_paytpv'));
        $arrDsecure = array(__('No', 'wc_paytpv'), __('Yes', 'wc_paytpv'));
        $arrMonedas = get_woocommerce_currencies();
        // Un terminal por defecto en la moneda de woocommerce
        if (empty($this->paytpv_terminals)) {
            $this->paytpv_terminals[0] = array("term" => "", "pass" => "", "terminales" => 0, "dsecure" => 0, "moneda" => get_woocommerce_currency(), "tdmin" => "");
        }
        if ($this->paytpv_terminals) {
            foreach ($this->paytpv_terminals as $key => $terminal) {
                $i++;
                echo '<tr class="terminal">
										<td class="sort"></td>
										<td><input type="text" value="' . esc_attr(wp_unslash($terminal['term'])) . '" name="term[]" /></td>
										<td><input class="pass" type="text" value="' . esc_attr(wp_unslash($terminal['pass'])) . '" name="pass[]" /></td>
										<td><select class="term" name="terminales[]" onchange="checkterminales(this);">
										';
                foreach ($arrTerminals as $key => $val) {
                    $selected = $key == $terminal['terminales'] ? "selected" : "";
                    echo '<option value="' . $key . '" ' . $selected . '>' . $val . '</option>';
                }
                echo '</select></td>';
                echo '<td><select class="dsecure" name="dsecure[]">
										';
                foreach ($arrDsecure as $key => $val) {
                    $selected = $key == $terminal['dsecure'] ? "selected" : "";
                    echo '<option value="' . $key . '" ' . $selected . '>' . $val . '</option>';
                }
                echo '</select></td>';
                echo '<td><select class="moneda" name="moneda[]">
										';
                foreach ($arrMonedas as $key => $val) {
                    $selected = $key == $terminal['moneda'] || $terminal['moneda'] == "" && $key == get_woocommerce_currency() ? "selected" : "";
                    echo '<option value="' . $key . '" ' . $selected . '>' . $val . '</option>';
                }
                echo '</select></td>';
                echo '<td><input class="tdmin" type="number" value="' . esc_attr($terminal['tdmin']) . '" name="tdmin[]" placeholder="0" /></td>
									</tr>';
            }
        }
        ?>
						</tbody>
						<tfoot>
							<tr>
								<th colspan="7"><a href="#" class="add button"><?php 
        _e('+ Add Terminal', 'wc_paytpv');
        ?>
</a> <a href="#" class="remove_term button"><?php 
        _e('- Remove Terminal', 'wc_paytpv');
        ?>
</a></th>
							</tr>
						</tfoot>
					</table>
					
				</td>
			</tr>
			<p id="msg_1terminal" style="display:none"><?php 
        print __('Must have at least one terminal configured to process payments.', 'wc_paytpv');
        ?>
</p>
			<p id="msg_moneda_terminal" style="display:none"><?php 
        print __('There can be two terminals configured with the same currency.', 'wc_paytpv');
        ?>
</p>
			<?php 
        return ob_get_clean();
    }
コード例 #21
0
    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 
        $wcml_dashboard_set_currency_nonce = wp_create_nonce('dashboard_set_currency');
        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: {\n                        action: 'wcml_dashboard_set_currency',\n                        currency: jQuery('#dropdown_dashboard_currency').val(),\n                        wcml_nonce: '" . $wcml_dashboard_set_currency_nonce . "'\n                    },\n                    success: function( response ){\n                        if(typeof response.error !== 'undefined'){\n                            alert(response.error);\n                        }else{\n                           window.location = window.location.href;\n                        }\n                    }\n                })\n            });\n        ");
    }
コード例 #22
0
    function booking_currency_dropdown()
    {
        global $woocommerce_wpml, $sitepress;
        if ($woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT) {
            $current_booking_currency = $this->get_cookie_booking_currency();
            $wc_currencies = get_woocommerce_currencies();
            $order_currencies = $woocommerce_wpml->multi_currency->get_orders_currencies();
            ?>
            <tr valign="top">
                <th scope="row"><?php 
            _e('Booking currency', 'wpml-wcml');
            ?>
</th>
                <td>
                    <select id="dropdown_booking_currency">

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

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

                        <?php 
            }
            ?>

                    </select>
                </td>
            </tr>

            <?php 
            $wcml_booking_set_currency_nonce = wp_create_nonce('booking_set_currency');
            wc_enqueue_js("\n\n            jQuery(document).on('change', '#dropdown_booking_currency', function(){\n               jQuery.ajax({\n                    url: ajaxurl,\n                    type: 'post',\n                    data: {\n                        action: 'wcml_booking_set_currency',\n                        currency: jQuery('#dropdown_booking_currency').val(),\n                        wcml_nonce: '" . $wcml_booking_set_currency_nonce . "'\n                    },\n                    success: function( response ){\n                        if(typeof response.error !== 'undefined'){\n                            alert(response.error);\n                        }else{\n                           window.location = window.location.href;\n                        }\n                    }\n                })\n            });\n        ");
        }
    }
コード例 #23
0
 /**
  * Edit an order
  *
  * @since 2.2
  * @param int $id the order ID
  * @param array $data
  * @return array
  */
 public function edit_order($id, $data)
 {
     try {
         if (!isset($data['order'])) {
             throw new WC_API_Exception('woocommerce_api_missing_order_data', sprintf(__('No %1$s data specified to edit %1$s', 'woocommerce'), 'order'), 400);
         }
         $data = $data['order'];
         $update_totals = false;
         $id = $this->validate_request($id, $this->post_type, 'edit');
         if (is_wp_error($id)) {
             return $id;
         }
         $data = apply_filters('woocommerce_api_edit_order_data', $data, $id, $this);
         $order = wc_get_order($id);
         if (empty($order)) {
             throw new WC_API_Exception('woocommerce_api_invalid_order_id', __('Order ID is invalid', 'woocommerce'), 400);
         }
         $order_args = array('order_id' => $order->get_id());
         // Customer note.
         if (isset($data['note'])) {
             $order_args['customer_note'] = $data['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_API_Exception('woocommerce_api_invalid_customer_id', __('Customer ID is invalid', 'woocommerce'), 400);
             }
             update_post_meta($order->get_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)) {
                         $item['id'] = null;
                     }
                     // 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->get_id(), '_payment_method', $data['payment_details']['method_id']);
             }
             // Method title.
             if (isset($data['payment_details']['method_title'])) {
                 update_post_meta($order->get_id(), '_payment_method_title', $data['payment_details']['method_title']);
             }
             // Mark as paid if set.
             if ($order->needs_payment() && isset($data['payment_details']['paid']) && 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_API_Exception('woocommerce_invalid_order_currency', __('Provided order currency is invalid', 'woocommerce'), 400);
             }
             update_post_meta($order->get_id(), '_order_currency', $data['currency']);
         }
         // If items have changed, recalculate order totals.
         if ($update_totals) {
             $order->calculate_totals();
         }
         // Update order meta.
         if (isset($data['order_meta']) && is_array($data['order_meta'])) {
             $this->set_order_meta($order->get_id(), $data['order_meta']);
         }
         // Update the order post to set customer note/modified date.
         wc_update_order($order_args);
         // Order status.
         if (!empty($data['status'])) {
             $order->update_status($data['status'], isset($data['status_note']) ? $data['status_note'] : '', true);
         }
         wc_delete_shop_order_transients($order->get_id());
         do_action('woocommerce_api_edit_order', $order->get_id(), $data, $this);
         return $this->get_order($id);
     } catch (WC_Data_Exception $e) {
         return new WP_Error($e->getErrorCode(), $e->getMessage(), array('status' => 400));
     } catch (WC_API_Exception $e) {
         return new WP_Error($e->getErrorCode(), $e->getMessage(), array('status' => $e->getCode()));
     }
 }
コード例 #24
0
ファイル: settings-init.php プロジェクト: rongandat/sallumeh
 * Defines the array of settings which are displayed in admin.
 *
 * Settings are defined here and displayed via functions.
 *
 * @author 		WooThemes
 * @category 	Admin
 * @package 	WooCommerce/Admin/Settings
 * @version     1.6.4
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
global $woocommerce;
$localisation_setting = defined('WPLANG') && file_exists($woocommerce->plugin_path() . '/i18n/languages/informal/woocommerce-' . WPLANG . '.mo') ? array('title' => __('Localisation', 'woocommerce'), 'desc' => sprintf(__('Use informal localisation for %s', 'woocommerce'), WPLANG), 'id' => 'woocommerce_informal_localisation_type', 'type' => 'checkbox', 'default' => 'no') : array();
$currency_code_options = get_woocommerce_currencies();
foreach ($currency_code_options as $code => $name) {
    $currency_code_options[$code] = $name . ' (' . get_woocommerce_currency_symbol($code) . ')';
}
$woocommerce_settings['general'] = 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' => __('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' => __('Allowed Countries', 'woocommerce'), 'desc' => __('These are countries that you are willing to ship to.', 'woocommerce'), 'id' => 'woocommerce_allowed_countries', 'default' => 'all', 'type' => 'select', 'class' => 'chosen_select', 'css' => 'min-width:350px;', 'desc_tip' => true, 'options' => array('all' => __('All Countries', 'woocommerce'), 'specific' => __('Specific Countries', 'woocommerce'))), array('title' => __('Specific Countries', 'woocommerce'), 'desc' => '', 'id' => 'woocommerce_specific_allowed_countries', 'css' => '', 'default' => '', 'type' => 'multi_select_countries'), $localisation_setting, 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;'), array('type' => 'sectionend', 'id' => 'general_options'), array('title' => __('Cart, Checkout and Accounts', 'woocommerce'), 'type' => 'title', 'id' => 'checkout_account_options'), array('title' => __('Coupons', 'woocommerce'), 'desc' => __('Enable the use of coupons', 'woocommerce'), 'id' => 'woocommerce_enable_coupons', 'default' => 'yes', 'type' => 'checkbox', 'desc_tip' => __('Coupons can be applied from the cart and checkout pages.', 'woocommerce')), array('title' => __('Checkout', 'woocommerce'), 'desc' => __('Enable guest checkout (no account required)', 'woocommerce'), 'id' => 'woocommerce_enable_guest_checkout', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start'), array('desc' => __('Enable customer note field on checkout', 'woocommerce'), 'id' => 'woocommerce_enable_order_comments', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => ''), array('desc' => __('Force secure checkout', 'woocommerce'), 'id' => 'woocommerce_force_ssl_checkout', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => '', 'show_if_checked' => 'option', 'desc_tip' => __('Force SSL (HTTPS) on the checkout pages (an SSL Certificate is required).', 'woocommerce')), array('desc' => __('Un-force HTTPS when leaving the checkout', 'woocommerce'), 'id' => 'woocommerce_unforce_ssl_checkout', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'end', 'show_if_checked' => 'yes'), array('title' => __('Registration', 'woocommerce'), 'desc' => __('Allow registration on the checkout page', 'woocommerce'), 'id' => 'woocommerce_enable_signup_and_login_from_checkout', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start'), array('desc' => __('Allow registration on the "My Account" page', 'woocommerce'), 'id' => 'woocommerce_enable_myaccount_registration', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => ''), array('desc' => __('Register using the email address for the username', 'woocommerce'), 'id' => 'woocommerce_registration_email_for_username', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'end'), array('title' => __('Customer Accounts', 'woocommerce'), 'desc' => __('Prevent customers from accessing WordPress admin', 'woocommerce'), 'id' => 'woocommerce_lock_down_admin', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'start'), array('desc' => __('Clear cart when logging out', 'woocommerce'), 'id' => 'woocommerce_clear_cart_on_logout', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => ''), array('desc' => __('Allow customers to repurchase orders from their account page', 'woocommerce'), 'id' => 'woocommerce_allow_customers_to_reorder', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'end'), array('type' => 'sectionend', 'id' => 'checkout_account_options'), array('title' => __('Styles and Scripts', 'woocommerce'), 'type' => 'title', 'id' => 'script_styling_options'), array('title' => __('Styling', 'woocommerce'), 'desc' => __('Enable WooCommerce CSS', 'woocommerce'), 'id' => 'woocommerce_frontend_css', 'default' => 'yes', 'type' => 'checkbox'), 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 and the add review form 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')), array('type' => 'sectionend', 'id' => 'script_styling_options'), array('title' => __('Downloadable Products', 'woocommerce'), 'type' => 'title', 'id' => 'digital_download_options'), array('title' => __('File Download Method', 'woocommerce'), 'desc' => __('Forcing downloads will keep URLs hidden, but some servers may serve large files unreliably. If supported, <code>X-Accel-Redirect</code>/ <code>X-Sendfile</code> can be used to serve downloads instead (server requires <code>mod_xsendfile</code>).', 'woocommerce'), 'id' => 'woocommerce_file_download_method', 'type' => 'select', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => 'force', 'desc_tip' => true, 'options' => array('force' => __('Force Downloads', 'woocommerce'), 'xsendfile' => __('X-Accel-Redirect/X-Sendfile', 'woocommerce'), 'redirect' => __('Redirect only', 'woocommerce'))), array('title' => __('Access Restriction', 'woocommerce'), 'desc' => __('Downloads require login', 'woocommerce'), 'id' => 'woocommerce_downloads_require_login', 'type' => 'checkbox', 'default' => 'no', 'desc_tip' => __('This setting does not apply to guest purchases.', 'woocommerce'), 'checkboxgroup' => 'start'), array('desc' => __('Grant access to downloadable products after payment', 'woocommerce'), 'id' => 'woocommerce_downloads_grant_access_after_payment', 'type' => 'checkbox', 'default' => 'yes', 'desc_tip' => __('Enable this option to grant access to downloads when orders are "processing", rather than "completed".', 'woocommerce'), 'checkboxgroup' => 'end'), array('type' => 'sectionend', 'id' => 'digital_download_options')));
// End general settings
// Get shop page
$shop_page_id = woocommerce_get_page_id('shop');
$base_slug = $shop_page_id > 0 && get_page($shop_page_id) ? get_page_uri($shop_page_id) : 'shop';
$woocommerce_prepend_shop_page_to_products_warning = '';
if ($shop_page_id > 0 && sizeof(get_pages("child_of={$shop_page_id}")) > 0) {
    $woocommerce_prepend_shop_page_to_products_warning = ' <mark class="notice">' . __('Note: The shop page has children - child pages will not work if you enable this option.', 'woocommerce') . '</mark>';
}
$woocommerce_settings['pages'] = apply_filters('woocommerce_page_settings', array(array('title' => __('Page Setup', 'woocommerce'), 'type' => 'title', 'desc' => sprintf(__('Set up core WooCommerce pages here, for example the base page. The base page can also be used in your %sproduct permalinks%s.', 'woocommerce'), '<a target="_blank" href="' . admin_url('options-permalink.php') . '">', '</a>'), 'id' => 'page_options'), array('title' => __('Shop Base Page', 'woocommerce'), 'desc' => __('This sets the base page of your shop - this is where your product archive will be.', 'woocommerce'), 'id' => 'woocommerce_shop_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('Terms Page ID', 'woocommerce'), 'desc' => __('If you define a "Terms" page the customer will be asked if they accept them when checking out.', 'woocommerce'), 'id' => 'woocommerce_terms_page_id', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'type' => 'single_select_page', 'desc_tip' => true), array('type' => 'sectionend', 'id' => 'page_options'), array('title' => __('Shop Pages', 'woocommerce'), 'type' => 'title', 'desc' => __('The following pages need selecting so that WooCommerce knows where they are. These pages should have been created upon installation of the plugin, if not you will need to create them.', 'woocommerce')), array('title' => __('Cart Page', 'woocommerce'), 'desc' => __('Page contents: [woocommerce_cart]', 'woocommerce'), 'id' => 'woocommerce_cart_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('Checkout Page', 'woocommerce'), 'desc' => __('Page contents: [woocommerce_checkout]', 'woocommerce'), 'id' => 'woocommerce_checkout_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('Pay Page', 'woocommerce'), 'desc' => __('Page contents: [woocommerce_pay] Parent: "Checkout"', 'woocommerce'), 'id' => 'woocommerce_pay_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('Thanks Page', 'woocommerce'), 'desc' => __('Page contents: [woocommerce_thankyou] Parent: "Checkout"', 'woocommerce'), 'id' => 'woocommerce_thanks_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('My Account Page', 'woocommerce'), 'desc' => __('Page contents: [woocommerce_my_account]', 'woocommerce'), 'id' => 'woocommerce_myaccount_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('Edit Address Page', 'woocommerce'), 'desc' => __('Page contents: [woocommerce_edit_address] Parent: "My Account"', 'woocommerce'), 'id' => 'woocommerce_edit_address_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('View Order Page', 'woocommerce'), 'desc' => __('Page contents: [woocommerce_view_order] Parent: "My Account"', 'woocommerce'), 'id' => 'woocommerce_view_order_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('Change Password Page', 'woocommerce'), 'desc' => __('Page contents: [woocommerce_change_password] Parent: "My Account"', 'woocommerce'), 'id' => 'woocommerce_change_password_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('Logout Page', 'woocommerce'), 'desc' => __('Parent: "My Account"', 'woocommerce'), 'id' => 'woocommerce_logout_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('Lost Password Page', 'woocommerce'), 'desc' => __('Page contents: [woocommerce_lost_password] Parent: "My Account"', 'woocommerce'), 'id' => 'woocommerce_lost_password_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('type' => 'sectionend', 'id' => 'page_options')));
// End pages settings
$woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings', array(array('title' => __('Catalog Options', 'woocommerce'), 'type' => 'title', 'desc' => '', 'id' => 'catalog_options'), array('title' => __('Default Product Sorting', 'woocommerce'), 'desc' => __('This controls the default sort order of the catalog.', 'woocommerce'), 'id' => 'woocommerce_default_catalog_orderby', 'css' => 'min-width:150px;', 'default' => 'title', 'type' => 'select', 'options' => apply_filters('woocommerce_default_catalog_orderby_options', array('menu_order' => __('Default sorting (custom ordering + name)', 'woocommerce'), 'popularity' => __('Popularity (sales)', 'woocommerce'), 'rating' => __('Average Rating', 'woocommerce'), 'date' => __('Sort by most recent', 'woocommerce'), 'price' => __('Sort by price (asc)', 'woocommerce'), 'price-desc' => __('Sort by price (desc)', 'woocommerce'))), 'desc_tip' => true), array('title' => __('Shop Page Display', 'woocommerce'), 'desc' => __('This controls what is shown on the product archive.', 'woocommerce'), 'id' => 'woocommerce_shop_page_display', 'css' => 'min-width:150px;', 'default' => '', 'type' => 'select', 'options' => array('' => __('Show products', 'woocommerce'), 'subcategories' => __('Show subcategories', 'woocommerce'), 'both' => __('Show both', 'woocommerce')), 'desc_tip' => true), array('title' => __('Default Category Display', 'woocommerce'), 'desc' => __('This controls what is shown on category archives.', 'woocommerce'), 'id' => 'woocommerce_category_archive_display', 'css' => 'min-width:150px;', 'default' => '', 'type' => 'select', 'options' => array('' => __('Show products', 'woocommerce'), 'subcategories' => __('Show subcategories', 'woocommerce'), 'both' => __('Show both', 'woocommerce')), 'desc_tip' => true), array('title' => __('Add to cart', 'woocommerce'), 'desc' => __('Redirect to the cart page after successful addition', 'woocommerce'), 'id' => 'woocommerce_cart_redirect_after_add', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'start'), array('desc' => __('Enable AJAX add to cart buttons on archives', 'woocommerce'), 'id' => 'woocommerce_enable_ajax_add_to_cart', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'end'), array('type' => 'sectionend', 'id' => 'catalog_options'), array('title' => __('Product Data', 'woocommerce'), 'type' => 'title', 'desc' => __('The following options affect the fields available on the edit product page.', 'woocommerce'), 'id' => 'product_data_options'), array('title' => __('Product Fields', 'woocommerce'), 'desc' => __('Enable the <strong>SKU</strong> field for products', 'woocommerce'), 'id' => 'woocommerce_enable_sku', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start'), array('desc' => __('Enable the <strong>weight</strong> field for products (some shipping methods may require this)', 'woocommerce'), 'id' => 'woocommerce_enable_weight', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => ''), array('desc' => __('Enable the <strong>dimension</strong> fields for products (some shipping methods may require this)', 'woocommerce'), 'id' => 'woocommerce_enable_dimensions', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => ''), array('desc' => __('Show <strong>weight and dimension</strong> values on the <strong>Additional Information</strong> tab', 'woocommerce'), 'id' => 'woocommerce_enable_dimension_product_attributes', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'end'), array('title' => __('Weight Unit', 'woocommerce'), 'desc' => __('This controls what unit you will define weights in.', 'woocommerce'), 'id' => 'woocommerce_weight_unit', 'css' => 'min-width:150px;', 'default' => 'kg', 'type' => 'select', 'options' => array('kg' => __('kg', 'woocommerce'), 'g' => __('g', 'woocommerce'), 'lbs' => __('lbs', 'woocommerce'), 'oz' => __('oz', 'woocommerce')), 'desc_tip' => true), array('title' => __('Dimensions Unit', 'woocommerce'), 'desc' => __('This controls what unit you will define lengths in.', 'woocommerce'), 'id' => 'woocommerce_dimension_unit', 'css' => 'min-width:150px;', 'default' => 'cm', 'type' => 'select', 'options' => array('m' => __('m', 'woocommerce'), 'cm' => __('cm', 'woocommerce'), 'mm' => __('mm', 'woocommerce'), 'in' => __('in', 'woocommerce'), 'yd' => __('yd', 'woocommerce')), 'desc_tip' => true), array('title' => __('Product Ratings', 'woocommerce'), 'desc' => __('Enable ratings on reviews', 'woocommerce'), 'id' => 'woocommerce_enable_review_rating', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start', 'show_if_checked' => 'option'), array('desc' => __('Ratings are required to leave a review', 'woocommerce'), 'id' => 'woocommerce_review_rating_required', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => '', 'show_if_checked' => 'yes'), array('desc' => __('Show "verified owner" label for customer reviews', 'woocommerce'), 'id' => 'woocommerce_review_rating_verification_label', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'end', 'show_if_checked' => 'yes'), array('type' => 'sectionend', 'id' => 'product_review_options'), array('title' => __('Pricing Options', 'woocommerce'), 'type' => 'title', 'desc' => __('The following options affect how prices are displayed on the frontend.', 'woocommerce'), 'id' => 'pricing_options'), array('title' => __('Currency Position', 'woocommerce'), 'desc' => __('This controls the position of the currency symbol.', 'woocommerce'), 'id' => 'woocommerce_currency_pos', 'css' => 'min-width:150px;', 'default' => 'left', 'type' => 'select', 'options' => array('left' => __('Left', 'woocommerce'), 'right' => __('Right', 'woocommerce'), 'left_space' => __('Left (with space)', 'woocommerce'), 'right_space' => __('Right (with space)', 'woocommerce')), '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('title' => __('Trailing Zeros', 'woocommerce'), 'desc' => __('Remove zeros after the decimal point. e.g. <code>$10.00</code> becomes <code>$10</code>', 'woocommerce'), 'id' => 'woocommerce_price_trim_zeros', 'default' => 'yes', 'type' => 'checkbox'), array('type' => 'sectionend', 'id' => 'pricing_options'), array('title' => __('Image Options', 'woocommerce'), 'type' => 'title', 'desc' => sprintf(__('These settings affect the actual dimensions of images in your catalog - the display on the front-end will still be affected by CSS styles. After changing these settings you may need to <a href="%s">regenerate your thumbnails</a>.', 'woocommerce'), 'http://wordpress.org/extend/plugins/regenerate-thumbnails/'), 'id' => 'image_options'), array('title' => __('Catalog Images', 'woocommerce'), 'desc' => __('This size is usually used in product listings', 'woocommerce'), 'id' => 'shop_catalog_image_size', 'css' => '', 'type' => 'image_width', 'default' => array('width' => '150', 'height' => '150', 'crop' => true), 'desc_tip' => true), array('title' => __('Single Product Image', 'woocommerce'), 'desc' => __('This is the size used by the main image on the product page.', 'woocommerce'), 'id' => 'shop_single_image_size', 'css' => '', 'type' => 'image_width', 'default' => array('width' => '300', 'height' => '300', 'crop' => 1), 'desc_tip' => true), array('title' => __('Product Thumbnails', 'woocommerce'), 'desc' => __('This size is usually used for the gallery of images on the product page.', 'woocommerce'), 'id' => 'shop_thumbnail_image_size', 'css' => '', 'type' => 'image_width', 'default' => array('width' => '90', 'height' => '90', 'crop' => 1), 'desc_tip' => true), array('type' => 'sectionend', 'id' => 'image_options')));
コード例 #25
0
ファイル: upgrade.class.php プロジェクト: Junaid-Farid/gocnex
 function upgrade_3_2()
 {
     woocommerce_wpml::set_up_capabilities();
     //delete not existing currencies in WC
     global $wpdb;
     $currencies = $wpdb->get_results("SELECT id,code FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` DESC");
     $wc_currencies = get_woocommerce_currencies();
     foreach ($currencies as $currency) {
         if (!array_key_exists($currency->code, $wc_currencies)) {
             $wpdb->delete($wpdb->prefix . 'icl_currencies', array('ID' => $currency->id));
         }
     }
 }
コード例 #26
0
ファイル: header_function.php プロジェクト: mynein/myne
function wd_header_currency_convert()
{
    global $wd_data;
    if (!isset($wd_data['wd_currency_codes']) || strlen($wd_data['wd_currency_codes']) == 0) {
        return;
    }
    $woo_header = isset($wd_data['wd_woo_header']) && $wd_data['wd_woo_header'];
    if ($woo_header) {
        if (class_exists('WooCommerce_Widget_Currency_Converter') && class_exists('WooCommerce')) {
            $args = array('title' => '', 'currency_codes' => $wd_data['wd_currency_codes']);
            $list_currencies = get_woocommerce_currencies();
            $currency_symbol = get_woocommerce_currency_symbol('USD');
            ?>
				<div class="currency_control">
					<a href="javascript: void(0)">
						<span class="current_currency"><?php 
            echo get_option('woocommerce_currency');
            ?>
</span>
						<span class="symbol"></span>
					</a>
				</div>
				<div class="currency_dropdown drop_down_container" style="display: none">
					<form method="post">
						<div>
							<?php 
            if (isset($args['message']) && $args['message']) {
                echo wpautop($args['message']);
            }
            $currencies = array_map('trim', array_filter(explode("\n", $args['currency_codes'])));
            if ($currencies) {
                echo '<ul class="currency_switcher font-second">';
                foreach ($currencies as $currency) {
                    $class = '';
                    if ($currency == get_option('woocommerce_currency')) {
                        $class = 'reset default';
                    }
                    $text_line = '';
                    $text_line .= '<span class="name">' . esc_html($currency) . '</span>';
                    $text_line .= '<span class="symbol">' . esc_html(get_woocommerce_currency_symbol($currency)) . '</span>';
                    echo '<li><a href="#" class="' . esc_attr($class) . '" data-currencycode="' . esc_attr($currency) . '">' . $text_line . '</a></li>';
                }
                if (isset($args['show_reset']) && $args['show_reset']) {
                    echo '<li><a href="#" class="reset">' . __('Reset', 'wpdance') . '</a></li>';
                }
                echo '</ul>';
            }
            ?>
						</div>
					</form>
				</div>
				<?php 
        }
    } else {
        /* Easycart */
        $currencies = array_map('trim', array_filter(explode("\n", $wd_data['wd_currency_codes'])));
        $selected_currency = get_option('ec_option_base_currency');
        if (isset($_SESSION['ec_convert_to'])) {
            $selected_currency = $_SESSION['ec_convert_to'];
        }
        ?>
			<div class="currency_control">
				<a href="javascript: void(0)">
					<span class="current_currency"><?php 
        echo esc_html($selected_currency);
        ?>
</span>
					<span class="symbol">
					<?php 
        $currency_symbol = $GLOBALS['currency']->get_currency_symbol($selected_currency);
        if (!empty($currency_symbol)) {
            $currency_symbol = str_replace($selected_currency . ' ', '', $currency_symbol);
        }
        echo esc_html($currency_symbol);
        ?>
					</span>
				</a>
			</div>
			<div class="currency_dropdown drop_down_container ec_currency" style="display: none">
				<form method="post">
					<div>
						<?php 
        if ($currencies) {
            echo '<ul class="currency_switcher font-second">';
            foreach ($currencies as $currency) {
                $currency_symbol = $GLOBALS['currency']->get_currency_symbol($currency);
                if (!empty($currency_symbol)) {
                    $currency_symbol = str_replace($currency . ' ', '', $currency_symbol);
                }
                $text_line = '';
                $text_line .= '<span class="name">' . esc_html($currency) . '</span>';
                $text_line .= '<span class="symbol">' . esc_html($currency_symbol) . '</span>';
                echo '<li><a href="#" data-currencycode="' . esc_attr($currency) . '">' . $text_line . '</a></li>';
            }
            echo '</ul>';
        }
        ?>
					</div>
					<input type="hidden" value="" name="ec_currency_conversion" />
				</form>
			</div>
			<?php 
    }
}
コード例 #27
0
 /**
  * Get the Order's schema, conforming to JSON Schema.
  *
  * @return array
  */
 public function get_item_schema()
 {
     $schema = array('$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => $this->post_type, 'type' => 'object', 'properties' => array('id' => array('description' => __('Unique identifier for the resource.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit'), 'readonly' => true), 'parent_id' => array('description' => __('Parent order ID.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit')), 'status' => array('description' => __('Order status.', 'woocommerce'), 'type' => 'string', 'default' => 'pending', 'enum' => $this->get_order_statuses(), 'context' => array('view', 'edit')), 'order_key' => array('description' => __('Order key.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'currency' => array('description' => __('Currency the order was created with, in ISO format.', 'woocommerce'), 'type' => 'string', 'default' => get_woocommerce_currency(), 'enum' => array_keys(get_woocommerce_currencies()), 'context' => array('view', 'edit')), 'version' => array('description' => __('Version of WooCommerce when the order was made.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit'), 'readonly' => true), 'prices_include_tax' => array('description' => __('Shows if the prices included tax during checkout.', 'woocommerce'), 'type' => 'boolean', 'context' => array('view', 'edit'), 'readonly' => true), 'date_created' => array('description' => __("The date the order was created, in the site's timezone.", 'woocommerce'), 'type' => 'date-time', 'context' => array('view', 'edit'), 'readonly' => true), 'date_modified' => array('description' => __("The date the order was last modified, in the site's timezone.", 'woocommerce'), 'type' => 'date-time', 'context' => array('view', 'edit'), 'readonly' => true), 'customer_id' => array('description' => __('User ID who owns the order. 0 for guests.', 'woocommerce'), 'type' => 'integer', 'default' => 0, 'context' => array('view', 'edit')), 'discount_total' => array('description' => __('Total discount amount for the order.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'discount_tax' => array('description' => __('Total discount tax amount for the order.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'shipping_total' => array('description' => __('Total shipping amount for the order.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'shipping_tax' => array('description' => __('Total shipping tax amount for the order.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'cart_tax' => array('description' => __('Sum of line item taxes only.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'total' => array('description' => __('Grand total.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'total_tax' => array('description' => __('Sum of all taxes.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'billing' => array('description' => __('Billing address.', 'woocommerce'), 'type' => 'array', 'context' => array('view', 'edit'), 'properties' => array('first_name' => array('description' => __('First name.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'last_name' => array('description' => __('Last name.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'company' => array('description' => __('Company name.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'address_1' => array('description' => __('Address line 1.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'address_2' => array('description' => __('Address line 2.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'city' => array('description' => __('City name.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'state' => array('description' => __('ISO code or name of the state, province or district.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'postcode' => array('description' => __('Postal code.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'country' => array('description' => __('Country code in ISO 3166-1 alpha-2 format.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'email' => array('description' => __('Email address.', 'woocommerce'), 'type' => 'string', 'format' => 'email', 'context' => array('view', 'edit')), 'phone' => array('description' => __('Phone number.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')))), 'shipping' => array('description' => __('Shipping address.', 'woocommerce'), 'type' => 'array', 'context' => array('view', 'edit'), 'properties' => array('first_name' => array('description' => __('First name.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'last_name' => array('description' => __('Last name.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'company' => array('description' => __('Company name.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'address_1' => array('description' => __('Address line 1.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'address_2' => array('description' => __('Address line 2.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'city' => array('description' => __('City name.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'state' => array('description' => __('ISO code or name of the state, province or district.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'postcode' => array('description' => __('Postal code.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'country' => array('description' => __('Country code in ISO 3166-1 alpha-2 format.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')))), 'payment_method' => array('description' => __('Payment method ID.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'payment_method_title' => array('description' => __('Payment method title.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'set_paid' => array('description' => __('Define if the order is paid. It will set the status to processing and reduce stock items.', 'woocommerce'), 'type' => 'boolean', 'default' => false, 'context' => array('edit')), 'transaction_id' => array('description' => __('Unique transaction ID.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'customer_ip_address' => array('description' => __("Customer's IP address.", 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'customer_user_agent' => array('description' => __('User agent of the customer.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'created_via' => array('description' => __('Shows where the order was created.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'customer_note' => array('description' => __('Note left by customer during checkout.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'date_completed' => array('description' => __("The date the order was completed, in the site's timezone.", 'woocommerce'), 'type' => 'date-time', 'context' => array('view', 'edit'), 'readonly' => true), 'date_paid' => array('description' => __("The date the order has been paid, in the site's timezone.", 'woocommerce'), 'type' => 'date-time', 'context' => array('view', 'edit'), 'readonly' => true), 'cart_hash' => array('description' => __('MD5 hash of cart items to ensure orders are not modified.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'line_items' => array('description' => __('Line items data.', 'woocommerce'), 'type' => 'array', 'context' => array('view', 'edit'), 'properties' => array('id' => array('description' => __('Item ID.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit'), 'readonly' => true), 'name' => array('description' => __('Product name.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'sku' => array('description' => __('Product SKU.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'product_id' => array('description' => __('Product ID.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit')), 'variation_id' => array('description' => __('Variation ID, if applicable.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit')), 'quantity' => array('description' => __('Quantity ordered.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit')), 'tax_class' => array('description' => __('Tax class of product.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit'), 'readonly' => true), 'price' => array('description' => __('Product price.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'subtotal' => array('description' => __('Line subtotal (before discounts).', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'subtotal_tax' => array('description' => __('Line subtotal tax (before discounts).', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'total' => array('description' => __('Line total (after discounts).', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'total_tax' => array('description' => __('Line total tax (after discounts).', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'taxes' => array('description' => __('Line taxes.', 'woocommerce'), 'type' => 'array', 'context' => array('view', 'edit'), 'readonly' => true, 'properties' => array('id' => array('description' => __('Tax rate ID.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit'), 'readonly' => true), 'total' => array('description' => __('Tax total.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'subtotal' => array('description' => __('Tax subtotal.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true))), 'meta' => array('description' => __('Line item meta data.', 'woocommerce'), 'type' => 'array', 'context' => array('view', 'edit'), 'readonly' => true, 'properties' => array('key' => array('description' => __('Meta key.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'label' => array('description' => __('Meta label.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'value' => array('description' => __('Meta value.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true))))), 'tax_lines' => array('description' => __('Tax lines data.', 'woocommerce'), 'type' => 'array', 'context' => array('view', 'edit'), 'readonly' => true, 'properties' => array('id' => array('description' => __('Item ID.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit'), 'readonly' => true), 'rate_code' => array('description' => __('Tax rate code.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'rate_id' => array('description' => __('Tax rate ID.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'label' => array('description' => __('Tax rate label.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'compound' => array('description' => __('Show if is a compound tax rate.', 'woocommerce'), 'type' => 'boolean', 'context' => array('view', 'edit'), 'readonly' => true), 'tax_total' => array('description' => __('Tax total (not including shipping taxes).', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'shipping_tax_total' => array('description' => __('Shipping tax total.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true))), 'shipping_lines' => array('description' => __('Shipping lines data.', 'woocommerce'), 'type' => 'array', 'context' => array('view', 'edit'), 'properties' => array('id' => array('description' => __('Item ID.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit'), 'readonly' => true), 'method_title' => array('description' => __('Shipping method name.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'method_id' => array('description' => __('Shipping method ID.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'total' => array('description' => __('Line total (after discounts).', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'total_tax' => array('description' => __('Line total tax (after discounts).', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'taxes' => array('description' => __('Line taxes.', 'woocommerce'), 'type' => 'array', 'context' => array('view', 'edit'), 'readonly' => true, 'properties' => array('id' => array('description' => __('Tax rate ID.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit'), 'readonly' => true), 'total' => array('description' => __('Tax total.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true))))), 'fee_lines' => array('description' => __('Fee lines data.', 'woocommerce'), 'type' => 'array', 'context' => array('view', 'edit'), 'properties' => array('id' => array('description' => __('Item ID.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit'), 'readonly' => true), 'name' => array('description' => __('Fee name.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'tax_class' => array('description' => __('Tax class of fee.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'tax_status' => array('description' => __('Tax status of fee.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'total' => array('description' => __('Line total (after discounts).', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'total_tax' => array('description' => __('Line total tax (after discounts).', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'taxes' => array('description' => __('Line taxes.', 'woocommerce'), 'type' => 'array', 'context' => array('view', 'edit'), 'readonly' => true, 'properties' => array('id' => array('description' => __('Tax rate ID.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit'), 'readonly' => true), 'total' => array('description' => __('Tax total.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'subtotal' => array('description' => __('Tax subtotal.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true))))), 'coupon_lines' => array('description' => __('Coupons line data.', 'woocommerce'), 'type' => 'array', 'context' => array('view', 'edit'), 'properties' => array('id' => array('description' => __('Item ID.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit'), 'readonly' => true), 'code' => array('description' => __('Coupon code.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'discount' => array('description' => __('Discount total.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit')), 'discount_tax' => array('description' => __('Discount total tax.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true))), 'refunds' => array('description' => __('List of refunds.', 'woocommerce'), 'type' => 'array', 'context' => array('view', 'edit'), 'readonly' => true, 'properties' => array('id' => array('description' => __('Refund ID.', 'woocommerce'), 'type' => 'integer', 'context' => array('view', 'edit'), 'readonly' => true), 'reason' => array('description' => __('Refund reason.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true), 'total' => array('description' => __('Refund total.', 'woocommerce'), 'type' => 'string', 'context' => array('view', 'edit'), 'readonly' => true)))));
     return $this->add_additional_fields_schema($schema);
 }
コード例 #28
0
ファイル: offers.php プロジェクト: sgtpep/woocommerce-1c
function wc1c_update_currency($currency)
{
    if (!array_key_exists($currency, get_woocommerce_currencies())) {
        return;
    }
    update_option('woocommerce_currency', $currency);
    $currency_position = array('RUB' => 'right_space', 'USD' => 'left');
    if (isset($currency_position[$currency])) {
        update_option('woocommerce_currency_pos', $currency_position[$currency]);
    }
}
    /**
     * Locale settings
     */
    public function wc_setup_locale()
    {
        $user_location = WC_Geolocation::geolocate_ip();
        $country = !empty($user_location['country']) ? $user_location['country'] : 'US';
        $state = !empty($user_location['state']) ? $user_location['state'] : '*';
        $state = 'US' === $country && '*' === $state ? 'AL' : $state;
        // Defaults
        $currency = get_option('woocommerce_currency', 'GBP');
        $currency_pos = get_option('woocommerce_currency_pos', 'left');
        $decimal_sep = get_option('woocommerce_decimal_sep', '.');
        $thousand_sep = get_option('woocommerce_thousand_sep', ',');
        $dimension_unit = get_option('woocommerce_dimension_unit', 'cm');
        $weight_unit = get_option('woocommerce_weight_unit', 'kg');
        ?>
		<h1><?php 
        _e('Store Locale Setup', 'woocommerce');
        ?>
</h1>
		<form method="post">
			<table class="form-table">
				<tr>
					<th scope="row"><label for="store_location"><?php 
        _e('Where is your store based?', 'woocommerce');
        ?>
</label></th>
					<td>
					<select id="store_location" name="store_location" style="width:100%;" required data-placeholder="<?php 
        esc_attr_e('Choose a country&hellip;', 'woocommerce');
        ?>
" class="wc-enhanced-select">
							<?php 
        WC()->countries->country_dropdown_options($country, $state);
        ?>
						</select>
					</td>
				</tr>
				<tr>
					<th scope="row"><label for="currency_code"><?php 
        _e('Which currency will your store use?', 'woocommerce');
        ?>
</label></th>
					<td>
						<select id="currency_code" name="currency_code" required style="width:100%;" data-placeholder="<?php 
        esc_attr_e('Choose a currency&hellip;', 'woocommerce');
        ?>
" class="wc-enhanced-select">
							<option value=""><?php 
        _e('Choose a currency&hellip;', 'woocommerce');
        ?>
</option>
							<?php 
        foreach (get_woocommerce_currencies() as $code => $name) {
            echo '<option value="' . esc_attr($code) . '" ' . checked($currency, $code, false) . '>' . esc_html($name . ' (' . get_woocommerce_currency_symbol($code) . ')') . '</option>';
        }
        ?>
						</select>
						<span class="description"><?php 
        printf(__('If your currency is not listed you can %sadd it later%s.', 'woocommerce'), '<a href="http://docs.woothemes.com/document/add-a-custom-currency-symbol/" target="_blank">', '</a>');
        ?>
</span>
					</td>
				</tr>
				<tr>
					<th scope="row"><label for="currency_pos"><?php 
        _e('Currency Position', 'woocommerce');
        ?>
</label></th>
					<td>
						<select id="currency_pos" name="currency_pos" class="wc-enhanced-select">
							<option value="left" <?php 
        selected($currency_pos, 'left');
        ?>
><?php 
        echo __('Left', 'woocommerce');
        ?>
</option>
							<option value="right" <?php 
        selected($currency_pos, 'right');
        ?>
><?php 
        echo __('Right', 'woocommerce');
        ?>
</option>
							<option value="left_space" <?php 
        selected($currency_pos, 'left_space');
        ?>
><?php 
        echo __('Left with space', 'woocommerce');
        ?>
</option>
							<option value="right_space" <?php 
        selected($currency_pos, 'right_space');
        ?>
><?php 
        echo __('Right with space', 'woocommerce');
        ?>
</option>
						</select>
					</td>
				</tr>
				<tr>
					<th scope="row"><label for="thousand_sep"><?php 
        _e('Thousand Separator', 'woocommerce');
        ?>
</label></th>
					<td>
						<input type="text" id="thousand_sep" name="thousand_sep" size="2" value="<?php 
        echo esc_attr($thousand_sep);
        ?>
" />
					</td>
				</tr>
				<tr>
					<th scope="row"><label for="decimal_sep"><?php 
        _e('Decimal Separator', 'woocommerce');
        ?>
</label></th>
					<td>
						<input type="text" id="decimal_sep" name="decimal_sep" size="2" value="<?php 
        echo esc_attr($decimal_sep);
        ?>
" />
					</td>
				</tr>
				<tr>
					<th scope="row"><label for="weight_unit"><?php 
        _e('Which unit should be used for product weights?', 'woocommerce');
        ?>
</label></th>
					<td>
						<select id="weight_unit" name="weight_unit" class="wc-enhanced-select">
							<option value="kg" <?php 
        selected($weight_unit, 'kg');
        ?>
><?php 
        echo __('kg', 'woocommerce');
        ?>
</option>
							<option value="g" <?php 
        selected($weight_unit, 'g');
        ?>
><?php 
        echo __('g', 'woocommerce');
        ?>
</option>
							<option value="lbs" <?php 
        selected($weight_unit, 'lbs');
        ?>
><?php 
        echo __('lbs', 'woocommerce');
        ?>
</option>
							<option value="oz" <?php 
        selected($weight_unit, 'oz');
        ?>
><?php 
        echo __('oz', 'woocommerce');
        ?>
</option>
						</select>
					</td>
				</tr>
				<tr>
					<th scope="row"><label for="dimension_unit"><?php 
        _e('Which unit should be used for product dimensions?', 'woocommerce');
        ?>
</label></th>
					<td>
						<select id="dimension_unit" name="dimension_unit" class="wc-enhanced-select">
							<option value="m" <?php 
        selected($dimension_unit, 'm');
        ?>
><?php 
        echo __('m', 'woocommerce');
        ?>
</option>
							<option value="cm" <?php 
        selected($dimension_unit, 'cm');
        ?>
><?php 
        echo __('cm', 'woocommerce');
        ?>
</option>
							<option value="mm" <?php 
        selected($dimension_unit, 'mm');
        ?>
><?php 
        echo __('mm', 'woocommerce');
        ?>
</option>
							<option value="in" <?php 
        selected($dimension_unit, 'in');
        ?>
><?php 
        echo __('in', 'woocommerce');
        ?>
</option>
							<option value="yd" <?php 
        selected($dimension_unit, 'yd');
        ?>
><?php 
        echo __('yd', 'woocommerce');
        ?>
</option>
						</select>
					</td>
				</tr>
			</table>
			<p class="wc-setup-actions step">
				<input type="submit" class="button-primary button button-large" value="<?php 
        esc_attr_e('Continue', 'woocommerce');
        ?>
" name="save_step" />
				<a href="<?php 
        echo esc_url($this->get_next_step_link());
        ?>
" class="button button-large"><?php 
        _e('Skip this step', 'woocommerce');
        ?>
</a>
				<?php 
        wp_nonce_field('wc-setup');
        ?>
			</p>
		</form>
		<?php 
    }
コード例 #30
0
 /**
  * Given a currency code, it returns the currency's name. If currency is not
  * found amongst the available ones, its code is returned instead.
  *
  * @param string currency The currency code.
  * @return string
  */
 public static function get_currency_name($currency)
 {
     $available_currencies = get_woocommerce_currencies();
     return get_value($currency, $available_currencies, $currency);
 }