51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
jQuery(document).ready(function ($) {
|
|
var $selectTemplate = $('#_select_template');
|
|
var $container = $('#wiaas_selected_template_items_container');
|
|
|
|
$selectTemplate
|
|
|
|
.on('change', function () {
|
|
var selectedTemplate = $selectTemplate.val();
|
|
|
|
var data = {
|
|
action: 'wiaas_select_template',
|
|
selected_template: selectedTemplate
|
|
};
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
$.post(woocommerce_admin_meta_boxes.ajax_url, data, function (response) {
|
|
|
|
if ('' !== response.markup) {
|
|
$container.children("div").remove();
|
|
$container.append(response.markup);
|
|
|
|
} else {
|
|
$container.children("div").remove();
|
|
}
|
|
|
|
if (response.message !== '') {
|
|
window.alert(response.message);
|
|
}
|
|
|
|
|
|
});
|
|
|
|
}, 250);
|
|
});
|
|
|
|
var $product_type = $('#product-type');
|
|
var $template_product_meta_box = $('#template_product_meta_box');
|
|
$product_type.on('change', function () {
|
|
var selectedProductType = $product_type.val();
|
|
|
|
if (selectedProductType === 'bundle') {
|
|
$template_product_meta_box.show();
|
|
} else {
|
|
$template_product_meta_box.hide();
|
|
}
|
|
});
|
|
|
|
|
|
}); |