From b67a015c0f7f104b2284af968a1e2afe4bfa9f65 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Sat, 27 Aug 2011 12:57:06 +0100 Subject: [PATCH] Fix currency pos in script --- assets/js/woocommerce.js | 23 +++++++++++++++++++++-- woocommerce.php | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/assets/js/woocommerce.js b/assets/js/woocommerce.js index d6a89b27c52..b410b40634d 100755 --- a/assets/js/woocommerce.js +++ b/assets/js/woocommerce.js @@ -132,12 +132,31 @@ jQuery(function(){ max: max_price, values: [current_min_price,current_max_price], create : function( event, ui ) { - jQuery( ".price_slider_amount span" ).html( woocommerce_params.currency_symbol + current_min_price + " - " + woocommerce_params.currency_symbol + current_max_price ); + + if (params.currency_pos == "left"){ + jQuery( ".price_slider_amount span" ).html( params.currency_symbol + current_min_price + " - " + params.currency_symbol + current_max_price ); + } else if (params.currency_pos == "left_space") { + jQuery( ".price_slider_amount span" ).html( params.currency_symbol + " " + current_min_price + " - " + params.currency_symbol + " " + current_max_price ); + } else if (params.currency_pos == "right") { + jQuery( ".price_slider_amount span" ).html( current_min_price + params.currency_symbol + " - " + current_max_price + params.currency_symbol ); + } else if (params.currency_pos == "right_space") { + jQuery( ".price_slider_amount span" ).html( current_min_price + " " + params.currency_symbol + " - " + current_max_price + " " + params.currency_symbol ); + } + jQuery( ".price_slider_amount #min_price" ).val(current_min_price); jQuery( ".price_slider_amount #max_price" ).val(current_max_price); }, slide: function( event, ui ) { - jQuery( ".price_slider_amount span" ).html( woocommerce_params.currency_symbol + ui.values[ 0 ] + " - " + woocommerce_params.currency_symbol + ui.values[ 1 ] ); + + if (params.currency_pos == "left"){ + jQuery( ".price_slider_amount span" ).html( params.currency_symbol + ui.values[ 0 ] + " - " + params.currency_symbol + ui.values[ 1 ] ); + } else if (params.currency_pos == "left_space") { + jQuery( ".price_slider_amount span" ).html( params.currency_symbol + " " + ui.values[ 0 ] + " - " + params.currency_symbol + " " + ui.values[ 1 ] ); + } else if (params.currency_pos == "right") { + jQuery( ".price_slider_amount span" ).html( ui.values[ 0 ] + params.currency_symbol + " - " + ui.values[ 1 ] + params.currency_symbol ); + } else if (params.currency_pos == "right_space") { + jQuery( ".price_slider_amount span" ).html( ui.values[ 0 ] + " " + params.currency_symbol + " - " + ui.values[ 1 ] + " " + params.currency_symbol ); + } jQuery( "input#min_price" ).val(ui.values[ 0 ]); jQuery( "input#max_price" ).val(ui.values[ 1 ]); } diff --git a/woocommerce.php b/woocommerce.php index 5d53212e041..80fbe116160 100644 --- a/woocommerce.php +++ b/woocommerce.php @@ -204,6 +204,7 @@ function woocommerce_frontend_scripts() { /* Script variables */ $woocommerce_params = array( 'currency_symbol' => get_woocommerce_currency_symbol(), + 'currency_pos' => get_option('woocommerce_currency_pos'), 'countries' => json_encode(woocommerce_countries::$states), 'select_state_text' => __('Select a state…', 'woothemes'), 'state_text' => __('state', 'woothemes'),