public static function output()
    {
        global $post, $thepostid;
        $thepostid = $post->ID;
        $_product = wc_get_product($thepostid);
        $terms = array();
        $delivery_time = $_product->gzd_product->delivery_time;
        woocommerce_wp_select(array('id' => '_unit', 'label' => __('Unit', 'woocommerce-germanized'), 'options' => array_merge(array('none' => __('Select unit', 'woocommerce-germanized')), WC_germanized()->units->get_units()), 'desc_tip' => true, 'description' => __('Needed if selling on a per unit basis', 'woocommerce-germanized')));
        woocommerce_wp_text_input(array('id' => '_unit_base', 'label' => __('Unit Base', 'woocommerce-germanized'), 'data_type' => 'decimal', 'desc_tip' => true, 'description' => __('Unit price per amount (e.g. 100)', 'woocommerce-germanized')));
        woocommerce_wp_text_input(array('id' => '_unit_price_regular', 'label' => __('Regular Unit Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
        woocommerce_wp_text_input(array('id' => '_unit_price_sale', 'label' => __('Sale Unit Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
        if (version_compare(WC()->version, '2.3', '<')) {
            return;
        }
        ?>
		
		<p class="form-field">
			<label for="delivery_time"><?php 
        _e('Delivery Time', 'woocommerce-germanized');
        ?>
</label>
			<input type="hidden" class="wc-product-search wc-gzd-delivery-time-search" style="width: 50%" id="delivery_time" name="delivery_time" data-minimum_input_length="1" data-allow_clear="true" data-placeholder="<?php 
        _e('Search for a delivery time&hellip;', 'woocommerce-germanized');
        ?>
" data-action="woocommerce_gzd_json_search_delivery_time" data-multiple="false" data-selected="<?php 
        echo $delivery_time ? $delivery_time->name : '';
        ?>
" value="<?php 
        echo $delivery_time ? $delivery_time->term_id : '';
        ?>
" />
		</p>
		
		<?php 
    }
 /**
  * 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);
 }
 function pt_price_filter_init()
 {
     if (function_exists('WC')) {
         $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '';
         wp_register_script('wc-price-slider', WC()->plugin_url() . '/assets/js/frontend/price-slider' . $suffix . '.js', array('jquery-ui-slider'), WC_VERSION, true);
         wp_localize_script('wc-price-slider', 'woocommerce_price_slider_params', array('currency_symbol' => get_woocommerce_currency_symbol(), 'currency_pos' => get_option('woocommerce_currency_pos'), 'min_price' => isset($_GET['min_price']) ? esc_attr($_GET['min_price']) : '', 'max_price' => isset($_GET['max_price']) ? esc_attr($_GET['max_price']) : ''));
         //add_filter( 'loop_shop_post_in', array( $this, 'price_filter' ) );
     }
 }
function auto_update_cart_total()
{
    // Only run in the Cart
    if (is_cart()) {
        global $woocommerce;
        ?>
        <script>
            jQuery(function($){
			   var 	currency = '<?php 
        echo get_woocommerce_currency_symbol();
        ?>
';
			   $('input[name*="qty"]').change(function(){
					var quantity_number = $(this).val();
					var prices = $(this).closest('.cart_item').find('.product-price').find('.amount').html().replace(/[^0-9\.]+/g,"");
					var sub_total = quantity_number*prices;
					$(this).closest('.cart_item').find('.product-subtotal').find('.amount').html(currency+sub_total.toFixed(2));				
					var sum = 0;
					setTimeout(function(){
						$('.product-subtotal .amount').each(function(){
							var $amt = $(this);
							sum += parseFloat($amt.html().replace(/[^0-9\.]+/g,""));
							$('.cart-subtotal .amount').html(currency+sum.toFixed(2));
							$('.order-total .amount').html(currency+sum.toFixed(2));		
						})
					}, 300);					
				})
            });
        </script>
    <?php 
    }
}
 /**
  * Gets woocommerce store options that are useful for all connect services
  *
  * @return object|array
  */
 public function get_store_options()
 {
     $currency_symbol = sanitize_text_field(html_entity_decode(get_woocommerce_currency_symbol()));
     $dimension_unit = sanitize_text_field(strtolower(get_option('woocommerce_dimension_unit')));
     $weight_unit = sanitize_text_field(strtolower(get_option('woocommerce_weight_unit')));
     return array('currency_symbol' => $currency_symbol, 'dimension_unit' => $this->translate_unit($dimension_unit), 'weight_unit' => $this->translate_unit($weight_unit));
 }
    function setcommision_layout($sid)
    {
        if (is_admin()) {
            global $wpdb;
            /*if(isset($_POST['commision']))
				{
				$wpdb->get_results("update {$wpdb->prefix}mpcommision set commision_on_seller='".$_POST['commision']."' where seller_id=$sid");
				}*/
            $com_res = $wpdb->get_results("select * from {$wpdb->prefix}mpcommision  where seller_id={$sid}");
            $cur_symbol = get_woocommerce_currency_symbol(get_option('woocommerce_currency'));
            ?>
					<div id='admincommision'>
					<h2> Set Seller Commision </h2>
						<form action="<?php 
            echo get_home_url() . '/wp-admin/admin.php?page=Commissions&sid=' . $sid;
            ?>
" method='post' name='commision-form'>
						<table>
							<tr>
								<th style="text-align: left;"><label for='commision'>Commision in fixed Rate</label></th>
								<td><input type='text' title='commision in %' name='commision' value='<?php 
            echo $com_res[0]->commision_on_seller . ' %';
            ?>
' id='commisionid' /></td>
							</tr>
							<tr><th style="text-align: left;"><label for='totalsale'>Total Sale</label></th>
								<td><input type='text' name='totalsale' value='<?php 
            echo $com_res[0]->last_com_on_total . ' ' . $cur_symbol;
            ?>
 public function enqueue_styles()
 {
     global $post;
     if (WBM_Frontend_Product::wbm_enabled($post->ID)) {
         wp_enqueue_style('wbm_style_grids', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/css/grid.css', false);
         wp_enqueue_style('wbm_style_tooltip', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/css/tooltipster.css', false);
         wp_enqueue_style('wbm_style_checkbox', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/css/fm.checkator.css', false);
         wp_enqueue_style('wbm_style_switch', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/css/lc_switch.css', false);
         wp_enqueue_style('wbm_style_datetimepicker', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/css/jquery.datetimepicker.css', false);
         wp_enqueue_style('wbm_style_accordion', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/css/smk-accordion.css', false);
         wp_enqueue_style('wbm_style_alert', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/css/jquery.alerts.css', false);
         wp_enqueue_style('wbm_style_frontend', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/css/style.css', false);
         wp_enqueue_script('wbm_script_underscore', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/js/underscore-min.js', array('jquery'), null, true);
         wp_enqueue_script('wbm_script_chekbox', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/js/fm.checkator.jquery.js', array('jquery'), null, true);
         wp_enqueue_script('wbm_script_switch', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/js/lc_switch.min.js', array('jquery'), null, true);
         wp_enqueue_script('wbm_script_datetimepicker', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/js/jquery.datetimepicker.full.js', array('jquery'), null, true);
         wp_enqueue_script('wbm_script_tabs', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/js/jquery.responsiveTabs.js', array('jquery'), null, true);
         wp_enqueue_script('wbm_script_accordion', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/js/smk-accordion.min.js', array('jquery'), null, true);
         wp_enqueue_script('wbm_script_alert', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/js/jquery.alerts.js', array('jquery'), null, true);
         wp_enqueue_script('wbm_script_tooltip', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/js/jquery.tooltipster.min.js', array('jquery'), null, true);
         wp_register_script('wbm_script_frontend', WBM_PLUGIN_ABSOLUTE_PATH . 'assets/js/wbm.frontend.js', array('jquery'), null, true);
         wp_localize_script('wbm_script_frontend', 'wbm_params', array('ajaxURL' => admin_url('admin-ajax.php'), 'yes_string' => __('Yes', 'wbm'), 'no_string' => __('No', 'wbm'), 'no_want' => __("I don't want this service", "wbm"), 'yes_want' => __("I want this service", "wbm"), 'currency_symbol' => get_woocommerce_currency_symbol(), 'alert_heading' => 'Error', 'alert_msg' => __('Please fill up all fields', 'wbm'), 'confirm_heading' => __('Confirmation', 'wbm'), 'confirm_msg' => __('Are you sure to book?', 'wbm'), 'choose_first_option_msg' => __('Please choose any option first', 'wbm')));
         wp_enqueue_script('wbm_script_frontend');
     }
 }
function add_price_column_content($value, $column_name, $id)
{
    $price = get_tax_meta($id, 'print_variation_price');
    $priceFormatted = number_format($price, 2, '.', '');
    $symbol = get_woocommerce_currency_symbol();
    return $symbol . $priceFormatted;
}
 /**
  * Enqueue addon scripts
  */
 function addon_scripts()
 {
     wp_register_style('woocommerce-better-addons', plugins_url(basename(dirname(dirname(__FILE__)))) . '/assets/css/frontend.css', '', '0.3.2');
     wp_enqueue_style('woocommerce-better-addons');
     wp_register_script('accounting', plugins_url(basename(dirname(dirname(__FILE__)))) . '/assets/js/accounting.js', '', '0.3.2');
     wp_enqueue_script('woocommerce-addons', plugins_url(basename(dirname(dirname(__FILE__)))) . '/assets/js/addons.js', array('jquery', 'accounting'), '1.0', true);
     $params = array('i18n_addon_total' => __('Options total:', 'wc_product_addons'), 'i18n_grand_total' => __('Total:', 'wc_product_addons'), 'i18n_remaining' => __('characters remaining', 'wc_product_addons'), 'currency_format_num_decimals' => absint(get_option('woocommerce_price_num_decimals')), 'currency_format_symbol' => get_woocommerce_currency_symbol(), 'currency_format_decimal_sep' => esc_attr(stripslashes(get_option('woocommerce_price_decimal_sep'))), 'currency_format_thousand_sep' => esc_attr(stripslashes(get_option('woocommerce_price_thousand_sep'))));
     if (!function_exists('get_woocommerce_price_format')) {
         $currency_pos = get_option('woocommerce_currency_pos');
         switch ($currency_pos) {
             case 'left':
                 $format = '%1$s%2$s';
                 break;
             case 'right':
                 $format = '%2$s%1$s';
                 break;
             case 'left_space':
                 $format = '%1$s&nbsp;%2$s';
                 break;
             case 'right_space':
                 $format = '%2$s&nbsp;%1$s';
                 break;
         }
         $params['currency_format'] = esc_attr(str_replace(array('%1$s', '%2$s'), array('%s', '%v'), $format));
     } else {
         $params['currency_format'] = esc_attr(str_replace(array('%1$s', '%2$s'), array('%s', '%v'), get_woocommerce_price_format()));
     }
     wp_localize_script('woocommerce-addons', 'woocommerce_addons_params', $params);
 }
 public function add_fields($regular_price, $selling_price, $thepostid, $user_role_key, $name)
 {
     $allowed_currency = get_option(rbp_key . 'acs_allowed_currencies');
     $this->acs_get_db_price($thepostid);
     echo '<div class="wc_rbp_plugin_field_container">';
     echo '<hr/> <h3>' . __('Role Based Price for Aelia Currency Switcher', lang_dom) . '</h3>';
     foreach ($allowed_currency as $currency) {
         $symbol = get_woocommerce_currency_symbol($currency);
         $symbol = !empty($symbol) ? ' (' . $symbol . ') ' : ' (' . $currency . ') ';
         if ($regular_price) {
             echo '<p class="form-field ' . $currency . '_regular_price_' . $user_role_key . '_field form-row-first">
                         <label for="' . $currency . '_regular_price_' . $user_role_key . '_field">' . __('Regular Price' . $symbol, lang_dom) . '</label>
                         <input type="text" id="' . $currency . '_regular_price_' . $user_role_key . '_field"
                                name="acs[' . $user_role_key . '][' . $currency . '][regular_price]" class="short wc_input_price"
                                value="' . $this->acs_crp($currency, $user_role_key, 'regular_price') . '">
                         </p>';
         }
         if ($selling_price) {
             echo '<p class="form-field ' . $currency . '_selling_price_' . $user_role_key . '_field form-row-last">
                 <label for="' . $currency . '_selling_price_' . $user_role_key . '_field">' . __('Selling Price' . $symbol, lang_dom) . '</label>
                 <input type="text"  id="' . $currency . '_selling_price_' . $user_role_key . '_field"
                        name="acs[' . $user_role_key . '][' . $currency . '][selling_price]" class="short wc_input_price"
                        value="' . $this->acs_crp($currency, $user_role_key, 'selling_price') . '" >
                 </p>';
         }
     }
     echo ' </div>';
 }
function add_checkout_options()
{
    global $woocommerce;
    $vendor_ids = array();
    foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {
        if (!in_array($cart_item['data']->post->post_author, $vendor_ids)) {
            $vendor_ids[] = $cart_item['data']->post->post_author;
        }
    }
    ?>
        <div class="your-order">
            <?php 
    foreach ($vendor_ids as $vendor_id) {
        $store_settings = dokan_get_store_info($vendor_id);
        $shipping_charge = get_user_meta($vendor_id, 'dokan_enable_seller_shipping', true);
        $seller_shipping_charge = get_user_meta($vendor_id, 'dokan_seller_shipping_charge', true);
        $currency_symbol = get_woocommerce_currency_symbol();
        ?>

                    <span class="order-title"><?php 
        echo $store_settings['store_name'];
        ?>
</span>
                    <div class="order-raw">
                        <input type="radio" name="dokan_product_shipping_choice[<?php 
        echo $vendor_id;
        ?>
]" class="dokan_product_shipping_choice" data-id="<?php 
        echo $vendor_id;
        ?>
" value="dokan_product_pick_at_farm">
                        <label>Pick up at the farm (<?php 
        echo $store_settings['address'];
        ?>
)</label>
                        <?php 
        if ($shipping_charge == "yes") {
            ?>
                            <input type="radio" name="dokan_product_shipping_choice[<?php 
            echo $vendor_id;
            ?>
]" class="dokan_product_shipping_choice" data-id="<?php 
            echo $vendor_id;
            ?>
" value="dokan_product_shipping">
                            <label>Shipping (<?php 
            echo $currency_symbol . " " . $seller_shipping_charge;
            ?>
)</label>
                        <?php 
        }
        ?>
    
                    </div>
                <?php 
    }
    ?>
        </div>  
<?php 
}
 /**
  * Load price input script
  *
  * @return void
  */
 function nyp_scripts()
 {
     wp_enqueue_script('accounting');
     wp_enqueue_script('woocommerce-nyp');
     $params = array('currency_format_num_decimals' => esc_attr(wc_nyp_get_price_decimals()), 'currency_format_symbol' => get_woocommerce_currency_symbol(), 'currency_format_decimal_sep' => esc_attr(wc_nyp_get_price_decimal_separator()), 'currency_format_thousand_sep' => esc_attr(wc_nyp_get_price_thousand_separator()), 'currency_format' => esc_attr(str_replace(array('%1$s', '%2$s'), array('%s', '%v'), get_woocommerce_price_format())), 'annual_price_factors' => WC_Name_Your_Price_Helpers::annual_price_factors(), 'minimum_error' => WC_Name_Your_Price_Helpers::error_message('minimum_js'));
     wp_localize_script('woocommerce-nyp', 'woocommerce_nyp_params', $params);
 }
 /**
  * Get the accounting format from user settings
  * POS uses a plugin to format currency: http://josscrowcroft.github.io/accounting.js/
  *
  * @return array $settings
  */
 private function accounting()
 {
     $decimal = get_option('woocommerce_price_decimal_sep');
     $thousand = get_option('woocommerce_price_thousand_sep');
     $precision = get_option('woocommerce_price_num_decimals');
     return array('currency' => array('decimal' => $decimal, 'format' => $this->currency_format(), 'precision' => $precision, 'symbol' => get_woocommerce_currency_symbol(get_woocommerce_currency()), 'thousand' => $thousand), 'number' => array('decimal' => $decimal, 'precision' => $precision, 'thousand' => $thousand));
 }
 /**
  * Register the stylesheets for the public-facing side of the site.
  *
  * @since    1.0.0
  */
 public function enqueue_scripts()
 {
     global $post, $product;
     if (is_object($post) && class_exists('WooCommerce')) {
         $is_product_type_variable = 'false';
         if (function_exists('wc_get_product')) {
             $product = wc_get_product($post);
             if ($product) {
                 if ($product->is_type('variable') && is_single()) {
                     $is_product_type_variable = 'true';
                 }
             }
         }
         $attach_id = isset($_SESSION['attach_id']) && !empty($_SESSION['attach_id']) ? $_SESSION['attach_id'] : '';
         if (!empty($attach_id)) {
             $total_word = get_post_meta($attach_id, 'total_word', true);
         } else {
             $total_word = '';
         }
         if (!empty($attach_id)) {
             $total_character = get_post_meta($attach_id, 'total_character', true);
         } else {
             $total_character = '';
         }
         wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/woocommerce-price-per-word-public.js', array('jquery'), $this->version, false);
         if (wp_script_is($this->plugin_name)) {
             wp_localize_script($this->plugin_name, 'woocommerce_price_per_word_params', apply_filters('woocommerce_price_per_word_params', array('ajax_url' => admin_url('admin-ajax.php'), 'woocommerce_price_per_word_params_nonce' => wp_create_nonce("woocommerce_price_per_word_params_nonce"), 'total_word' => $total_word, 'total_character' => $total_character, 'is_product_type_variable' => $is_product_type_variable, 'woocommerce_currency_symbol_js' => get_woocommerce_currency_symbol(), 'woocommerce_price_num_decimals' => wc_get_price_decimals(), 'aewcppw_word_character' => $this->wppw_get_product_type(), 'aewcppw_allow_users_to_enter_qty' => $this->aewcppw_allow_users_to_enter_qty())));
         }
         wp_enqueue_script($this->plugin_name . '-bn', plugin_dir_url(__FILE__) . 'js/woocommerce-price-per-word-bn.js', array('jquery'), $this->version, false);
     }
 }
 /**
  * Enqueue addon scripts
  */
 public function addon_scripts()
 {
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     wp_register_script('accounting', plugins_url(basename(dirname(dirname(__FILE__)))) . '/assets/js/accounting' . $suffix . '.js', '', '0.3.2');
     wp_enqueue_script('woocommerce-addons', plugins_url(basename(dirname(dirname(__FILE__)))) . '/assets/js/addons' . $suffix . '.js', array('jquery', 'accounting'), '1.0', true);
     $params = array('price_display_suffix' => esc_attr(get_option('woocommerce_price_display_suffix')), 'ajax_url' => WC()->ajax_url(), 'i18n_addon_total' => __('Options total:', 'grmpd-frames'), 'i18n_grand_total' => __('Grand total:', 'grmpd-frames'), 'i18n_remaining' => __('characters remaining', 'grmpd-frames'), 'currency_format_num_decimals' => absint(get_option('woocommerce_price_num_decimals')), 'currency_format_symbol' => get_woocommerce_currency_symbol(), 'currency_format_decimal_sep' => esc_attr(stripslashes(get_option('woocommerce_price_decimal_sep'))), 'currency_format_thousand_sep' => esc_attr(stripslashes(get_option('woocommerce_price_thousand_sep'))));
     if (!function_exists('get_woocommerce_price_format')) {
         $currency_pos = get_option('woocommerce_currency_pos');
         switch ($currency_pos) {
             case 'left':
                 $format = '%1$s%2$s';
                 break;
             case 'right':
                 $format = '%2$s%1$s';
                 break;
             case 'left_space':
                 $format = '%1$s&nbsp;%2$s';
                 break;
             case 'right_space':
                 $format = '%2$s&nbsp;%1$s';
                 break;
         }
         $params['currency_format'] = esc_attr(str_replace(array('%1$s', '%2$s'), array('%s', '%v'), $format));
     } else {
         $params['currency_format'] = esc_attr(str_replace(array('%1$s', '%2$s'), array('%s', '%v'), get_woocommerce_price_format()));
     }
     wp_localize_script('woocommerce-addons', 'grmpd_frames_params', $params);
 }
function woo_add_custom_wholesale_price_fields()
{
    global $woocommerce, $post;
    echo '<div class="options_group">';
    woocommerce_wp_text_input(array('id' => '_wholesale_price', 'label' => __('Wholesale Price (' . get_woocommerce_currency_symbol() . ')', 'woocommerce'), 'desc_tip' => 'true', 'description' => __('Price will be applicable only for wholesale customers', 'woocommerce')));
    echo '</div>';
}
 public function add_field_funkwoocost()
 {
     global $woocommerce, $post;
     echo '<div class="options_group">';
     woocommerce_wp_text_input(array('id' => '_funkwoocost', 'label' => sprintf(__('Product Cost (%s)', 'funkwoocost'), get_woocommerce_currency_symbol()), 'placeholder' => '', 'description' => __('Add product cost for profit report.', 'funkwoocost'), 'type' => 'number'));
     echo '</div>';
 }
 function define_fields()
 {
     if ($this->product_fields) {
         return;
     }
     // Fields
     $this->product_fields = array('start_group', array('id' => '_software_product_id', 'label' => __('Product ID', 'wc_software'), 'description' => __('This ID is used for the licence key API.', 'wc_software'), 'placeholder' => __('e.g. SOFTWARE1', 'wc_software'), 'type' => 'text'), array('id' => '_software_license_key_prefix', 'label' => __('License key prefix', 'wc_software'), 'description' => __('Optional prefix for generated license keys.', 'wc_software'), 'placeholder' => __('N/A', 'wc_software'), 'type' => 'text'), array('id' => '_software_secret_product_key', 'label' => __('Secret key', 'wc_software'), 'description' => __('Secret Product Key to use  for API.', 'wc_software'), 'placeholder' => __('any random string', 'wc_software'), 'type' => 'text', 'value' => substr(str_shuffle(MD5(microtime())), 0, 32)), array('id' => '_software_version', 'label' => __('Version', 'wc_software'), 'description' => __('Version number for the software.', 'wc_software'), 'placeholder' => __('e.g. 1.0', 'wc_software'), 'type' => 'text'), array('id' => '_software_activations', 'label' => __('Activation limit', 'wc_software'), 'description' => __('Amount of activations possible per licence key.', 'wc_software'), 'placeholder' => __('Unlimited', 'wc_software'), 'type' => 'text'), 'end_group', 'start_group', array('id' => '_software_upgradable_product', 'label' => __('Upgradable product', 'wc_software'), 'description' => __('Name of the product which can be upgraded.', 'wc_software'), 'placeholder' => '', 'type' => 'text'), array('id' => '_software_upgrade_price', 'label' => __('Upgrade Price', 'wc_software') . ' (' . get_woocommerce_currency_symbol() . ')', 'description' => __('Users with a valid upgrade key will be able to pay this amount.', 'wc_software'), 'placeholder' => __('e.g. 10.99', 'wc_software'), 'class' => 'wc_input_price short', 'type' => 'text'), array('id' => '_software_upgrade_license_keys', 'label' => __('Valid upgrade keys', 'wc_software'), 'description' => __('A comma separated list of keys which can be upgraded.', 'wc_software'), 'placeholder' => '', 'type' => 'textarea'), array('id' => '_software_used_license_keys', 'label' => __('Used upgrade keys', 'wc_software'), 'description' => __('A comma separated list of keys which have been used for an upgrade already.', 'wc_software'), 'placeholder' => '', 'type' => 'textarea'), 'end_group');
 }
Beispiel #19
0
function aa_woocommerce_options()
{
    include_once ABSPATH . 'wp-admin/includes/plugin.php';
    $woo_opts = null;
    if (is_plugin_active('woocommerce/woocommerce.php')) {
        $woo_opts = ['shop_page_id' => get_option('woocommerce_shop_page_id'), 'shop_page_slug' => aa_getpostslugbyid(get_option('woocommerce_shop_page_id')), 'cart_page_id' => get_option('woocommerce_cart_page_id'), 'cart_page_slug' => aa_getpostslugbyid(get_option('woocommerce_cart_page_id')), 'checkout_page_id' => get_option('woocommerce_checkout_page_id'), 'checkout_page_slug' => aa_getpostslugbyid(get_option('woocommerce_checkout_page_id')), 'pay_page_id' => get_option('woocommerce_pay_page_id'), 'pay_page_slug' => aa_getpostslugbyid(get_option('woocommerce_pay_page_id')), 'thanks_page_id' => get_option('woocommerce_thanks_page_id'), 'thanks_page_slug' => aa_getpostslugbyid(get_option('woocommerce_thanks_page_id')), 'myaccount_page_id' => get_option('woocommerce_myaccount_page_id'), 'myaccount_page_slug' => aa_getpostslugbyid(get_option('woocommerce_myaccount_page_id')), 'edit_address_page_id' => get_option('woocommerce_edit_address_page_id'), 'edit_address_page_slug' => aa_getpostslugbyid(get_option('woocommerce_edit_address_page_id')), 'view_order_page_id' => get_option('woocommerce_view_order_page_id'), 'view_order_page_slug' => aa_getpostslugbyid(get_option('woocommerce_view_order_page_id')), 'terms_page_id' => get_option('woocommerce_terms_page_id'), 'terms_page_slug' => aa_getpostslugbyid(get_option('woocommerce_terms_page_id')), '_view_order' => get_option('woocommerce_myaccount_view_order_endpoint'), '_edit_account' => get_option('woocommerce_myaccount_edit_account_endpoint'), '_edit_address' => get_option('woocommerce_myaccount_edit_address_endpoint'), '_lost_password' => get_option('woocommerce_myaccount_lost_password_endpoint'), '_logout_endpoint' => get_option('woocommerce_logout_endpoint'), '_add_payment_method' => get_option('woocommerce_myaccount_add_payment_method_endpoint'), '_checkout_order_received' => get_option('woocommerce_checkout_order_received_endpoint'), '_checkout_pay_endpoint' => get_option('woocommerce_checkout_pay_endpoint'), '_currency' => get_woocommerce_currency_symbol()];
    }
    return $woo_opts;
}
 /**
  * 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);
 }
 /**
  * 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
 }
Beispiel #22
0
function ts_template_loop_product_label()
{
    global $product, $post, $smof_data;
    $out_of_stock = false;
    $product_stock = $product->get_availability();
    if (isset($product_stock['class']) && $product_stock['class'] == 'out-of-stock') {
        $out_of_stock = true;
    }
    ?>
	<div class="product-label">
	<?php 
    /* Sale label */
    if ($product->is_on_sale() && !$out_of_stock) {
        if ($product->regular_price > 0 && $smof_data['ts_show_sale_label_as'] != 'text') {
            $_off_percent = (1 - round($product->get_price() / $product->regular_price, 2)) * 100;
            $_off_price = round($product->regular_price - $product->get_price(), 0);
            $_price_symbol = get_woocommerce_currency_symbol();
            if ($smof_data['ts_show_sale_label_as'] == 'number') {
                $symbol_pos = get_option('woocommerce_currency_pos', 'left');
                $price_display = '';
                switch ($symbol_pos) {
                    case 'left':
                        $price_display = '-' . $_price_symbol . $_off_price;
                        break;
                    case 'right':
                        $price_display = '-' . $_off_price . $_price_symbol;
                        break;
                    case 'left_space':
                        $price_display = '-' . $_price_symbol . ' ' . $_off_price;
                        break;
                    default:
                        /* right_space */
                        $price_display = '-' . $_off_price . ' ' . $_price_symbol;
                        break;
                }
                echo '<span class="onsale amount" data-original="' . $price_display . '">' . $price_display . '</span>';
            }
            if ($smof_data['ts_show_sale_label_as'] == 'percent') {
                echo '<span class="onsale percent">-' . $_off_percent . '%</span>';
            }
        } else {
            echo '<span class="onsale">' . esc_html(stripslashes($smof_data['ts_product_sale_label_text'])) . '</span>';
        }
    }
    /* Hot label */
    if ($product->is_featured() && !$out_of_stock) {
        echo '<span class="featured">' . esc_html(stripslashes($smof_data['ts_product_feature_label_text'])) . '</span>';
    }
    /* Out of stock */
    if ($out_of_stock) {
        echo '<span class="out-of-stock">' . esc_html(stripslashes($smof_data['ts_product_out_of_stock_label_text'])) . '</span>';
    }
    ?>
	</div>
	<?php 
}
function bf_wc_product_general($thepostid, $customfield)
{
    ?>

    <div id="general_product_data"><?php 
    if (isset($customfield['product_sku']) && $customfield['product_sku'] != 'hidden') {
        echo '<div class="options_group hide_if_grouped">';
        // SKU
        if (wc_product_sku_enabled()) {
            $required = $customfield['product_sku'] == 'required' ? array('required' => '') : '';
            $required_html = $customfield['product_sku'] == 'required' ? '<span class="required">* </span>' : '';
            woocommerce_wp_text_input(array('custom_attributes' => $required, 'id' => '_sku', 'label' => $required_html . '<abbr title="' . __('Stock Keeping Unit', 'woocommerce') . '">' . __('SKU', 'woocommerce') . '</abbr><br>', 'desc_tip' => 'true', 'description' => __('SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased.', 'woocommerce')));
        } else {
            echo '<input type="hidden" name="_sku" value="' . esc_attr(get_post_meta($thepostid, '_sku', true)) . '" />';
        }
        do_action('woocommerce_product_options_sku');
        echo '</div>';
    }
    echo '<div class="options_group show_if_external">';
    // External URL
    woocommerce_wp_text_input(array('id' => '_product_url', 'label' => __('Product URL', 'woocommerce') . '<br>', 'placeholder' => 'http://', 'description' => __('Enter the external URL to the product.', 'woocommerce')));
    // Button text
    woocommerce_wp_text_input(array('id' => '_button_text', 'label' => __('Button text', 'woocommerce') . '<br>', 'placeholder' => _x('Buy product', 'placeholder', 'woocommerce'), 'description' => __('This text will be shown on the button linking to the external product.', 'woocommerce')));
    echo '</div>';
    echo '<div class="options_group pricing show_if_simple show_if_external">';
    $required = $customfield['product_regular_price'][0] == 'required' ? array('required' => '') : '';
    $required_html = $customfield['product_regular_price'][0] == 'required' ? '<span class="required">* </span>' : '';
    // Price
    woocommerce_wp_text_input(array('custom_attributes' => $required, 'id' => '_regular_price', 'label' => $required_html . __('Regular Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')<br>', 'data_type' => 'price'));
    if (isset($customfield['product_sales_price']) && $customfield['product_sales_price'] != 'hidden') {
        $required = $customfield['product_sales_price'] == 'required' ? array('required' => '') : '';
        $required_html = $customfield['product_sales_price'] == 'required' ? '<span class="required">* </span>' : '';
        $description = isset($customfield['product_sales_price']) ? $customfield['product_sales_price'] == 'required' ? '' : '<a href="#" class="sale_schedule">' . __('Schedule', 'woocommerce') . '</a>' : '';
        // Special Price
        woocommerce_wp_text_input(array('custom_attributes' => $required, 'id' => '_sale_price', 'data_type' => 'price', 'label' => $required_html . __('Sale Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')<br>', 'description' => $description));
    } else {
        woocommerce_wp_hidden_input(array('id' => '_sale_price', 'data_type' => 'price'));
    }
    if (isset($customfield['product_sales_price_dates']) && $customfield['product_sales_price_dates'] != 'hidden') {
        $required = $customfield['product_sales_price_dates'] == 'required' ? array('required' => '') : '';
        $required_html = $customfield['product_sales_price_dates'] == 'required' ? '<span class="required">* </span>' : '';
        $description = isset($customfield['product_sales_price_dates']) ? $customfield['product_sales_price'] == 'required' ? 'style="display: block;"' : '' : '';
        // Special Price date range
        $sale_price_dates_from = ($date = get_post_meta($thepostid, '_sale_price_dates_from', true)) ? date_i18n('Y-m-d', $date) : '';
        $sale_price_dates_to = ($date = get_post_meta($thepostid, '_sale_price_dates_to', true)) ? date_i18n('Y-m-d', $date) : '';
        echo '	<p class="form-field sale_price_dates_fields" ' . $required_style . '>
            <label for="_sale_price_dates_from">' . $required_html . __('Sale Price Dates', 'woocommerce') . '</label>
            <input ' . $required . ' type="text" class="short" name="_sale_price_dates_from" id="_sale_price_dates_from" value="' . esc_attr($sale_price_dates_from) . '" placeholder="' . _x('From&hellip;', 'placeholder', 'woocommerce') . ' YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
            <input ' . $required . ' type="text" class="short" name="_sale_price_dates_to" id="_sale_price_dates_to" value="' . esc_attr($sale_price_dates_to) . '" placeholder="' . _x('To&hellip;', 'placeholder', 'woocommerce') . '  YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
            <a href="#" class="cancel_sale_schedule">' . __('Cancel', 'woocommerce') . '</a>
        </p>';
    }
    do_action('woocommerce_product_options_pricing');
    echo '</div></div>';
    do_action('bf_woocommerce_product_options_general_last', $thepostid, $customfield);
}
 /**
  * Frontend scripts.
  *
  * @return void
  */
 public function woo_bundles_frontend_scripts()
 {
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     wp_register_script('wc-add-to-cart-bundle', WC_PB()->woo_bundles_plugin_url() . '/assets/js/add-to-cart-bundle' . $suffix . '.js', array('jquery', 'wc-add-to-cart-variation'), WC_PB()->version, true);
     wp_register_style('wc-bundle-css', WC_PB()->woo_bundles_plugin_url() . '/assets/css/bundles-frontend.css', false, WC_PB()->version);
     wp_register_style('wc-bundle-style', WC_PB()->woo_bundles_plugin_url() . '/assets/css/bundles-style.css', false, WC_PB()->version);
     wp_enqueue_style('wc-bundle-style');
     $params = array('i18n_free' => __('Free!', 'woocommerce'), 'i18n_total' => __('Total', 'woocommerce-product-bundles') . ': ', 'i18n_subtotal' => __('Subtotal', 'woocommerce-product-bundles') . ': ', 'i18n_partially_out_of_stock' => __('Insufficient stock', 'woocommerce-product-bundles'), 'i18n_partially_on_backorder' => __('Available on backorder', 'woocommerce-product-bundles'), 'i18n_select_options' => __('To continue, please choose product options&hellip;', 'woocommerce-product-bundles'), 'i18n_qty_string' => _x(' &times; %s', 'qty string', 'woocommerce-product-bundles'), 'i18n_title_string' => sprintf(_x('%1$s%2$s', 'product title followed by details', 'woocommerce-product-bundles'), '%t', '%q'), 'i18n_unavailable_text' => __('Sorry, this product cannot be purchased at the moment.', 'woocommerce-product-bundles'), 'currency_symbol' => get_woocommerce_currency_symbol(), 'currency_position' => esc_attr(stripslashes(get_option('woocommerce_currency_pos'))), 'currency_format_num_decimals' => WC_PB_Core_Compatibility::wc_get_price_decimals(), 'currency_format_decimal_sep' => esc_attr(stripslashes(get_option('woocommerce_price_decimal_sep'))), 'currency_format_thousand_sep' => esc_attr(stripslashes(get_option('woocommerce_price_thousand_sep'))), 'currency_format_trim_zeros' => false == apply_filters('woocommerce_price_trim_zeros', false) ? 'no' : 'yes');
     wp_localize_script('wc-add-to-cart-bundle', 'wc_bundle_params', $params);
 }
function wpa83365_price_html($price, $product)
{
    if ($product->sale_price) {
        $from = get_woocommerce_currency_symbol() . strip_tags($product->regular_price);
    } else {
        $from = '';
    }
    $to = get_woocommerce_currency_symbol() . strip_tags($product->price);
    return '<span class="old-price"><del>' . $from . '</del></span><span class="new-price">' . $to . '</span>';
}
 /**
  * add_edit_currency_symbol_field.
  */
 function add_edit_currency_symbol_field($settings)
 {
     $updated_settings = array();
     foreach ($settings as $section) {
         if (isset($section['id']) && 'woocommerce_currency_pos' == $section['id']) {
             $updated_settings[] = array('name' => __('Currency Symbol', 'woocommerce-jetpack'), 'desc_tip' => __('This sets the currency symbol.', 'woocommerce-jetpack'), 'id' => 'wcj_currency_' . get_woocommerce_currency(), 'type' => 'text', 'default' => get_woocommerce_currency_symbol(), 'desc' => apply_filters('get_wc_jetpack_plus_message', '', 'desc'), 'css' => 'width: 50px;', 'custom_attributes' => apply_filters('get_wc_jetpack_plus_message', '', 'readonly'));
         }
         $updated_settings[] = $section;
     }
     return $updated_settings;
 }
 public function init_form_fields()
 {
     $woocommerce = WC();
     $shippingCountries = method_exists($woocommerce->countries, 'get_shipping_countries') ? $woocommerce->countries->get_shipping_countries() : $woocommerce->countries->{'countries'};
     $this->form_fields = array(array('type' => 'title', 'title' => __('Rule Settings', 'woowbs')), 'enabled' => array('title' => __('Enable/Disable', 'woowbs'), 'type' => 'checkbox', 'label' => __('Enable this rule', 'woowbs'), 'default' => 'yes'), 'name' => array('title' => __('Label', 'woowbs'), 'description' => __('This is an internal rule label, just for you. Customers don\'t see this.', 'woowbs'), 'type' => 'text', 'default' => sprintf($this->profile_id != 'main' ? __('rule #%s') : '%s', $this->profile_id)), 'title' => array('title' => __('Title', 'woowbs'), 'type' => 'text', 'description' => __('This controls the title which the customer sees during checkout.', 'woowbs'), 'default' => __('Weight Based Shipping', 'woowbs')), 'tax_status' => array('title' => __('Tax Status', 'woowbs'), 'type' => 'select', 'default' => 'taxable', 'class' => 'availability wc-enhanced-select', 'options' => array('taxable' => __('Taxable', 'woowbs'), 'none' => __('None', 'woowbs'))), array('type' => 'title', 'title' => __('Conditions', 'woowbs'), 'description' => __('Define when the delivery option should be shown to the customer. All the following conditions must be met to activate the rule.', 'woowbs')), 'availability' => array('title' => __('Destination', 'woowbs'), 'type' => 'select', 'default' => 'all', 'class' => 'availability wc-enhanced-select', 'options' => array('all' => __('All allowed countries', 'woowbs'), 'specific' => __('Specific countries', 'woowbs'), 'excluding' => __('All countries except specified', 'woowbs'))), 'countries' => array('title' => __('Specific Countries', 'woowbs'), 'type' => 'wbs_custom', 'wbs_real_type' => 'multiselect', 'wbs_row_class' => 'wbs-destination', 'class' => 'chosen_select', 'default' => '', 'options' => $shippingCountries, 'custom_attributes' => array('data-placeholder' => __('Select some countries', 'woowbs')), 'html' => '<a class="select_all  button" href="#">' . __('Select all', 'woowbs') . '</a> ' . '<a class="select_none button" href="#">' . __('Select none', 'woowbs') . '</a>' . $this->settingsHelper->premiumPromotionHtml('States/counties targeting')), 'weight' => array('title' => __('Order Weight', 'woowbs'), 'type' => 'wbs_range'), 'subtotal' => array('title' => __('Order Subtotal', 'woowbs'), 'type' => 'wbs_custom', 'wbs_real_type' => 'wbs_range', 'wbs_row_class' => 'wbs-subtotal'), 'subtotal_with_tax' => array('title' => __('Subtotal With Tax', 'woowbs'), 'type' => 'checkbox', 'label' => __('After tax included', 'woowbs')), array('type' => 'title', 'title' => __('Costs', 'woowbs'), 'description' => __('This controls shipping price when this rule is active.', 'woowbs')), 'fee' => array('title' => __('Base Cost', 'woowbs'), 'type' => 'decimal', 'description' => __('Leave empty or zero if your shipping price has no flat part.', 'woowbs')), 'weight_rate' => array('title' => __('Weight Rate', 'woowbs'), 'type' => 'wbs_weight_rate', 'description' => __('Leave <code class="wbs-code">charge</code> field empty if your shipping price is flat.', 'woowbs') . '<br>' . __('Use <code class="wbs-code">over</code> field to skip weight part covered with Base Cost or leave it empty to charge for entire order weight.', 'woowbs')), 'shipping_class_rates' => array('title' => __('Shipping Classes', 'woowbs'), 'type' => 'shipping_class_rates', 'description' => __('You can override some options for specific shipping classes', 'woowbs')), array('type' => 'title', 'title' => __('Modificators', 'woowbs'), 'description' => __('With the following you can modify resulting shipping price', 'woowbs')), 'price_clamp' => array('title' => __('Limit Total Cost', 'woowbs'), 'type' => 'wbs_range', 'wbs_range_type' => 'simple', 'description' => __('If shipping price exceeds specified range it will be changed to either lower or upper bound appropriately.', 'woowbs')));
     $placeholders = array('weight_unit' => __(get_option('woocommerce_weight_unit'), 'woowbs'), 'currency' => get_woocommerce_currency_symbol());
     foreach ($this->form_fields as &$field) {
         $field['description'] = wbst(@$field['description'], $placeholders);
     }
     $this->form_fields = apply_filters('wbs_profile_settings_form', $this->form_fields, $this);
 }
Beispiel #28
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));
     }
 }
 public function points_add_custom_settings()
 {
     global $woocommerce, $post;
     echo '<div class="options_group show-if-points">';
     // Commission Price pulled from WooCommerce Core
     woocommerce_wp_text_input(array('id' => '_regular_price', 'label' => __('Commission Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
     // Create a number field, for example for UPC
     woocommerce_wp_text_input(array('id' => 'points_product_cost', 'label' => __('Points Cost', 'woocommerce'), 'placeholder' => '', 'desc_tip' => 'true', 'description' => __('Enter the amount of points this product costs.', 'woocommerce'), 'type' => 'number'));
     // Individual product
     woocommerce_wp_checkbox(array('id' => '_sold_individually', 'label' => __('Sold Individually', 'woocommerce'), 'description' => __('Enable this to only allow one of this item to be bought in a single order', 'woocommerce')));
     echo '</div>';
 }
 public function htmlform()
 {
     $woocommerce = WC();
     $htmlformval = array(array('type' => 'title', 'title' => __('Rule Settings', 'woowbs')), 'enabled' => array('title' => __('Enable/Disable', 'woowbs'), 'type' => 'checkbox', 'label' => __('Enable this rule', 'woowbs'), 'default' => '0', 'name' => 'weightShip_enable'), array('type' => 'title', 'title' => __('Conditions', 'woowbs'), 'description' => __('Define when the delivery option should be shown to the customer. All the following conditions must be met to activate the rule.', 'woowbs')), 'weight' => array('title' => __('Order Weight', 'woowbs'), 'type' => 'wbs_range', 'name' => 'weightShip_weight', 'totalcondition' => 1), 'subtotal' => array('title' => __('Order Subtotal', 'woowbs'), 'type' => 'wbs_custom', 'wbs_real_type' => 'wbs_range', 'wbs_row_class' => 'wbs-subtotal', 'name' => 'weightShip_subtotal', 'totalcondition' => 1), array('type' => 'title', 'title' => __('Maximum cart total / weight', 'woowbs'), 'description' => __('The total cost or weight after which shipping free.', 'woowbs')), 'maxiumm_weight' => array('title' => __('Maximum weight', 'woowbs'), 'type' => 'weight', 'description' => __('Leave empty if dont want to apply this rule.', 'woowbs'), 'default' => '0'), 'maximum_cost' => array('title' => __('Maximum Cost', 'woowbs'), 'type' => 'price', 'description' => __('Leave empty if dont want to apply this rule.'), 'default' => '0'));
     $placeholders = array('weight_unit' => __(get_option('woocommerce_weight_unit'), 'woowbs'), 'currency' => get_woocommerce_currency_symbol());
     foreach ($htmlformval as &$field) {
         $field['description'] = wbst(@$field['description'], $placeholders);
     }
     $htmlformval['placholder'] = array('weight_unit' => __(get_option('woocommerce_weight_unit'), 'woowbs'), 'currency' => get_woocommerce_currency_symbol());
     //$htmlformval = apply_filters('wbs_profile_settings_form', $this->form_fields, $this);
     return $htmlformval;
 }