commit
49b597665e
|
@ -37,7 +37,7 @@ jQuery(function(){
|
||||||
|
|
||||||
if ( value !== newvalue ) {
|
if ( value !== newvalue ) {
|
||||||
jQuery(this).val( 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();
|
var offset = jQuery(this).position();
|
||||||
jQuery(this).after( '<div class="wc_error_tip">' + woocommerce_admin.i18n_decimal_error + '</div>' );
|
jQuery(this).after( '<div class="wc_error_tip">' + woocommerce_admin.i18n_decimal_error + '</div>' );
|
||||||
jQuery('.wc_error_tip')
|
jQuery('.wc_error_tip')
|
||||||
|
@ -49,6 +49,30 @@ jQuery(function(){
|
||||||
return this;
|
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(){
|
jQuery('body').on('keyup change', '.wc_input_country_iso[type=text]', function(){
|
||||||
var value = jQuery(this).val();
|
var value = jQuery(this).val();
|
||||||
var regex = new RegExp( '^([A-Z])?([A-Z])$' );
|
var regex = new RegExp( '^([A-Z])?([A-Z])$' );
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -83,40 +83,41 @@ class WC_Admin_Assets {
|
||||||
wp_register_script( 'chosen', WC()->plugin_url() . '/assets/js/chosen/chosen.jquery' . $suffix . '.js', array('jquery'), WC_VERSION );
|
wp_register_script( 'chosen', WC()->plugin_url() . '/assets/js/chosen/chosen.jquery' . $suffix . '.js', array('jquery'), WC_VERSION );
|
||||||
|
|
||||||
// Accounting
|
// Accounting
|
||||||
$params = array(
|
$params = array(
|
||||||
'mon_decimal_point' => get_option( 'woocommerce_price_decimal_sep' )
|
'mon_decimal_point' => get_option( 'woocommerce_price_decimal_sep' )
|
||||||
);
|
);
|
||||||
|
|
||||||
wp_localize_script( 'accounting', 'accounting_params', $params );
|
wp_localize_script( 'accounting', 'accounting_params', $params );
|
||||||
|
|
||||||
// WooCommerce admin pages
|
// WooCommerce admin pages
|
||||||
if ( in_array( $screen->id, wc_get_screen_ids() ) ) {
|
if ( in_array( $screen->id, wc_get_screen_ids() ) ) {
|
||||||
|
|
||||||
wp_enqueue_script( 'woocommerce_admin' );
|
wp_enqueue_script( 'woocommerce_admin' );
|
||||||
wp_enqueue_script( 'iris' );
|
wp_enqueue_script( 'iris' );
|
||||||
wp_enqueue_script( 'ajax-chosen' );
|
wp_enqueue_script( 'ajax-chosen' );
|
||||||
wp_enqueue_script( 'chosen' );
|
wp_enqueue_script( 'chosen' );
|
||||||
wp_enqueue_script( 'jquery-ui-sortable' );
|
wp_enqueue_script( 'jquery-ui-sortable' );
|
||||||
wp_enqueue_script( 'jquery-ui-autocomplete' );
|
wp_enqueue_script( 'jquery-ui-autocomplete' );
|
||||||
|
|
||||||
$locale = localeconv();
|
$locale = localeconv();
|
||||||
$decimal = isset( $locale['decimal_point'] ) ? $locale['decimal_point'] : '.';
|
$decimal = isset( $locale['decimal_point'] ) ? $locale['decimal_point'] : '.';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'i18n_decimal_error' => sprintf( __( 'Please enter in decimal (%s) format without thousand separators.', 'woocommerce' ), $decimal ),
|
'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_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' ),
|
'i18n_country_iso_error' => __( 'Please enter in country code with two capital letters.', 'woocommerce' ),
|
||||||
'decimal_point' => $decimal,
|
'i18_sale_less_than_regular_error' => __( 'Please enter in a value less than the regular price.', 'woocommerce' ),
|
||||||
'mon_decimal_point' => get_option( 'woocommerce_price_decimal_sep' )
|
'decimal_point' => $decimal,
|
||||||
);
|
'mon_decimal_point' => get_option( 'woocommerce_price_decimal_sep' ),
|
||||||
|
);
|
||||||
|
|
||||||
wp_localize_script( 'woocommerce_admin', 'woocommerce_admin', $params );
|
wp_localize_script( 'woocommerce_admin', 'woocommerce_admin', $params );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Edit product category pages
|
// Edit product category pages
|
||||||
if ( in_array( $screen->id, array( 'edit-product_cat' ) ) ) {
|
if ( in_array( $screen->id, array( 'edit-product_cat' ) ) ) {
|
||||||
wp_enqueue_media();
|
wp_enqueue_media();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Products
|
// Products
|
||||||
if ( in_array( $screen->id, array( 'edit-product' ) ) ) {
|
if ( in_array( $screen->id, array( 'edit-product' ) ) ) {
|
||||||
|
|
Loading…
Reference in New Issue