Fix currency pos in script

This commit is contained in:
Mike Jolley 2011-08-27 12:57:06 +01:00
parent 2ab533a14e
commit b67a015c0f
2 changed files with 22 additions and 2 deletions

View File

@ -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 ]);
}

View File

@ -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'),