added alert about changing the product type that has variations

closes #5864

@mikejolley
This commit is contained in:
claudiosmweb 2014-07-30 15:01:07 -03:00
parent 6b486014a9
commit 519de5be59
3 changed files with 23 additions and 21 deletions

View File

@ -1,3 +1,4 @@
/*global woocommerce_admin_meta_boxes */
jQuery( function( $ ){
// Scroll to first checked category - https://github.com/scribu/wp-category-checklist-tree/blob/d1c3c1f449e1144542efa17dde84a9f52ade1739/category-checklist-tree.php
@ -90,18 +91,18 @@ jQuery( function($){
// Get value
var select_val = $( this ).val();
if (select_val=='variable') {
if ( 'variable' !== select_val && 0 < $( '#variable_product_options input[name^=variable_sku]' ).length ) {
window.alert( woocommerce_admin_meta_boxes.i18n_product_type_alert );
}
if ( 'variable' === select_val ) {
$( 'input#_manage_stock' ).change();
$( 'input#_downloadable' ).prop( 'checked', false );
$( 'input#_virtual' ).removeAttr( 'checked' );
}
else if (select_val=='grouped') {
} else if ( 'grouped' === select_val ) {
$( 'input#_downloadable' ).prop( 'checked', false );
$( 'input#_virtual' ).removeAttr( 'checked' );
}
else if (select_val=='external') {
} else if ( 'external' === select_val ) {
$( 'input#_downloadable' ).prop( 'checked', false );
$( 'input#_virtual' ).removeAttr( 'checked' );
}

File diff suppressed because one or more lines are too long

View File

@ -214,6 +214,7 @@ class WC_Admin_Assets {
'i18n_download_permission_fail' => __( 'Could not grant access - the user may already have permission for this file or billing email is not set. Ensure the billing email is set, and the order has been saved.', 'woocommerce' ),
'i18n_permission_revoke' => __( 'Are you sure you want to revoke access to this download?', 'woocommerce' ),
'i18n_tax_rate_already_exists' => __( 'You cannot add the same tax rate twice!', 'woocommerce' ),
'i18n_product_type_alert' => __( 'Your product has variations! Before changing the product type can be a good idea delete the variations for avoid errors in the stock reports.', 'woocommerce' )
);
wp_localize_script( 'wc-admin-meta-boxes', 'woocommerce_admin_meta_boxes', $params );