diff --git a/wpsc-core/js/wp-e-commerce.js b/wpsc-core/js/wp-e-commerce.js index 14e0207c58..449d592ad8 100755 --- a/wpsc-core/js/wp-e-commerce.js +++ b/wpsc-core/js/wp-e-commerce.js @@ -280,6 +280,7 @@ jQuery(document).ready(function ($) { // update the price when the variations are altered. jQuery(".wpsc_select_variation").live('change', function() { jQuery('option[value="0"]', this).attr('disabled', 'disabled'); + self = this; var parent_form = jQuery(this).closest("form.product_form"); if ( parent_form.length == 0 ) return; @@ -292,7 +293,7 @@ jQuery(document).ready(function ($) { donation_price = jQuery('input#donation_price_' + prod_id), old_price = jQuery('#old_product_price_' + prod_id), save = jQuery('#yousave_' + prod_id), - buynow = jQuery('#BB_BuyButtonForm' + prod_id); + buynow = jQuery('#buy-now-product_' + prod_id); if ( response.variation_found ) { if ( response.stock_available ) { stock_display.removeClass('out_of_stock').addClass('in_stock'); @@ -320,6 +321,9 @@ jQuery(document).ready(function ($) { } } donation_price.val(response.numeric_price); + + buynow.find('input[name="'+jQuery(self).prop('name')+'"]').val(jQuery(self).val()); + buynow.find('input.wpsc-buy-now-button').prop('disabled', false); } }, 'json'); }); diff --git a/wpsc-includes/display.functions.php b/wpsc-includes/display.functions.php index e432096a15..b62a144337 100755 --- a/wpsc-includes/display.functions.php +++ b/wpsc-includes/display.functions.php @@ -35,15 +35,29 @@ function wpsc_buy_now_button( $product_id, $replaced_shortcode = false ) { $handling = $shipping; } + $has_variants = wpsc_product_has_variations($product_id); $src = _x( 'https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif', 'PayPal Buy Now Button', 'wpsc' ); $src = apply_filters( 'wpsc_buy_now_button_src', $src ); $classes = "wpsc-buy-now-form wpsc-buy-now-form-{$product_id}"; - $button_html = ''; + $button_html = sprintf('', + esc_attr( $product_id ), + esc_url( $src ), + esc_attr__( 'PayPal - The safer, easier way to pay online', 'wpsc' ) + ); $button_html = apply_filters( 'wpsc_buy_now_button_html', $button_html, $product_id ); - ?> -