Renamed params variable

This commit is contained in:
Mike Jolley 2011-08-24 20:35:02 +01:00
parent b0f4e4bbba
commit 142635fdbb
2 changed files with 25 additions and 25 deletions

View File

@ -20,14 +20,14 @@ jQuery(function(){
var data = {
action: 'woocommerce_add_to_cart',
product_id: jQuery(thisbutton).attr('rel'),
security: params.add_to_cart_nonce
security: woocommerce_params.add_to_cart_nonce
};
// Trigger event
jQuery('body').trigger('adding_to_cart');
// Ajax action
jQuery.post( params.ajax_url, data, function(response) {
jQuery.post( woocommerce_params.ajax_url, data, function(response) {
// Get response
fragments = jQuery.parseJSON( response );
@ -40,7 +40,7 @@ jQuery(function(){
}
// Block widgets and fragments
jQuery('.widget_shopping_cart, .shop_table.cart, .updating').fadeTo('400', '0.6').block({message: null, overlayCSS: {background: 'transparent url(' + params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6}});
jQuery('.widget_shopping_cart, .shop_table.cart, .updating').fadeTo('400', '0.6').block({message: null, overlayCSS: {background: 'transparent url(' + woocommerce_params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6}});
// Changes button classes
jQuery(thisbutton).addClass('added');
@ -110,14 +110,14 @@ jQuery(function(){
var min_price = jQuery('.price_slider_amount #min_price').val();
var max_price = jQuery('.price_slider_amount #max_price').val();
if (params.min_price) {
current_min_price = params.min_price;
if (woocommerce_params.min_price) {
current_min_price = woocommerce_params.min_price;
} else {
current_min_price = min_price;
}
if (params.max_price) {
current_max_price = params.max_price;
if (woocommerce_params.max_price) {
current_max_price = woocommerce_params.max_price;
} else {
current_max_price = max_price;
}
@ -132,12 +132,12 @@ jQuery(function(){
max: max_price,
values: [current_min_price,current_max_price],
create : function( event, ui ) {
jQuery( ".price_slider_amount span" ).html( params.currency_symbol + current_min_price + " - " + params.currency_symbol + current_max_price );
jQuery( ".price_slider_amount span" ).html( woocommerce_params.currency_symbol + current_min_price + " - " + woocommerce_params.currency_symbol + current_max_price );
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( params.currency_symbol + ui.values[ 0 ] + " - " + params.currency_symbol + ui.values[ 1 ] );
jQuery( ".price_slider_amount span" ).html( woocommerce_params.currency_symbol + ui.values[ 0 ] + " - " + woocommerce_params.currency_symbol + ui.values[ 1 ] );
jQuery( "input#min_price" ).val(ui.values[ 0 ]);
jQuery( "input#max_price" ).val(ui.values[ 1 ]);
}
@ -166,7 +166,7 @@ jQuery(function(){
});
/* states */
var states_json = params.countries.replace(/"/g, '"');
var states_json = woocommerce_params.countries.replace(/"/g, '"');
var states = jQuery.parseJSON( states_json );
jQuery('select.country_to_state').change(function(){
@ -185,13 +185,13 @@ jQuery(function(){
}
if (jQuery(state_box).is('input')) {
// Change for select
jQuery(state_box).replaceWith('<select name="' + input_name + '" id="' + input_id + '"><option value="">' + params.select_state_text + '</option></select>');
jQuery(state_box).replaceWith('<select name="' + input_name + '" id="' + input_id + '"><option value="">' + woocommerce_params.select_state_text + '</option></select>');
state_box = jQuery('#' + jQuery(this).attr('rel'));
}
jQuery(state_box).append(options);
} else {
if (jQuery(state_box).is('select')) {
jQuery(state_box).replaceWith('<input type="text" placeholder="' + params.state_text + '" name="' + input_name + '" id="' + input_id + '" />');
jQuery(state_box).replaceWith('<input type="text" placeholder="' + woocommerce_params.state_text + '" name="' + input_name + '" id="' + input_id + '" />');
state_box = jQuery('#' + jQuery(this).attr('rel'));
}
}
@ -373,7 +373,7 @@ jQuery(function(){
});
if (params.is_checkout==1) {
if (woocommerce_params.is_checkout==1) {
var updateTimer;
@ -396,11 +396,11 @@ if (params.is_checkout==1) {
var s_postcode = jQuery('input#shipping-postcode').val();
}
jQuery('#order_methods, #order_review').block({message: null, overlayCSS: {background: '#fff url(' + params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6}});
jQuery('#order_methods, #order_review').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6}});
var data = {
action: 'woocommerce_update_order_review',
security: params.update_order_review_nonce,
security: woocommerce_params.update_order_review_nonce,
shipping_method: method,
country: country,
state: state,
@ -410,7 +410,7 @@ if (params.is_checkout==1) {
s_postcode: s_postcode
};
jQuery.post( params.ajax_url, data, function(response) {
jQuery.post( woocommerce_params.ajax_url, data, function(response) {
jQuery('#order_methods, #order_review').remove();
jQuery('#order_review_heading').after(response);
@ -437,7 +437,7 @@ if (params.is_checkout==1) {
}
}).change();
if (params.option_guest_checkout=='yes') {
if (woocommerce_params.option_guest_checkout=='yes') {
jQuery('div.create-account').hide();
@ -482,10 +482,10 @@ if (params.is_checkout==1) {
/* AJAX Form Submission */
jQuery('form.checkout').submit(function(){
var form = this;
jQuery(form).block({message: null, overlayCSS: {background: '#fff url(' + params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6}});
jQuery(form).block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6}});
jQuery.ajax({
type: 'POST',
url: params.checkout_url,
url: woocommerce_params.checkout_url,
data: jQuery(form).serialize(),
success: function( code ) {
jQuery('.woocommerce_error, .woocommerce_message').remove();

View File

@ -202,7 +202,7 @@ function woocommerce_frontend_scripts() {
wp_enqueue_script('fancybox');
/* Script variables */
$params = array(
$woocommerce_params = array(
'currency_symbol' => get_woocommerce_currency_symbol(),
'countries' => json_encode(woocommerce_countries::$states),
'select_state_text' => __('Select a state&hellip;', 'woothemes'),
@ -217,19 +217,19 @@ function woocommerce_frontend_scripts() {
);
if (isset($_SESSION['min_price'])) :
$params['min_price'] = $_SESSION['min_price'];
$woocommerce_params['min_price'] = $_SESSION['min_price'];
endif;
if (isset($_SESSION['max_price'])) :
$params['max_price'] = $_SESSION['max_price'];
$woocommerce_params['max_price'] = $_SESSION['max_price'];
endif;
if ( is_page(get_option('woocommerce_checkout_page_id')) || is_page(get_option('woocommerce_pay_page_id')) ) :
$params['is_checkout'] = 1;
$woocommerce_params['is_checkout'] = 1;
else :
$params['is_checkout'] = 0;
$woocommerce_params['is_checkout'] = 0;
endif;
wp_localize_script( 'woocommerce', 'params', $params );
wp_localize_script( 'woocommerce', 'woocommerce_params', $woocommerce_params );
}
add_action('template_redirect', 'woocommerce_frontend_scripts');