commit
49b597665e
|
@ -37,7 +37,7 @@ jQuery(function(){
|
|||
|
||||
if ( value !== newvalue ) {
|
||||
jQuery(this).val( newvalue );
|
||||
if ( jQuery(this).parent().find('.wc_error_tip').size() == 0 ) {
|
||||
if ( jQuery(this).parent().find('.wc_error_tip').size() === 0 ) {
|
||||
var offset = jQuery(this).position();
|
||||
jQuery(this).after( '<div class="wc_error_tip">' + woocommerce_admin.i18n_decimal_error + '</div>' );
|
||||
jQuery('.wc_error_tip')
|
||||
|
@ -49,6 +49,30 @@ jQuery(function(){
|
|||
return this;
|
||||
});
|
||||
|
||||
jQuery('body').on('keyup change', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function(){
|
||||
var sale_price_field = jQuery(this);
|
||||
var sale_price = parseInt( sale_price_field.val() );
|
||||
|
||||
if( sale_price_field.attr('name').indexOf('variable') !== -1 ) {
|
||||
var regular_price = parseInt(sale_price_field.parents('.variable_pricing').find('.wc_input_price[name^=variable_regular_price]').val());
|
||||
} else {
|
||||
var regular_price = parseInt(jQuery('#_regular_price').val());
|
||||
}
|
||||
|
||||
if( sale_price >= regular_price ) {
|
||||
jQuery(this).val( regular_price );
|
||||
if ( jQuery(this).parent().find('.wc_error_tip').size() === 0 ) {
|
||||
var offset = jQuery(this).position();
|
||||
jQuery(this).after( '<div class="wc_error_tip">' + woocommerce_admin.i18_sale_less_than_regular_error + '</div>' );
|
||||
jQuery('.wc_error_tip')
|
||||
.css('left', offset.left + jQuery(this).width() - ( jQuery(this).width() / 2 ) - ( jQuery('.wc_error_tip').width() / 2 ) )
|
||||
.css('top', offset.top + jQuery(this).height() )
|
||||
.fadeIn('100');
|
||||
}
|
||||
}
|
||||
return this;
|
||||
});
|
||||
|
||||
jQuery('body').on('keyup change', '.wc_input_country_iso[type=text]', function(){
|
||||
var value = jQuery(this).val();
|
||||
var regex = new RegExp( '^([A-Z])?([A-Z])$' );
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -106,8 +106,9 @@ class WC_Admin_Assets {
|
|||
'i18n_decimal_error' => sprintf( __( 'Please enter in decimal (%s) format without thousand separators.', 'woocommerce' ), $decimal ),
|
||||
'i18n_mon_decimal_error' => sprintf( __( 'Please enter in monetary decimal (%s) format without thousand separators and currency symbols.', 'woocommerce' ), get_option( 'woocommerce_price_decimal_sep' ) ),
|
||||
'i18n_country_iso_error' => __( 'Please enter in country code with two capital letters.', 'woocommerce' ),
|
||||
'i18_sale_less_than_regular_error' => __( 'Please enter in a value less than the regular price.', 'woocommerce' ),
|
||||
'decimal_point' => $decimal,
|
||||
'mon_decimal_point' => get_option( 'woocommerce_price_decimal_sep' )
|
||||
'mon_decimal_point' => get_option( 'woocommerce_price_decimal_sep' ),
|
||||
);
|
||||
|
||||
wp_localize_script( 'woocommerce_admin', 'woocommerce_admin', $params );
|
||||
|
|
Loading…
Reference in New Issue