|
@@ -148,33 +148,6 @@ class StudioU_WCMP_Admin {
|
|
|
</p>
|
|
</p>
|
|
|
</div>
|
|
</div>
|
|
|
</script>
|
|
</script>
|
|
|
-
|
|
|
|
|
- <script>
|
|
|
|
|
- jQuery(function($) {
|
|
|
|
|
- // Initialize select2
|
|
|
|
|
- $(document).ready(function() {
|
|
|
|
|
- $('.wc-product-search').selectWoo({
|
|
|
|
|
- width: '100%'
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- // Add new row
|
|
|
|
|
- $('.add-mandatory-product').on('click', function() {
|
|
|
|
|
- var template = wp.template('mandatory-product-row');
|
|
|
|
|
- $('#studiou_mandatory_products_container').append(template());
|
|
|
|
|
-
|
|
|
|
|
- // Re-initialize select2 for the new row
|
|
|
|
|
- $('#studiou_mandatory_products_container .wc-product-search:last').selectWoo({
|
|
|
|
|
- width: '100%'
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- // Remove row
|
|
|
|
|
- $(document).on('click', '.remove-mandatory-product', function() {
|
|
|
|
|
- $(this).closest('.mandatory-product-row').remove();
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
- </script>
|
|
|
|
|
<?php
|
|
<?php
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -227,26 +200,6 @@ class StudioU_WCMP_Admin {
|
|
|
</p>
|
|
</p>
|
|
|
</div>
|
|
</div>
|
|
|
</script>
|
|
</script>
|
|
|
-
|
|
|
|
|
- <script>
|
|
|
|
|
- jQuery(function($) {
|
|
|
|
|
- // Add new row
|
|
|
|
|
- $('.add-mandatory-product').on('click', function() {
|
|
|
|
|
- var template = wp.template('mandatory-product-row');
|
|
|
|
|
- $('#studiou_mandatory_products_container').append(template());
|
|
|
|
|
-
|
|
|
|
|
- // Initialize select2 for the new row
|
|
|
|
|
- $('#studiou_mandatory_products_container .wc-product-search:last').selectWoo({
|
|
|
|
|
- width: '100%'
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- // Remove row
|
|
|
|
|
- $(document).on('click', '.remove-mandatory-product', function() {
|
|
|
|
|
- $(this).closest('.mandatory-product-row').remove();
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
- </script>
|
|
|
|
|
<?php
|
|
<?php
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -306,8 +259,17 @@ class StudioU_WCMP_Admin {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// WooCommerce admin scripts
|
|
// WooCommerce admin scripts
|
|
|
- wp_enqueue_script('wc-enhanced-select');
|
|
|
|
|
wp_enqueue_style('woocommerce_admin_styles');
|
|
wp_enqueue_style('woocommerce_admin_styles');
|
|
|
|
|
+ wp_enqueue_script('wc-enhanced-select');
|
|
|
|
|
+
|
|
|
|
|
+ // Add our custom JS to properly initialize SelectWoo
|
|
|
|
|
+ wp_enqueue_script(
|
|
|
|
|
+ 'studiou-wcmp-admin-js',
|
|
|
|
|
+ STUDIOU_WCMP_PLUGIN_URL . 'assets/js/admin.js',
|
|
|
|
|
+ array('jquery', 'wc-enhanced-select', 'wp-util'),
|
|
|
|
|
+ STUDIOU_WCMP_VERSION,
|
|
|
|
|
+ true
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|