'', 'message' => '' ); $template_products = Wiaas_Admin_Template_Selection::show_template_products($selected_template_id); if (!empty($template_products)) { ob_start(); Wiaas_Admin_Template_Selection::render_template_products($template_products['hardware']); Wiaas_Admin_Template_Selection::render_template_products($template_products['service']); Wiaas_Admin_Template_Selection::render_template_products($template_products['installation']); Wiaas_Admin_Template_Selection::render_template_products($template_products['software']); $response['markup'] = ob_get_clean(); } wp_send_json($response); } /** * Handles adding products to template via ajax. */ public static function ajax_add_wiaas_template_product() { // check_ajax_referer( 'wc_bundles_add_bundled_product', 'security' ); $loop = intval($_POST['id']); $product_id = intval($_POST['product_id']); $options = $_POST['options']; $product = wc_get_product($product_id); $title = $product->get_title(); $response = array( 'markup' => '', 'message' => '' ); if ($product) { ob_start(); include('views/html-wiaas-template-product.php'); $response['markup'] = ob_get_clean(); } else { $response['message'] = __('The selected product is invalid.', 'woocommerce-product-bundles'); } wp_send_json($response); } } Wiaas_Template_Admin_Ajax::init();