1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
<?php
class bkap_wcv_product {
public function __construct() {
add_filter( 'wcv_product_meta_tabs', array( &$this, 'bkap_add_booking_tab' ) );
add_action( 'wcv_after_variations_tab', array( &$this, 'bkap_add_tab_data' ), 10, 1 );
}
function bkap_add_booking_tab( $tabs_array ) {
$tabs_array[ 'bkap_booking' ] = array(
'label' => __( 'Booking', 'woocommerce-booking'),
'target' => 'bkap_booking',
'class' => array( 'show_if_simple', 'show_if_variable', ),
);
return $tabs_array;
}
function bkap_add_tab_data( $product_id ){
if( $product_id > 0 ) {
$plugin_version_number = get_option( 'woocommerce_booking_db_version' );
global $post;
$post = get_post( $product_id, OBJECT );
$results = setup_postdata( $post );
bkap_load_scripts_class::bkap_load_products_css( $plugin_version_number );
bkap_load_scripts_class::bkap_load_zozo_css( $plugin_version_number );
?>
<div class="wcv_bkap_booking tabs-content" id="bkap_booking">
<?php
bkap_booking_box_class::bkap_meta_box();
?>
</div>
<?php
$ajax_url = get_admin_url() . 'admin-ajax.php';
bkap_load_scripts_class::bkap_common_admin_scripts_js( $plugin_version_number );
bkap_load_scripts_class::bkap_load_product_scripts_js( $plugin_version_number, $ajax_url );
wp_register_script(
'bkap-wcv',
plugins_url().'/woocommerce-booking/js/vendors/wc-vendors/product.js',
'',
$plugin_version_number,
true
);
wp_localize_script(
'bkap-wcv',
'bkap_wcv_params',
array(
'ajax_url' => $ajax_url,
'post_id' => $product_id,
)
);
wp_enqueue_script( 'bkap-wcv' );
wp_enqueue_style(
'bkap-wcv-products',
plugins_url() . '/woocommerce-booking/css/vendors/wc-vendors/products.css',
'',
$plugin_version_number,
false
);
?>
<script type="text/javascript">
jQuery(document).ready(function () {
jQuery("#bkap-tabbed-nav").zozoTabs({
orientation: "vertical",
position: "top-left",
size: "medium",
animation: {
easing: "easeInOutExpo",
duration: 400,
effects: "none"
},
});
jQuery( '.bkap_type_box' ).hide();
});
</script>
<?php
} else {
?>
<div class="wcv_bkap_booking tabs-content" id="bkap_booking"><?php _e( 'Please save the product once to make sure you can add the Booking Settings.', 'woocommerce-booking' ); ?></div>
<?php
}
}
}
$bkap_wcv_product = new bkap_wcv_product();
?>