/** * get_settings. */ function get_settings() { $settings = array(array('title' => __('Price by Country Options', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => __('Change product\'s price and currency by customer\'s country. Customer\'s country is detected automatically by IP.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_options'), array('title' => __('Prices and Currencies by Country', 'woocommerce-jetpack'), 'desc' => '<strong>' . __('Enable Module', 'woocommerce-jetpack') . '</strong>', 'desc_tip' => __('Change WooCommerce product price and currency automatically by customer\'s country.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_enabled', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Price Rounding', 'woocommerce-jetpack'), 'desc' => __('If you choose to multiply price, set rounding options here.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_rounding', 'default' => 'none', 'type' => 'select', 'options' => array('none' => __('No rounding', 'woocommerce-jetpack'), 'round' => __('Round', 'woocommerce-jetpack'), 'floor' => __('Round down', 'woocommerce-jetpack'), 'ceil' => __('Round up', 'woocommerce-jetpack'))), array('title' => __('Price by Country on per Product Basis', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'desc_tip' => __('This will add meta boxes in product edit.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_local_enabled', 'default' => 'yes', 'type' => 'checkbox'), array('type' => 'sectionend', 'id' => 'wcj_price_by_country_options'), array('title' => __('Country Groups', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => '', 'id' => 'wcj_price_by_country_country_groups_options'), array('title' => __('Groups Number', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_total_groups_number', 'default' => 1, 'type' => 'custom_number', 'desc' => apply_filters('get_wc_jetpack_plus_message', '', 'desc'), 'custom_attributes' => array_merge(is_array(apply_filters('get_wc_jetpack_plus_message', '', 'readonly')) ? apply_filters('get_wc_jetpack_plus_message', '', 'readonly') : array(), array('step' => '1', 'min' => '1')), 'css' => 'width:100px;')); for ($i = 1; $i <= apply_filters('wcj_get_option_filter', 1, get_option('wcj_price_by_country_total_groups_number', 1)); $i++) { $settings[] = array('title' => __('Group', 'woocommerce-jetpack') . ' #' . $i, 'desc' => __('Countries. List of comma separated country codes.<br>For country codes and predifined sets visit <a href="http://woojetpack.com/features/prices-and-currencies-by-customers-country">WooJetpack.com</a>', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_exchange_rate_countries_group_' . $i, 'default' => '', 'type' => 'textarea', 'css' => 'width:50%;min-width:300px;height:100px;'); /* TODO: Multiselect instead of comma separated list. $settings[] = array( 'title' => __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i, 'id' => 'wcj_price_by_country_countries_group_' . $i, 'default' => '', 'type' => 'multiselect', 'options' => wcj_get_countries(), //'class' => 'chosen_select', 'css' => 'width:50%;min-width:300px;height:100px;', ); */ $settings[] = array('title' => '', 'desc' => __('Currency', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_exchange_rate_currency_group_' . $i, 'default' => 'EUR', 'type' => 'select', 'options' => wcj_get_currencies_names_and_symbols()); } $settings[] = array('type' => 'sectionend', 'id' => 'wcj_price_by_country_country_groups_options'); $settings[] = array('title' => __('Exchange Rates', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => '', 'id' => 'wcj_price_by_country_exchange_rate_options'); $settings[] = array('title' => __('Exchange Rates Updates', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_auto_exchange_rates', 'default' => 'manual', 'type' => 'select', 'options' => array('manual' => __('Enter Rates Manually', 'woocommerce-jetpack'), 'hourly' => __('Automatically: Update Hourly', 'woocommerce-jetpack'), 'twicedaily' => __('Automatically: Update Twice Daily', 'woocommerce-jetpack'), 'daily' => __('Automatically: Update Daily', 'woocommerce-jetpack'), 'weekly' => __('Automatically: Update Weekly', 'woocommerce-jetpack'), 'minutely' => __('Automatically: Update Every Minute', 'woocommerce-jetpack')), 'desc' => apply_filters('get_wc_jetpack_plus_message', '', 'desc'), 'custom_attributes' => apply_filters('get_wc_jetpack_plus_message', '', 'disabled')); $currency_from = apply_filters('woocommerce_currency', get_option('woocommerce_currency')); for ($i = 1; $i <= apply_filters('wcj_get_option_filter', 1, get_option('wcj_price_by_country_total_groups_number', 1)); $i++) { $currency_to = get_option('wcj_price_by_country_exchange_rate_currency_group_' . $i); $custom_attributes = array('currency_from' => $currency_from, 'currency_to' => $currency_to, 'multiply_by_field_id' => 'wcj_price_by_country_exchange_rate_group_' . $i); if ($currency_from == $currency_to) { $custom_attributes['disabled'] = 'disabled'; } $settings[] = array('title' => __('Group', 'woocommerce-jetpack') . ' #' . $i, 'desc' => __('Multiply Price by', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_exchange_rate_group_' . $i, 'default' => 1, 'type' => 'exchange_rate', 'css' => 'width:100px;', 'custom_attributes' => array('step' => '0.000001', 'min' => '0'), 'custom_attributes_button' => $custom_attributes, 'value' => $currency_from . '/' . $currency_to, 'value_title' => sprintf(__('Grab %s rate from Yahoo.com', 'woocommerce-jetpack'), $currency_from . '/' . $currency_to)); /* $settings[] = array( 'title' => '', //'id' => 'wcj_price_by_country_exchange_rate_refresh_group_' . $i, 'class' => 'exchage_rate_button', 'type' => 'custom_number', 'css' => 'width:300px;', 'value' => sprintf( __( '%s rate from Yahoo.com', 'woocommerce-jetpack' ), $currency_from . '/' . $currency_to ), 'custom_attributes' => $custom_attributes, ); */ $settings[] = array('title' => '', 'desc' => __('Make empty price', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_make_empty_price_group_' . $i, 'default' => 'no', 'type' => 'checkbox'); } $settings[] = array('type' => 'sectionend', 'id' => 'wcj_price_by_country_exchange_rate_options'); return $settings; }
/** * add_currency_settings. */ function add_currency_settings($settings) { $settings[] = array('title' => __('Payment Gateways Currency Options', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => __('This section lets you set different currency for each payment gateway.', 'woocommerce-jetpack'), 'id' => 'wcj_payment_gateways_currency_options'); $currency_from = get_woocommerce_currency(); global $woocommerce; $available_gateways = $woocommerce->payment_gateways->payment_gateways(); foreach ($available_gateways as $key => $gateway) { $currency_to = get_option('wcj_gateways_currency_' . $key, get_woocommerce_currency()); $custom_attributes = array('currency_from' => $currency_from, 'currency_to' => $currency_to, 'multiply_by_field_id' => 'wcj_gateways_currency_exchange_rate_' . $key); if ($currency_from == $currency_to) { $custom_attributes['disabled'] = 'disabled'; } $settings = array_merge($settings, array(array('title' => $gateway->title, 'id' => 'wcj_gateways_currency_' . $key, 'default' => get_woocommerce_currency(), 'type' => 'select', 'options' => wcj_get_currencies_names_and_symbols()), array('title' => '', 'id' => 'wcj_gateways_currency_exchange_rate_' . $key, 'default' => 1, 'type' => 'exchange_rate', 'custom_attributes' => array('step' => '0.000001', 'min' => '0'), 'custom_attributes_button' => $custom_attributes, 'css' => 'width:100px;', 'value' => $currency_from . '/' . $currency_to, 'value_title' => sprintf(__('Grab %s rate from Yahoo.com', 'woocommerce-jetpack'), $currency_from . '/' . $currency_to)))); } $settings[] = array('title' => __('Exchange Rates Updates', 'woocommerce-jetpack'), 'id' => 'wcj_gateways_currency_exchange_rate_update_auto', 'default' => 'manual', 'type' => 'select', 'options' => array('manual' => __('Enter Rates Manually', 'woocommerce-jetpack'), 'auto' => __('Automatically via Currency Exchange Rates module', 'woocommerce-jetpack')), 'desc' => '' == apply_filters('get_wc_jetpack_plus_message', '', 'desc') ? __('Visit', 'woocommerce-jetpack') . ' <a href="' . admin_url('admin.php?page=wc-settings&tab=jetpack&wcj-cat=prices_and_currencies§ion=currency_exchange_rates') . '">' . __('Currency Exchange Rates module', 'woocommerce-jetpack') . '</a>' : apply_filters('get_wc_jetpack_plus_message', '', 'desc'), 'custom_attributes' => apply_filters('get_wc_jetpack_plus_message', '', 'disabled')); $settings[] = array('type' => 'sectionend', 'id' => 'wcj_payment_gateways_currency_options'); return $settings; }
/** * get_settings. * * @version 2.5.8 */ function get_settings() { // global $wcj_notice; $settings = array(array('title' => __('Price by Country Options', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => __('Change product\'s price and currency by customer\'s country. Customer\'s country is detected automatically by IP, or selected by customer manually.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_options'), array('title' => __('Customer Country Detection Method', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_customer_country_detection_method', 'desc' => __('If you choose "by user selection", use [wcj_country_select_drop_down_list] shortcode to display country selection list on frontend.', 'woocommerce-jetpack'), 'default' => 'by_ip', 'type' => 'select', 'options' => array('by_ip' => __('by IP', 'woocommerce-jetpack'), 'by_ip_then_by_user_selection' => __('by IP, then by user selection', 'woocommerce-jetpack'), 'by_user_selection' => __('by user selection', 'woocommerce-jetpack'))), array('title' => __('Override Country Options', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_override_on_checkout_with_billing_country', 'default' => 'no', 'type' => 'select', 'options' => array('no' => __('No Override', 'woocommerce-jetpack'), 'yes' => __('Override Country with Customer\'s Checkout Billing Country', 'woocommerce-jetpack'), 'shipping_country' => __('Override Country with Customer\'s Checkout Shipping Country', 'woocommerce-jetpack'))), array('title' => __('Revert Currency to Default on Checkout', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_revert', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Price Rounding', 'woocommerce-jetpack'), 'desc' => __('If you choose to multiply price, set rounding options here.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_rounding', 'default' => 'none', 'type' => 'select', 'options' => array('none' => __('No rounding', 'woocommerce-jetpack'), 'round' => __('Round', 'woocommerce-jetpack'), 'floor' => __('Round down', 'woocommerce-jetpack'), 'ceil' => __('Round up', 'woocommerce-jetpack'))), array('title' => __('Price by Country on per Product Basis', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'desc_tip' => __('This will add product data fields in product edit.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_local_enabled', 'default' => 'yes', 'type' => 'checkbox'), array('title' => __('Price Filter Widget and Sorting by Price Support', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'desc_tip' => '<a href="' . add_query_arg('recalculate_price_filter_products_prices', '1', remove_query_arg(array('wcj_generate_country_groups', 'wcj_generate_country_groups_confirm'))) . '">' . __('Recalculate price filter widget and sorting by price product prices', 'woocommerce-jetpack') . '</a>', 'id' => 'wcj_price_by_country_price_filter_widget_support_enabled', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Add Countries Flags Images to Select Drop-Down Box', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'desc_tip' => __('If you are using [wcj_country_select_drop_down_list] shortcode or "Booster: Country Switcher" widget, this will add country flags to these select boxes.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_jquery_wselect_enabled', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Search Engine Bots', 'woocommerce-jetpack'), 'desc' => __('Disable Price by Country for Bots', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_for_bots_disabled', 'default' => 'no', 'type' => 'checkbox'), array('type' => 'sectionend', 'id' => 'wcj_price_by_country_options'), array('title' => __('Country Groups', 'woocommerce-jetpack'), 'type' => 'title', 'id' => 'wcj_price_by_country_country_groups_options'), array('title' => __('Countries Selection', 'woocommerce-jetpack'), 'desc' => __('Choose how do you want to enter countries groups in admin.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_selection', 'default' => 'chosen_select', 'type' => 'select', 'options' => array('comma_list' => __('Comma separated list', 'woocommerce-jetpack'), 'multiselect' => __('Multiselect', 'woocommerce-jetpack'), 'chosen_select' => __('Chosen select', 'woocommerce-jetpack'))), array('title' => __('Autogenerate Groups', 'woocommerce-jetpack'), 'id' => 'wcj_' . $this->id . '_module_tools', 'type' => 'custom_link', 'link' => '<pre>' . __('Currencies supported in both PayPal and Yahoo Exchange Rates:', 'woocommerce-jetpack') . ' ' . '<a href="' . add_query_arg('wcj_generate_country_groups', 'paypal_and_yahoo_exchange_rates_only', remove_query_arg(array('wcj_generate_country_groups_confirm', 'recalculate_price_filter_products_prices'))) . '">' . __('Generate', 'woocommerce-jetpack') . '</a>.' . '</pre>' . '<pre>' . __('Currencies supported in Yahoo Exchange Rates:', 'woocommerce-jetpack') . ' ' . '<a href="' . add_query_arg('wcj_generate_country_groups', 'yahoo_exchange_rates_only', remove_query_arg(array('wcj_generate_country_groups_confirm', 'recalculate_price_filter_products_prices'))) . '">' . __('Generate', 'woocommerce-jetpack') . '</a>.' . '</pre>' . '<pre>' . __('All Countries and Currencies:', 'woocommerce-jetpack') . ' ' . '<a href="' . add_query_arg('wcj_generate_country_groups', 'all', remove_query_arg(array('wcj_generate_country_groups_confirm', 'recalculate_price_filter_products_prices'))) . '">' . __('Generate', 'woocommerce-jetpack') . '</a>' . '</pre>'), array('title' => __('Groups Number', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_total_groups_number', 'default' => 1, 'type' => 'custom_number', 'desc' => apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => array_merge(is_array(apply_filters('booster_get_message', '', 'readonly')) ? apply_filters('booster_get_message', '', 'readonly') : array(), array('step' => '1', 'min' => '1')), 'css' => 'width:100px;')); for ($i = 1; $i <= apply_filters('booster_get_option', 1, get_option('wcj_price_by_country_total_groups_number', 1)); $i++) { switch (get_option('wcj_price_by_country_selection', 'comma_list')) { case 'comma_list': $settings[] = array('title' => __('Group', 'woocommerce-jetpack') . ' #' . $i, 'desc' => __('Countries. List of comma separated country codes.<br>For country codes and predifined sets visit <a href="http://booster.io/features/prices-and-currencies-by-customers-country" target="_blank">http://booster.io</a>', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_exchange_rate_countries_group_' . $i, 'default' => '', 'type' => 'textarea', 'css' => 'width:50%;min-width:300px;height:100px;'); break; case 'multiselect': $settings[] = array('title' => __('Group', 'woocommerce-jetpack') . ' #' . $i, 'id' => 'wcj_price_by_country_countries_group_' . $i, 'default' => '', 'type' => 'multiselect', 'options' => wcj_get_countries(), 'css' => 'width:50%;min-width:300px;height:100px;'); break; case 'chosen_select': $settings[] = array('title' => __('Group', 'woocommerce-jetpack') . ' #' . $i, 'id' => 'wcj_price_by_country_countries_group_chosen_select_' . $i, 'default' => '', 'type' => 'multiselect', 'options' => wcj_get_countries(), 'class' => 'chosen_select', 'css' => 'width:50%;min-width:300px;'); break; } $settings[] = array('title' => '', 'desc' => __('Currency', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_exchange_rate_currency_group_' . $i, 'default' => 'EUR', 'type' => 'select', 'options' => wcj_get_currencies_names_and_symbols()); } $settings[] = array('type' => 'sectionend', 'id' => 'wcj_price_by_country_country_groups_options'); $settings[] = array('title' => __('Exchange Rates', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => '', 'id' => 'wcj_price_by_country_exchange_rate_options'); $settings[] = array('title' => __('Exchange Rates Updates', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_auto_exchange_rates', 'default' => 'manual', 'type' => 'select', 'options' => array('manual' => __('Enter Rates Manually', 'woocommerce-jetpack'), 'auto' => __('Automatically via Currency Exchange Rates module', 'woocommerce-jetpack')), 'desc' => '' == apply_filters('booster_get_message', '', 'desc') ? __('Visit', 'woocommerce-jetpack') . ' <a href="' . admin_url('admin.php?page=wc-settings&tab=jetpack&wcj-cat=prices_and_currencies§ion=currency_exchange_rates') . '">' . __('Currency Exchange Rates module', 'woocommerce-jetpack') . '</a>' : apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => apply_filters('booster_get_message', '', 'disabled')); $currency_from = apply_filters('woocommerce_currency', get_option('woocommerce_currency')); for ($i = 1; $i <= apply_filters('booster_get_option', 1, get_option('wcj_price_by_country_total_groups_number', 1)); $i++) { $currency_to = get_option('wcj_price_by_country_exchange_rate_currency_group_' . $i); $custom_attributes = array('currency_from' => $currency_from, 'currency_to' => $currency_to, 'multiply_by_field_id' => 'wcj_price_by_country_exchange_rate_group_' . $i); if ($currency_from == $currency_to) { $custom_attributes['disabled'] = 'disabled'; } $settings[] = array('title' => __('Group', 'woocommerce-jetpack') . ' #' . $i, 'desc' => __('Multiply Price by', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_exchange_rate_group_' . $i, 'default' => 1, 'type' => 'exchange_rate', 'css' => 'width:100px;', 'custom_attributes' => array('step' => '0.000001', 'min' => '0'), 'custom_attributes_button' => $custom_attributes, 'value' => $currency_from . '/' . $currency_to, 'value_title' => sprintf(__('Grab %s rate from Yahoo.com', 'woocommerce-jetpack'), $currency_from . '/' . $currency_to)); /* $settings[] = array( 'title' => '', //'id' => 'wcj_price_by_country_exchange_rate_refresh_group_' . $i, 'class' => 'exchage_rate_button', 'type' => 'custom_number', 'css' => 'width:300px;', 'value' => sprintf( __( '%s rate from Yahoo.com', 'woocommerce-jetpack' ), $currency_from . '/' . $currency_to ), 'custom_attributes' => $custom_attributes, ); */ $settings[] = array('title' => '', 'desc' => __('Make empty price', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_make_empty_price_group_' . $i, 'default' => 'no', 'type' => 'checkbox'); } $settings[] = array('type' => 'sectionend', 'id' => 'wcj_price_by_country_exchange_rate_options'); /* $settings = array_merge( $settings, array( array( 'title' => __( 'Country Select Box Customization', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'Only if "by user selection" method selected in "Customer Country Detection Method"', 'woocommerce-jetpack' ), 'id' => 'wcj_price_by_country_country_selection_box_options', ), array( 'title' => __( 'Position', 'woocommerce-jetpack' ), 'id' => 'wcj_price_by_country_country_selection_box_position', 'default' => 'woocommerce_get_price_html', 'type' => 'select', 'options' => array( 'woocommerce_get_price_html' => __( 'woocommerce_get_price_html', 'woocommerce-jetpack' ), ), ), array( 'title' => __( 'Position Priority (Order)', 'woocommerce-jetpack' ), 'id' => 'wcj_price_by_country_country_selection_box_priority', 'default' => 10, 'type' => 'number', ), array( 'title' => __( 'Custom Class', 'woocommerce-jetpack' ), 'id' => 'wcj_price_by_country_country_selection_box_class', 'default' => '', 'type' => 'text', ), array( 'title' => __( 'Custom Style', 'woocommerce-jetpack' ), 'id' => 'wcj_price_by_country_country_selection_box_style', 'default' => '', 'type' => 'text', ), array( 'title' => __( 'Method (GET/POST)', 'woocommerce-jetpack' ), 'id' => 'wcj_price_by_country_country_selection_box_method', 'default' => 'get', 'type' => 'select', 'options' => array( 'get' => __( 'GET', 'woocommerce-jetpack' ), 'post' => __( 'POST', 'woocommerce-jetpack' ), ), ), array( 'type' => 'sectionend', 'id' => 'wcj_price_by_country_country_selection_box_options' ), ) ); */ return $this->add_standard_settings($settings); }
/** * add_settings. */ function add_settings() { $currency_from = get_woocommerce_currency(); $all_currencies = wcj_get_currencies_names_and_symbols(); foreach ($all_currencies as $currency_key => $currency_name) { if ($currency_from == $currency_key) { unset($all_currencies[$currency_key]); } } $settings = array(array('title' => __('Options', 'woocommerce-jetpack'), 'type' => 'title', 'id' => 'wcj_multicurrency_base_price_options'), array('title' => __('Exchange Rates Updates', 'woocommerce-jetpack'), 'id' => 'wcj_multicurrency_base_price_exchange_rate_update', 'default' => 'manual', 'type' => 'select', 'options' => array('manual' => __('Enter Rates Manually', 'woocommerce-jetpack'), 'auto' => __('Automatically via Currency Exchange Rates module', 'woocommerce-jetpack')), 'desc' => '' == apply_filters('booster_get_message', '', 'desc') ? __('Visit', 'woocommerce-jetpack') . ' <a href="' . admin_url('admin.php?page=wc-settings&tab=jetpack&wcj-cat=prices_and_currencies§ion=currency_exchange_rates') . '">' . __('Currency Exchange Rates module', 'woocommerce-jetpack') . '</a>' : apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => apply_filters('booster_get_message', '', 'disabled')), array('type' => 'sectionend', 'id' => 'wcj_multicurrency_base_price_options'), array('title' => __('Currencies Options', 'woocommerce-jetpack'), 'type' => 'title', 'id' => 'wcj_multicurrency_base_price_currencies_options'), array('title' => __('Total Currencies', 'woocommerce-jetpack'), 'id' => 'wcj_multicurrency_base_price_total_number', 'default' => 1, 'type' => 'custom_number', 'desc' => apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => array_merge(is_array(apply_filters('booster_get_message', '', 'readonly')) ? apply_filters('booster_get_message', '', 'readonly') : array(), array('step' => '1', 'min' => '1')))); $total_number = apply_filters('booster_get_option', 1, get_option('wcj_multicurrency_base_price_total_number', 1)); for ($i = 1; $i <= $total_number; $i++) { $currency_to = get_option('wcj_multicurrency_base_price_currency_' . $i, $currency_from); $custom_attributes = array('currency_from' => $currency_from, 'currency_to' => $currency_to, 'multiply_by_field_id' => 'wcj_multicurrency_base_price_exchange_rate_' . $i); if ($currency_from == $currency_to) { $custom_attributes['disabled'] = 'disabled'; } $settings = array_merge($settings, array(array('title' => __('Currency', 'woocommerce-jetpack') . ' #' . $i, 'id' => 'wcj_multicurrency_base_price_currency_' . $i, 'default' => $currency_from, 'type' => 'select', 'options' => $all_currencies, 'css' => 'width:250px;'), array('title' => '', 'id' => 'wcj_multicurrency_base_price_exchange_rate_' . $i, 'default' => 1, 'type' => 'exchange_rate', 'custom_attributes' => array('step' => '0.000001', 'min' => '0'), 'custom_attributes_button' => $custom_attributes, 'css' => 'width:100px;', 'value' => $currency_from . '/' . $currency_to, 'value_title' => sprintf(__('Grab %s rate from Yahoo.com', 'woocommerce-jetpack'), $currency_from . '/' . $currency_to)))); } $settings = array_merge($settings, array(array('type' => 'sectionend', 'id' => 'wcj_multicurrency_base_price_currencies_options'))); return $settings; }
/** * add_settings. * * @version 2.5.8 * @since 2.5.2 */ function add_settings() { $settings = array(array('title' => __('Formats', 'woocommerce-jetpack'), 'type' => 'title', 'id' => 'wcj_price_formats_options'), array('title' => __('Total Number', 'woocommerce-jetpack'), 'id' => 'wcj_price_formats_total_number', 'default' => 1, 'type' => 'custom_number', 'desc' => apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => array_merge(is_array(apply_filters('booster_get_message', '', 'readonly')) ? apply_filters('booster_get_message', '', 'readonly') : array(), array('step' => '1', 'min' => '0')))); for ($i = 1; $i <= apply_filters('booster_get_option', 1, get_option('wcj_price_formats_total_number', 1)); $i++) { $currency_symbol = wcj_get_currency_symbol(get_option('wcj_price_formats_currency_' . $i, get_woocommerce_currency())); $settings = array_merge($settings, array(array('title' => __('Format', 'woocommerce-jetpack') . ' #' . $i, 'desc' => __('Currency', 'woocommerce-jetpack'), 'id' => 'wcj_price_formats_currency_' . $i, 'default' => get_woocommerce_currency(), 'type' => 'select', 'options' => wcj_get_currencies_names_and_symbols(), 'css' => 'width:300px;'), array('desc' => __('Currency Position', 'woocommerce-jetpack'), 'id' => 'wcj_price_formats_currency_position_' . $i, 'default' => get_option('woocommerce_currency_pos'), 'type' => 'select', 'options' => array('left' => __('Left', 'woocommerce') . ' (' . $currency_symbol . '99.99)', 'right' => __('Right', 'woocommerce') . ' (99.99' . $currency_symbol . ')', 'left_space' => __('Left with space', 'woocommerce') . ' (' . $currency_symbol . ' 99.99)', 'right_space' => __('Right with space', 'woocommerce') . ' (99.99 ' . $currency_symbol . ')'), 'css' => 'width:300px;'), array('desc' => __('Thousand Separator', 'woocommerce-jetpack'), 'id' => 'wcj_price_formats_thousand_separator_' . $i, 'default' => wc_get_price_thousand_separator(), 'type' => 'text', 'css' => 'width:300px;'), array('desc' => __('Decimal Separator', 'woocommerce-jetpack'), 'id' => 'wcj_price_formats_decimal_separator_' . $i, 'default' => wc_get_price_decimal_separator(), 'type' => 'text', 'css' => 'width:300px;'), array('desc' => __('Number of Decimals', 'woocommerce-jetpack'), 'id' => 'wcj_price_formats_number_of_decimals_' . $i, 'default' => wc_get_price_decimals(), 'type' => 'number', 'custom_attributes' => array('min' => 0, 'step' => 1), 'css' => 'width:300px;'), array('desc' => __('WPML Language Code', 'woocommerce-jetpack'), 'desc_tip' => __('Option to set different price formats for different WPML languages. Can be comma separated list. Leave empty to disable.', 'woocommerce-jetpack'), 'id' => 'wcj_price_formats_wpml_language_' . $i, 'default' => '', 'type' => 'text', 'css' => 'width:300px;'))); } $settings = array_merge($settings, array(array('type' => 'sectionend', 'id' => 'wcj_price_formats_options'))); return $settings; }
/** * add_settings. * * @version 2.5.8 * @todo rounding (maybe) */ function add_settings() { $currency_from = get_woocommerce_currency(); $all_currencies = wcj_get_currencies_names_and_symbols(); $settings = array(array('title' => __('Options', 'woocommerce-jetpack'), 'type' => 'title', 'id' => 'wcj_multicurrency_options'), array('title' => __('Exchange Rates Updates', 'woocommerce-jetpack'), 'id' => 'wcj_multicurrency_exchange_rate_update_auto', 'default' => 'manual', 'type' => 'select', 'options' => array('manual' => __('Enter Rates Manually', 'woocommerce-jetpack'), 'auto' => __('Automatically via Currency Exchange Rates module', 'woocommerce-jetpack')), 'desc' => '' == apply_filters('booster_get_message', '', 'desc') ? __('Visit', 'woocommerce-jetpack') . ' <a href="' . admin_url('admin.php?page=wc-settings&tab=jetpack&wcj-cat=prices_and_currencies§ion=currency_exchange_rates') . '">' . __('Currency Exchange Rates module', 'woocommerce-jetpack') . '</a>' : apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => apply_filters('booster_get_message', '', 'disabled')), array('title' => __('Multicurrency on per Product Basis', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'desc_tip' => __('This will add meta boxes in product edit.', 'woocommerce-jetpack'), 'id' => 'wcj_multicurrency_per_product_enabled', 'default' => 'yes', 'type' => 'checkbox'), array('title' => __('Revert Currency to Default on Checkout', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'id' => 'wcj_multicurrency_revert', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Rounding', 'woocommerce-jetpack'), 'desc' => __('If using exchange rates, choose rounding here.', 'woocommerce-jetpack'), 'id' => 'wcj_multicurrency_rounding', 'default' => 'no_round', 'type' => 'select', 'options' => array('no_round' => __('No rounding', 'woocommerce-jetpack'), 'round' => __('Round', 'woocommerce-jetpack'), 'round_up' => __('Round up', 'woocommerce-jetpack'), 'round_down' => __('Round down', 'woocommerce-jetpack'))), array('title' => __('Rounding Precision', 'woocommerce-jetpack'), 'desc' => __('If rounding enabled, set precision here.', 'woocommerce-jetpack'), 'id' => 'wcj_multicurrency_rounding_precision', 'default' => absint(get_option('woocommerce_price_num_decimals', 2)), 'type' => 'number', 'custom_attributes' => array('min' => 0)), array('type' => 'sectionend', 'id' => 'wcj_multicurrency_options'), array('title' => __('Currencies Options', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => __('One currency probably should be set to current (original) shop currency with an exchange rate of 1.', 'woocommerce-jetpack'), 'id' => 'wcj_multicurrency_currencies_options'), array('title' => __('Total Currencies', 'woocommerce-jetpack'), 'id' => 'wcj_multicurrency_total_number', 'default' => 2, 'type' => 'custom_number', 'desc' => apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => array_merge(is_array(apply_filters('booster_get_message', '', 'readonly')) ? apply_filters('booster_get_message', '', 'readonly') : array(), array('step' => '1', 'min' => '2')))); $total_number = apply_filters('booster_get_option', 2, get_option('wcj_multicurrency_total_number', 2)); for ($i = 1; $i <= $total_number; $i++) { $currency_to = get_option('wcj_multicurrency_currency_' . $i, $currency_from); $custom_attributes = array('currency_from' => $currency_from, 'currency_to' => $currency_to, 'multiply_by_field_id' => 'wcj_multicurrency_exchange_rate_' . $i); if ($currency_from == $currency_to) { $custom_attributes['disabled'] = 'disabled'; } $settings = array_merge($settings, array(array('title' => __('Currency', 'woocommerce-jetpack') . ' #' . $i, 'id' => 'wcj_multicurrency_currency_' . $i, 'default' => $currency_from, 'type' => 'select', 'options' => $all_currencies, 'css' => 'width:250px;'), array('title' => '', 'id' => 'wcj_multicurrency_exchange_rate_' . $i, 'default' => 1, 'type' => 'exchange_rate', 'custom_attributes' => array('step' => '0.000001', 'min' => '0'), 'custom_attributes_button' => $custom_attributes, 'css' => 'width:100px;', 'value' => $currency_from . '/' . $currency_to, 'value_title' => sprintf(__('Grab %s rate from Yahoo.com', 'woocommerce-jetpack'), $currency_from . '/' . $currency_to)))); } $settings = array_merge($settings, array(array('type' => 'sectionend', 'id' => 'wcj_multicurrency_currencies_options'))); $settings = array_merge($settings, array(array('title' => __('Role Defaults', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => sprintf(__('Custom roles can be added via "Add/Manage Custom Roles" tool in Booster\'s <a href="%s">General</a> module.', 'woocommerce-jetpack'), admin_url('admin.php?page=wc-settings&tab=jetpack&wcj-cat=emails_and_misc§ion=general')), 'id' => 'wcj_multicurrency_role_defaults_options'), array('title' => __('Roles', 'woocommerce-jetpack'), 'desc' => __('Save settings after you change this option. Leave blank to disable.', 'woocommerce-jetpack'), 'type' => 'multiselect', 'id' => 'wcj_multicurrency_role_defaults_roles', 'default' => '', 'class' => 'chosen_select', 'options' => wcj_get_user_roles_options()))); $module_currencies = array(); for ($i = 1; $i <= $total_number; $i++) { $currency_code = get_option('wcj_multicurrency_currency_' . $i, $currency_from); $module_currencies[$currency_code] = $all_currencies[$currency_code]; } $module_currencies = array_unique($module_currencies); $module_roles = get_option('wcj_multicurrency_role_defaults_roles', ''); if (!empty($module_roles)) { foreach ($module_roles as $role_key) { // wcj_get_user_roles() as $role_key => $role_data $settings = array_merge($settings, array(array('title' => $role_key, 'id' => 'wcj_multicurrency_role_defaults_' . $role_key, 'default' => '', 'type' => 'select', 'options' => array_merge(array('' => __('No default currency', 'woocommerce-jetpack')), $module_currencies)))); } } $settings[] = array('type' => 'sectionend', 'id' => 'wcj_multicurrency_role_defaults_options'); return $settings; }
/** * get_settings. * * @version 2.4.4 */ function get_settings() { $settings = array(array('title' => __('Currency for External Products Options', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => '', 'id' => 'wcj_currency_external_products_options'), array('title' => __('Currency', 'woocommerce-jetpack'), 'desc_tip' => __('Set currency for all external products.', 'woocommerce-jetpack'), 'id' => 'wcj_currency_external_products_symbol', 'default' => 'EUR', 'type' => 'select', 'options' => wcj_get_currencies_names_and_symbols()), array('type' => 'sectionend', 'id' => 'wcj_currency_external_products_options')); return $this->add_standard_settings($settings); }
/** * get_settings. * * @version 2.3.8 */ function get_settings() { $settings = array(array('title' => __('Price by Country Options', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => __('Change product\'s price and currency by customer\'s country. Customer\'s country is detected automatically by IP, or selected by customer manually.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_options'), array('title' => __('Customer Country Detection Method', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_customer_country_detection_method', 'desc' => __('If you choose "by user selection", use [wcj_country_select_drop_down_list] shortcode to display country selection list on frontend.', 'woocommerce-jetpack'), 'default' => 'by_ip', 'type' => 'select', 'options' => array('by_ip' => __('by IP', 'woocommerce-jetpack'), 'by_user_selection' => __('by user selection', 'woocommerce-jetpack'))), array('title' => __('Override Country on Checkout with Billing Country', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_override_on_checkout_with_billing_country', 'desc' => __('Enable.', 'woocommerce-jetpack'), 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Price Rounding', 'woocommerce-jetpack'), 'desc' => __('If you choose to multiply price, set rounding options here.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_rounding', 'default' => 'none', 'type' => 'select', 'options' => array('none' => __('No rounding', 'woocommerce-jetpack'), 'round' => __('Round', 'woocommerce-jetpack'), 'floor' => __('Round down', 'woocommerce-jetpack'), 'ceil' => __('Round up', 'woocommerce-jetpack'))), array('title' => __('Price by Country on per Product Basis', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'desc_tip' => __('This will add meta boxes in product edit.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_local_enabled', 'default' => 'yes', 'type' => 'checkbox'), array('type' => 'sectionend', 'id' => 'wcj_price_by_country_options'), array('title' => __('Country Groups', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => '', 'id' => 'wcj_price_by_country_country_groups_options'), array('title' => __('Groups Number', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_total_groups_number', 'default' => 1, 'type' => 'custom_number', 'desc' => apply_filters('get_wc_jetpack_plus_message', '', 'desc'), 'custom_attributes' => array_merge(is_array(apply_filters('get_wc_jetpack_plus_message', '', 'readonly')) ? apply_filters('get_wc_jetpack_plus_message', '', 'readonly') : array(), array('step' => '1', 'min' => '1')), 'css' => 'width:100px;')); for ($i = 1; $i <= apply_filters('wcj_get_option_filter', 1, get_option('wcj_price_by_country_total_groups_number', 1)); $i++) { $settings[] = array('title' => __('Group', 'woocommerce-jetpack') . ' #' . $i, 'desc' => __('Countries. List of comma separated country codes.<br>For country codes and predifined sets visit <a href="http://booster.io/features/prices-and-currencies-by-customers-country" target="_blank">http://booster.io</a>', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_exchange_rate_countries_group_' . $i, 'default' => '', 'type' => 'textarea', 'css' => 'width:50%;min-width:300px;height:100px;'); /* TODO: Multiselect instead of comma separated list. $settings[] = array( 'title' => __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i, 'id' => 'wcj_price_by_country_countries_group_' . $i, 'default' => '', 'type' => 'multiselect', 'options' => wcj_get_countries(), //'class' => 'chosen_select', 'css' => 'width:50%;min-width:300px;height:100px;', ); */ $settings[] = array('title' => '', 'desc' => __('Currency', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_exchange_rate_currency_group_' . $i, 'default' => 'EUR', 'type' => 'select', 'options' => wcj_get_currencies_names_and_symbols()); } $settings[] = array('type' => 'sectionend', 'id' => 'wcj_price_by_country_country_groups_options'); $settings[] = array('title' => __('Exchange Rates', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => '', 'id' => 'wcj_price_by_country_exchange_rate_options'); $settings[] = array('title' => __('Exchange Rates Updates', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_auto_exchange_rates', 'default' => 'manual', 'type' => 'select', 'options' => array('manual' => __('Enter Rates Manually', 'woocommerce-jetpack'), 'auto' => __('Automatically via Currency Exchange Rates module', 'woocommerce-jetpack')), 'desc' => '' == apply_filters('get_wc_jetpack_plus_message', '', 'desc') ? __('Visit', 'woocommerce-jetpack') . ' <a href="' . admin_url('admin.php?page=wc-settings&tab=jetpack&wcj-cat=prices_and_currencies§ion=currency_exchange_rates') . '">' . __('Currency Exchange Rates module', 'woocommerce-jetpack') . '</a>' : apply_filters('get_wc_jetpack_plus_message', '', 'desc'), 'custom_attributes' => apply_filters('get_wc_jetpack_plus_message', '', 'disabled')); $currency_from = apply_filters('woocommerce_currency', get_option('woocommerce_currency')); for ($i = 1; $i <= apply_filters('wcj_get_option_filter', 1, get_option('wcj_price_by_country_total_groups_number', 1)); $i++) { $currency_to = get_option('wcj_price_by_country_exchange_rate_currency_group_' . $i); $custom_attributes = array('currency_from' => $currency_from, 'currency_to' => $currency_to, 'multiply_by_field_id' => 'wcj_price_by_country_exchange_rate_group_' . $i); if ($currency_from == $currency_to) { $custom_attributes['disabled'] = 'disabled'; } $settings[] = array('title' => __('Group', 'woocommerce-jetpack') . ' #' . $i, 'desc' => __('Multiply Price by', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_exchange_rate_group_' . $i, 'default' => 1, 'type' => 'exchange_rate', 'css' => 'width:100px;', 'custom_attributes' => array('step' => '0.000001', 'min' => '0'), 'custom_attributes_button' => $custom_attributes, 'value' => $currency_from . '/' . $currency_to, 'value_title' => sprintf(__('Grab %s rate from Yahoo.com', 'woocommerce-jetpack'), $currency_from . '/' . $currency_to)); /* $settings[] = array( 'title' => '', //'id' => 'wcj_price_by_country_exchange_rate_refresh_group_' . $i, 'class' => 'exchage_rate_button', 'type' => 'custom_number', 'css' => 'width:300px;', 'value' => sprintf( __( '%s rate from Yahoo.com', 'woocommerce-jetpack' ), $currency_from . '/' . $currency_to ), 'custom_attributes' => $custom_attributes, ); */ $settings[] = array('title' => '', 'desc' => __('Make empty price', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_make_empty_price_group_' . $i, 'default' => 'no', 'type' => 'checkbox'); } $settings[] = array('type' => 'sectionend', 'id' => 'wcj_price_by_country_exchange_rate_options'); /* $settings = array_merge( $settings, array( array( 'title' => __( 'Country Select Box Customization', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'Only if "by user selection" method selected in "Customer Country Detection Method"', 'woocommerce-jetpack' ), 'id' => 'wcj_price_by_country_country_selection_box_options', ), array( 'title' => __( 'Position', 'woocommerce-jetpack' ), 'id' => 'wcj_price_by_country_country_selection_box_position', 'default' => 'woocommerce_get_price_html', 'type' => 'select', 'options' => array( 'woocommerce_get_price_html' => __( 'woocommerce_get_price_html', 'woocommerce-jetpack' ), ), ), array( 'title' => __( 'Position Priority (Order)', 'woocommerce-jetpack' ), 'id' => 'wcj_price_by_country_country_selection_box_priority', 'default' => 10, 'type' => 'number', ), array( 'title' => __( 'Custom Class', 'woocommerce-jetpack' ), 'id' => 'wcj_price_by_country_country_selection_box_class', 'default' => '', 'type' => 'text', ), array( 'title' => __( 'Custom Style', 'woocommerce-jetpack' ), 'id' => 'wcj_price_by_country_country_selection_box_style', 'default' => '', 'type' => 'text', ), array( 'title' => __( 'Method (GET/POST)', 'woocommerce-jetpack' ), 'id' => 'wcj_price_by_country_country_selection_box_method', 'default' => 'get', 'type' => 'select', 'options' => array( 'get' => __( 'GET', 'woocommerce-jetpack' ), 'post' => __( 'POST', 'woocommerce-jetpack' ), ), ), array( 'type' => 'sectionend', 'id' => 'wcj_price_by_country_country_selection_box_options' ), ) ); */ return $this->add_enable_module_setting($settings); }
/** * get_meta_box_options. * * @version 2.5.6 * @since 2.5.6 */ function get_meta_box_options() { $order_id = get_the_ID(); $_order = wc_get_order($order_id); $options = array(array('name' => 'filter' === get_option('wcj_order_admin_currency_method', 'filter') ? 'wcj_order_currency' : 'order_currency', 'default' => $_order->get_order_currency(), 'type' => 'select', 'options' => wcj_get_currencies_names_and_symbols('names'), 'title' => __('Order Currency', 'woocommerce-jetpack'), 'tooltip' => __('Save order after you change this field.', 'woocommerce-jetpack'))); return $options; }
function wcj_get_currency_symbol($currency_code) { $return = ''; $currencies = wcj_get_currencies_names_and_symbols('symbols', 'no_custom'); if (isset($currencies[$currency_code])) { if (wcj_is_module_enabled('currency')) { $return = apply_filters('booster_get_option', $currencies[$currency_code], get_option('wcj_currency_' . $currency_code, $currencies[$currency_code])); } else { $return = $currencies[$currency_code]; } } else { $currencies = wcj_get_currencies_names_and_symbols('symbols', 'custom_only'); $return = isset($currencies[$currency_code]) ? $currencies[$currency_code] : ''; } return '' != $return ? $return : false; }
/** * wcj_country_select_drop_down_list. * * @version 2.5.9 */ function wcj_country_select_drop_down_list($atts, $content) { $html = ''; $form_method = $atts['form_method']; // get_option( 'wcj_price_by_country_country_selection_box_method', 'get' ); $select_class = $atts['class']; // get_option( 'wcj_price_by_country_country_selection_box_class', '' ); $select_style = $atts['style']; // get_option( 'wcj_price_by_country_country_selection_box_style', '' ); $html .= '<form action="" method="' . $form_method . '">'; $html .= '<select name="wcj-country" id="wcj-country" style="' . $select_style . '" class="' . $select_class . '" onchange="this.form.submit()">'; $countries = wcj_get_countries(); /* $shortcode_countries = get_option( 'wcj_price_by_country_shortcode_countries', array() ); if ( '' == $shortcode_countries ) $shortcode_countries = array(); */ $shortcode_countries = $atts['countries']; if ('' == $shortcode_countries) { $shortcode_countries = array(); } else { $shortcode_countries = str_replace(' ', '', $shortcode_countries); $shortcode_countries = trim($shortcode_countries, ','); $shortcode_countries = explode(',', $shortcode_countries); } /* if ( 'get' == $form_method ) { $selected_country = ( isset( $_GET[ 'wcj-country' ] ) ) ? $_GET[ 'wcj-country' ] : ''; } else { $selected_country = ( isset( $_POST[ 'wcj-country' ] ) ) ? $_POST[ 'wcj-country' ] : ''; } */ $selected_country = isset($_SESSION['wcj-country']) ? $_SESSION['wcj-country'] : ''; if ('yes' === $atts['replace_with_currency']) { $currencies_names_and_symbols = wcj_get_currencies_names_and_symbols(); } if (empty($shortcode_countries)) { foreach ($countries as $country_code => $country_name) { $data_icon = ''; if ('yes' === get_option('wcj_price_by_country_jquery_wselect_enabled', 'no')) { $data_icon = ' data-icon="' . wcj_plugin_url() . '/assets/images/flag-icons/' . strtolower($country_code) . '.png"'; } $option_label = 'yes' === $atts['replace_with_currency'] ? $currencies_names_and_symbols[wcj_get_currency_by_country($country_code)] : $country_name; $html .= '<option' . $data_icon . ' value="' . $country_code . '" ' . selected($country_code, $selected_country, false) . '>' . $option_label . '</option>'; } } else { foreach ($shortcode_countries as $country_code) { if (isset($countries[$country_code])) { $data_icon = ''; if ('yes' === get_option('wcj_price_by_country_jquery_wselect_enabled', 'no')) { $data_icon = ' data-icon="' . wcj_plugin_url() . '/assets/images/flag-icons/' . strtolower($country_code) . '.png"'; } $option_label = 'yes' === $atts['replace_with_currency'] ? $currencies_names_and_symbols[wcj_get_currency_by_country($country_code)] : $countries[$country_code]; $html .= '<option' . $data_icon . ' value="' . $country_code . '" ' . selected($country_code, $selected_country, false) . '>' . $option_label . '</option>'; } } } $html .= '</select>'; $html .= '</form>'; return $html; }
/** * get_settings. * * @version 2.4.4 */ function get_settings() { $settings = array(array('title' => __('Currency Symbol Options', 'woocommerce-jetpack'), 'type' => 'title', 'id' => 'wcj_all_currencies_list_options'), array('title' => __('Hide Currency Symbol', 'woocommerce-jetpack'), 'desc' => __('Hide', 'woocommerce-jetpack'), 'desc_tip' => __('Default: no.', 'woocommerce-jetpack'), 'id' => 'wcj_currency_hide_symbol', 'default' => 'no', 'type' => 'checkbox')); $currency_names = wcj_get_currencies_names_and_symbols('names', 'no_custom'); $currency_symbols = wcj_get_currencies_names_and_symbols('symbols', 'no_custom'); foreach ($currency_names as $currency_code => $currency_name) { $settings[] = array('title' => $currency_name, 'desc_tip' => apply_filters('booster_get_message', '', 'desc_no_link'), 'id' => 'wcj_currency_' . $currency_code, 'default' => $currency_symbols[$currency_code], 'type' => 'text', 'custom_attributes' => apply_filters('booster_get_message', '', 'readonly')); } $settings[] = array('type' => 'sectionend', 'id' => 'wcj_all_currencies_list_options'); $settings[] = array('title' => __('Custom Currencies', 'woocommerce-jetpack'), 'type' => 'title', 'id' => 'wcj_currency_custom_currency_options'); $settings[] = array('title' => __('Total Custom Currencies', 'woocommerce-jetpack'), 'id' => 'wcj_currency_custom_currency_total_number', 'default' => 1, 'type' => 'custom_number', 'desc' => apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => apply_filters('booster_get_message', '', 'readonly')); $custom_currency_total_number = apply_filters('booster_get_option', 1, get_option('wcj_currency_custom_currency_total_number', 1)); for ($i = 1; $i <= $custom_currency_total_number; $i++) { $settings[] = array('title' => __('Custom Currency', 'woocommerce-jetpack') . ' #' . $i, 'desc' => __('Currency Name (required)', 'woocommerce-jetpack'), 'id' => 'wcj_currency_custom_currency_name_' . $i, 'default' => '', 'type' => 'text'); $settings[] = array('title' => '', 'desc' => __('Currency Code (required)', 'woocommerce-jetpack'), 'id' => 'wcj_currency_custom_currency_code_' . $i, 'default' => '', 'type' => 'text'); $settings[] = array('title' => '', 'desc' => __('Currency Symbol', 'woocommerce-jetpack'), 'id' => 'wcj_currency_custom_currency_symbol_' . $i, 'default' => '', 'type' => 'text'); } $settings[] = array('type' => 'sectionend', 'id' => 'wcj_currency_custom_currency_options'); return $this->add_standard_settings($settings); }