Plugin Directory

Changeset 3090240


Ignore:
Timestamp:
05/21/2024 01:59:27 PM (20 months ago)
Author:
susheelhbti
Message:

release of version 2

Location:
saksh-wp-hotel-booking-lite/trunk
Files:
1196 added
2 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • saksh-wp-hotel-booking-lite/trunk/Saksh-WP-Hotel-Booking-Lite.php

    r3085295 r3090240  
    33/*
    44Plugin Name: Saksh WP Hotel Booking Lite
    5 Version:  1.0
     5Version:  2.0
    66Plugin URI: #
    77Author: susheelhbti
     
    1111Requires at least: 4.7
    1212Tested up to: 6.4
    13 Stable tag: 1.0
     13Stable tag: 2.0
    1414Requires PHP: 5.4.0
    1515License: GPLv2 or later
     
    1717
    1818*/
    19  // if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    20  
    21  include "saksh_installation.php";
    22  
     19
     20define("SAKSHDIR",  __DIR__);
     21
     22
     23
     24include "redux-framework/redux-framework.php";
     25
     26include "saksh_custom_meta_form.php";
     27include "saksh_send_notifications.php";
     28
     29
     30include "saksh_theme_functions.php";
     31include "saksh_design.php";
     32
    2333 include "saksh_enqueue.php";
    2434 
     
    3040 include "saksh_wchook.php";
    3141 include "saksh_meta_box.php";
     42 
    3243
    3344 include "saksh_admin/saksh_booking_report.php";
    3445
    3546 
    36  
    37 
    38 
    39 
    40 
     47include "saksh_admin/saksh_option_panel.php";
     48 
     49
     50include "saksh_wc_myaccount.php";
    4151
    4252
    4353
    4454add_action('wp_footer', 'saksh_book_room');
     55
     56
    4557function saksh_book_room() {
    46 
    47    if ( ! isset( $_POST['saksh_nonce'] )
     58 
     59 
     60
     61
     62
     63
     64
     65
     66   if (!empty($_REQUEST['saksh_case'])   ) 
     67   
     68  {
     69     
     70      if ( ! isset( $_POST['saksh_nonce'] )
    4871    || ! wp_verify_nonce( sanitize_text_field(wp_unslash ( $_POST['saksh_nonce'])) , 'saksh_nonce_action' )
    4972) {
     
    5275   exit;
    5376}
    54    
    55 
    56    if (!empty($_REQUEST['saksh_case'])   ) 
    57    
    58   {
    59      
    60  
    61      
     77
     78
     79
     80
    6281   if (sanitize_text_field( $_REQUEST['saksh_case']) == "book_now" )   
    6382   {
    6483   
     84   
     85   
     86   
     87     $date_start = sanitize_text_field($_POST['date_start']);
     88     
     89     
     90   if(!isset($date_start))
     91
     92{   return "";
     93}
     94 
     95 
     96 
    6597   
    6698     $room_id = sanitize_text_field($_POST['room_id']);
    6799   
    68100   
    69      $date_start = sanitize_text_field($_POST['date_start']);
    70    
     101   
     102     $purchase_plan_id = sanitize_text_field($_POST['purchase_plan_id']);
    71103    $date_end =sanitize_text_field($_POST['date_end']); 
    72104   
     
    77109 
    78110 
    79  
    80  $rate_per_night = get_post_meta($room_id, 'rate_per_night', true );
    81  
     111 
     112    $saksh_payment_option=  get_post_meta(  $room_id, 'saksh_payment_option' , true ) ; 
     113 
     114  $rate_per_night  =    $saksh_payment_option[$purchase_plan_id]['rate_per_night'];
     115   
     116   
    82117 
    83118 
     
    89124 
    90125 
    91   $total_charge= $no_rooms * $rate_per_night  * $days;
    92  
    93  
    94    
    95    
    96    
    97    
    98      $product_id = saksh_get_hotel_booking_product() ; // product ID to add to cart
    99      
    100      
    101     // var_dump($product_id);
    102      
    103      
    104        $cart_item_data = array( 'date_start' => $date_start , "date_end"=>$date_end ,'adult'=>$adult,"kid"=>$kid , "no_rooms"=>$no_rooms ,'room_id'=> $room_id ,  "rate_per_night"=>$rate_per_night,'total_charge'=>$total_charge);
     126  $total_charge= (float)  $no_rooms * (float)  $rate_per_night  *  (float) $days;
     127 
     128 
     129   
     130   
     131   
     132   
     133  $product_id =  saksh_hotel_booking_product() ; // product ID to add to cart
     134     
     135 
     136       $cart_item_data = array( 'date_start' => $date_start ,
     137       "date_end"=>$date_end ,
     138       'adult'=>$adult,
     139       "kid"=>$kid ,
     140       "no_rooms"=>$no_rooms ,
     141       'room_id'=> $room_id ,
     142       "purchase_plan_id"=>$purchase_plan_id,
     143       "rate_per_night"=>$rate_per_night,
     144       'total_charge'=>$total_charge);
    105145       
    106146       
    107147   
    108    //  var_dump($cart_item_data);
    109      
    110    
    111  
    112  
    113  $available=saksh_check_availability($cart_item_data);
    114  
    115 
    116 
    117   //   var_dump($available);
     148 
     149     
     150   
     151   
     152   
     153 
     154 $available=saksh_check_availability($cart_item_data,$purchase_plan_id);
     155 
     156 
     157    WC()->cart->empty_cart();
     158
     159 
    118160 if($available=="true")
    119161 {
    120162     
    121 
    122 
    123    
    124         WC()->cart->empty_cart();
     163 
    125164 WC()->cart->add_to_cart( $product_id , 1, '', array(), $cart_item_data);
    126165     
    127        
     166         
    128167 $cart_page = wc_get_cart_url();
    129168
    130    //  var_dump($cart_page);
     169  //var_dump($cart_page);
    131170    echo '<meta http-equiv="refresh" content="0; URL= '.esc_url($cart_page ).'" />';
    132171     
     
    141180
    142181 
    143 
     182 
    144183
    145184function saksh_room_search_func(){
     
    158197
    159198add_shortcode( 'SakshRoomSearch', 'saksh_room_search_func' );
     199
     200
     201
     202
     203
     204
     205
     206function saksh_room_booking_func(){
     207   
     208    ob_start();
     209   
     210    include "saksh-room-booking.php" ;
     211   
     212$content = ob_get_clean();
     213return $content;
     214   
     215}
     216
     217
     218
     219
     220add_shortcode( 'SakshRoomBooking', 'saksh_room_booking_func' );
     221
     222
    160223
    161224function saksh_get_rooms_which_r_available( $query_data)
     
    177240{
    178241   
     242$room_d=array();
    179243  $row=array();
    180244 
     
    185249    $row['room_id']=$room->ID;
    186250   
    187   $row['room']=$room;
    188    
    189    
    190    
    191  $available =saksh_check_availability($row);
    192  
    193  
    194  $row['available']=$available;
    195  
    196  
    197  
    198  
    199   if($available=="true" )
    200         {
    201             $room_data[]=$row ;
    202      $room_id[]=$room->ID;
    203      
    204         }
    205    
    206        
    207      
    208 }
    209 
    210 $res=array();
    211 
    212 $res['room_data']=$room_data;
    213 $res['room_id']=$room_id;
    214 
    215  return  $res;
    216  
    217  
    218 }
    219 
    220 
    221 function saksh_check_availability($query_data)
     251  //$row['room']=$room;
     252   
     253   
     254   for($i=1;$i<=5;$i++){
     255       
     256       $purchase_plan_id=$i;
     257   
     258 $available =saksh_check_availability($row,$purchase_plan_id);
     259 
     260 
     261 
     262 
     263  $ar=array();
     264           
     265     //       $ar['room_id']=$room->ID;
     266           
     267            $ar['purchase_plan_id']=$i;
     268           
     269            $ar['available']=$available;
     270             
     271           
     272           
     273           
     274           
     275   $room_d[]=$ar;
     276 
     277 
     278   
     279   
     280   }   
     281   
     282     $row['room_data']=$room_d;
     283   
     284   
     285    $room_data[]=$row;
     286}
     287
     288
     289return $room_data;
     290
     291 
     292}
     293
     294
     295function saksh_check_availability($query_data,$purchase_plan_id)
    222296{
    223297   
     298    // it will check availability based on the room id and purchase plan id
     299   
    224300   
    225301     $available="true";
     
    227303     $room_id=  $query_data['room_id'];
    228304     
    229      
    230      
    231      $total_rooms  = get_post_meta( $room_id, 'total_rooms', true );
    232      
     305     
     306     
     307    $saksh_payment_option=  get_post_meta(  $room_id, 'saksh_payment_option' , true ) ; 
     308 
     309 
     310 if(isset(   $saksh_payment_option[$purchase_plan_id]['total_rooms_']))
     311 
     312  $total_rooms  =    $saksh_payment_option[$purchase_plan_id]['total_rooms_'];
     313    else
     314    $total_rooms  = 100;
     315     
     316     
     317     
    233318     
    234319   $total_rooms=intval($total_rooms);
    235    
    236    
     320     
    237321   
    238322     $required_room=intval($query_data['no_rooms']) ;
     
    246330 
    247331 
    248  $total_booking=saksh_get_total_booking_for_a_given_date($startdate, $room_id);
    249  
    250        
    251  
     332 $total_booking=saksh_get_total_booking_for_a_given_date($startdate, $room_id,$purchase_plan_id);
     333 
     334 
    252335 
    253336 
    254337    $remaining= $total_rooms - $total_booking ;
    255338   
    256  
     339    
    257340 if( $remaining  > $required_room )
    258341 {
     
    270353   
    271354}
    272 
     355 
    273356
    274357
     
    291374 
    292375 
    293   function saksh_get_total_booking_for_a_given_date($booking_date,$room_id)
     376  function saksh_get_total_booking_for_a_given_date($booking_date,$room_id, $purchase_plan_id)
    294377  {
    295378     
     
    298381       global $wpdb;
    299382       
    300    
    301    
    302          
    303          
    304            $total_booking = wp_cache_get( 'total_booking_'.$booking_date."_".$room_id );
    305            
    306            if ( false === $total_booking ) {
    307                
    308  
    309    $res = $wpdb->get_row( $wpdb->prepare( "SELECT  count(*) total_booking FROM  {$wpdb->prefix}bookings  WHERE room_id= %d and  booking_date =date(%s)", $room_id ,$booking_date  ) );
    310      
    311  
    312          
    313  wp_cache_set( 'total_booking_'.$booking_date."_".$room_id , $res->total_booking, HOUR_IN_SECONDS);
    314              
    315     return $res->total_booking;
    316            }
    317     else
    318     return  $total_booking;
    319    
     383     
     384 
     385   $res = $wpdb->get_row( $wpdb->prepare( "SELECT  count(*) total_booking FROM  {$wpdb->prefix}bookings  WHERE room_id= %d and purchase_plan_id=%d and    booking_date =date(%s)", $room_id ,$purchase_plan_id, $booking_date  ) );
     386     
     387     
     388     if($res)
     389     {
     390     $total_booking=$res->total_booking;
     391     
     392     
     393    return  intval($total_booking);
     394     }
     395     else
     396     
     397     return  0;
    320398   
    321399     
    322400  }
    323401 
    324  
    325  
    326  
    327 
    328 
    329 
    330 
    331 
    332 
    333 
    334 
    335  
    336 
    337 
    338 
     402
     403
     404
     405
     406 
     407 
     408 function saksh_capture_log($line_number ,  $query_data )
     409{
     410    return "";
     411     
     412$my_post = array(
     413'post_title'    => $line_number,
     414'post_content'  =>  print_r($query_data,true),
     415'post_status'   => 'draft'
     416);
     417
     418
     419
     420wp_insert_post( $my_post );
     421
     422
     423}
     424
     425
  • saksh-wp-hotel-booking-lite/trunk/assets/css/saksh.css

    r3084838 r3090240  
     1.saskh_title{
     2    font-size:20px;
     3    font-weight: 1000  ;
     4}
     5
     6 
     7 
     8.saksh_hide{
     9    display:inherit;
     10}
     11
     12
     13div.saksh_room_title {
     14   
     15    text-align: center;
     16  padding: 5px;
     17  margin-bottom: 12px;
     18}
     19
     20
     21
     22.saksh_room_thumbnail{
     23 display: block;
     24 
     25}
     26 
     27
     28
    129.saksh fieldset {
    230    padding: 0;
  • saksh-wp-hotel-booking-lite/trunk/assets/js/saksh-admin.js

    r3084838 r3090240  
     1
     2 
     3
    14jQuery(document).ready( function() {
    25 
    36 
    4  
     7    if ( jQuery( ".editor" ).length ) {
     8       
     9       
     10       
     11window.editors = {};
     12
     13document.querySelectorAll( '.editor' ).forEach( ( node, index ) => {
     14    ClassicEditor
     15        .create( node, {} )
     16        .then( newEditor => {
     17            window.editors[ index ] = newEditor
     18        } );
     19} );
     20     
     21    }       
     22             
     23          if ( jQuery( "#calendar" ).length ) {
     24             
    525         
    6          
    7          
    8         var calendarEl = document.getElementById('sakhsh_calendar');
     26             
     27        var calendarEl = document.getElementById('calendar');
    928       
    1029       
     
    4564        calendar.render();
    4665       
     66          }
    4767       
    48         
     68       
    4969      });
    5070     
    51  
     71     
     72     
     73     
     74jQuery(function ($) {
     75     
     76     
     77      $( "#tabs" ).tabs();
     78     
     79   
     80     
     81      /*
     82     var i = $("#saksh_booking_options").children().length;
     83     let j=0;
     84        $("#rowAdder").click(function () {
     85           
     86            i=parseInt(i)+1;
     87           
     88            j= $("#saksh_booking_options").children().length;
     89           
     90           
     91     var html=    $( "#saksh_"+i ).html();
     92
     93           
     94       
     95            $('#saksh_booking_options').append(j);
     96            $('#saksh_booking_options').append(html);
     97        });
     98        $("body").on("click", "#DeleteRow", function () {
     99            $(this).parents("#row").remove();
     100        })
     101 
     102  */
     103});
     104     
     105      /*
     106     
     107jQuery(function ($) {
     108
     109    var sakhs_bookings_obj = {
     110        init: function () {
     111            sakhs_bookings_obj.callAjaxMethod();
     112        },
     113        callAjaxMethod:function(){
     114            var data = {
     115                'action': 'saksh_booking_history',  // your action name
     116                'name': "Shweta"
     117            };
     118
     119            $.ajax({
     120                url: ajaxurl,
     121                type: 'POST',
     122                data: data,
     123                success: function (response) {
     124                    console.log(response);
     125                }
     126            });
     127        }
     128    }
     129    sakhs_bookings_obj.init();
     130});
     131
     132*/
  • saksh-wp-hotel-booking-lite/trunk/languages/saksh-wp-hotel-booking-lite.pot

    r3084838 r3090240  
     1#, fuzzy
     2msgid ""
     3msgstr ""
     4"Project-Id-Version: Loco Demo\n"
     5"Report-Msgid-Bugs-To: \n"
     6"POT-Creation-Date: 2021-01-02 12:41+0000\n"
     7"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
     8"Last-Translator: \n"
     9"Language-Team: \n"
     10"Language: \n"
     11"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
     12"MIME-Version: 1.0\n"
     13"Content-Type: text/plain; charset=UTF-8\n"
     14"Content-Transfer-Encoding: 8bit\n"
     15"X-Loco-Source-Locale: hi_IN\n"
     16"X-Generator: Loco https://localise.biz/"
     17
    118msgid "Hello World"
    219msgstr ""
     20
     21# Example comment
     22#. Example pluralized message
     23#, php-format
     24msgid "An example"
     25msgid_plural "%s examples"
     26msgstr[0] ""
     27msgstr[1] ""
     28
     29
     30
     31msgid "Language"
     32msgstr ""
     33
     34msgid "Price"
     35msgstr ""
     36
     37msgid "Full life time Access"
     38msgstr ""
     39
     40msgid "Certificate of Completion"
     41msgstr ""
     42
     43msgid "Buy Now"
     44msgstr ""
     45
     46msgid "Description"
     47msgstr ""
     48
     49msgid "Topic Covered"
     50msgstr ""
     51
     52msgid "Requirements"
     53msgstr ""
     54
     55msgid "Curriculum"
     56msgstr ""
     57
     58msgid "About"
     59msgstr ""
     60
     61msgid "Notes"
     62msgstr ""
     63
     64msgid "Resources"
     65msgstr ""
     66
     67msgid "Course Language"
     68msgstr ""
     69
     70msgid "Course buy link"
     71msgstr ""
     72
     73msgid "Course Price"
     74msgstr ""
     75
     76msgid "Full life time access"
     77msgstr ""
     78
     79msgid "Certificate of completion"
     80msgstr ""
     81
     82msgid "Course"
     83msgstr ""
     84
     85msgid "Short Title"
     86msgstr ""
     87
     88
     89msgid "Courses"
     90msgstr ""
     91
     92msgid "Parent Course"
     93msgstr ""
     94
     95msgid "All Courses"
     96msgstr ""
     97
     98msgid "View Course"
     99msgstr ""
     100
     101msgid "Add New Course"
     102msgstr ""
     103
     104msgid "Add New"
     105msgstr ""
     106
     107msgid "Edit Course"
     108msgstr ""
     109
     110msgid "Update Course"
     111msgstr ""
     112
     113msgid "Search Course"
     114msgstr ""
     115
     116msgid "Not Found"
     117msgstr ""
     118
     119msgid "Not found in Trash"
     120msgstr ""
     121
     122msgid "Course news and reviews"
     123msgstr ""
     124
     125msgid "courses"
     126msgstr ""
     127
  • saksh-wp-hotel-booking-lite/trunk/readme.txt

    r3087553 r3090240  
    22Contributors: susheelhbti
    33Donate link: https://profiles.wordpress.org/susheelhbti/
    4 Version : 1.0
     4Version : 2.0
    55Tags: hotel booking, booking engine,  hotel, reservations
    66Requires at least: 4.7
    77Tested up to: 6.4
    8 Stable tag: 1.0
     8Stable tag: 2.0
    99Requires PHP: 5.4.0
    1010License: GPLv2 or later
    1111License URI: https://www.gnu.org/licenses/gpl-2.0.html
     12
    1213
    1314
     
    1718
    1819== Description ==
    19  
    20  
    21 Saksh WP Hotel Booking Lite is a booking plugin which offer way to sells hotel rooms using woocommerce and caputre online payment.
     20 
     21shortcodes  [SakshRoomSearch] using you can print the form where serarch form will display
    2222
    23 
     23shortcode [SakshRoomBooking] using this you list all available rooms
    2424Search Room availablitbiy
    2525Fully integrated with woocommerce
     
    2828Calander based admin reports
    2929
    30 if you wish to use alpha version of this plugin you can contact me.
    3130
    3231###Key Features
  • saksh-wp-hotel-booking-lite/trunk/saksh_admin/saksh_booking_report.php

    r3085300 r3090240  
    11<?php
    2 
    3  
     2if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
     3 // Define constants
     4define( 'PLUGIN_SLUG', 'saksh_hotel_booking' );
     5define( 'PLUGIN_ROLE', 'manage_options' );
     6define( 'PLUGIN_DOMAIN', 'saksh' );
     7
     8add_action( 'admin_menu', 'saksh_register_your_plugin_menu', 9 );
     9
     10function saksh_register_your_plugin_menu() {
     11    // add_menu_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = ”, string $icon_url = ”, int|float $position = null ): string
     12   
     13   
     14   
     15    add_menu_page(
     16        __( 'Room Bookings', PLUGIN_DOMAIN ),
     17        'Room Bookings',
     18        PLUGIN_ROLE,
     19        PLUGIN_SLUG,
     20        false,
     21        'dashicons-admin-generic',
     22     75
     23    );
     24
     25
     26
     27// add_submenu_page( string $parent_slug, string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = ”, int|float $position = null ): string|false
     28
     29    add_submenu_page(
     30        PLUGIN_SLUG,
     31        'Room Bookings',
     32        'Room Bookings',
     33        PLUGIN_ROLE,
     34        PLUGIN_SLUG,
     35        'saksh_booking_dashboard'
     36    );
     37   
     38   
     39
     40
     41   
     42        add_submenu_page(
     43        PLUGIN_SLUG,
     44        'Bookings calander',
     45        'Bookings calander',
     46        PLUGIN_ROLE,
     47        "booking_dashboard",
     48        'saksh_wb_print_report'
     49    );
     50   
     51   
     52        add_submenu_page(
     53        PLUGIN_SLUG,
     54        'Todays Booking' ,
     55        'Todays Booking',
     56        PLUGIN_ROLE,
     57        "saksh_todays_booking",
     58        'saksh_todays_booking'
     59    );
     60
     61
     62}
    463 
    5  
    6  /**
    7  * Register a custom menu page.
     64 function saksh_booking_dashboard()
     65 {
     66    // echo "saksh_booking_dashboard";
     67   
     68    echo "For support whatsapp +91 8840574997";
     69 } 
     70 function saksh_todays_booking()
     71 {
     72     
     73     
     74     
     75     
     76        echo "For support whatsapp +91 8840574997";
     77     
     78     
     79       $request_date=  date("Y-m-d");
     80       
     81    saksh_booking_by_date($request_date);
     82   
     83   
     84 }
     85 /*
     86   
     87 function delete_your_plugin_dashboard_callback()
     88 {
     89     echo "your_plugin_dashboard_callback 71";
     90 }
    891 */
    9 function saksh_date_wise_booking_menu_page(){
    10     add_menu_page(
    11         __( 'Date wise Booking Report', 'saksh-wp-hotel-booking-lite' ),
    12         'Date wise Booking Report',
    13         'manage_options',
    14         'date_wise_booking',
    15         'saksh_print_report',
    16          '',
    17         6
    18     );
    19 }
    20 add_action( 'admin_menu', 'saksh_date_wise_booking_menu_page' );
    21 
    22 
    23 
    24 function saksh_print_report(){
    25    
     92 
     93 
     94
     95
     96
     97function saksh_wb_print_report(){
     98   
     99         if (!empty($_POST))
     100  {
     101   
     102   
     103   
     104   
     105   
     106 
     107
     108
     109
     110
     111   if ( ! isset( $_POST['saksh_nonce'] )
     112    || ! wp_verify_nonce( sanitize_text_field(wp_unslash ( $_POST['saksh_nonce'])) , 'saksh_nonce_action' )
     113) {
     114   return  esc_html_e( 'Sorry, your nonce did not verify.', 'saksh-wp-hotel-booking-lite' );
     115
     116   exit;
     117}
     118
     119
     120
     121
     122}
     123    //  wp_nonce_field( 'saksh_nonce_action', 'saksh_nonce' );
    26124   
    27125    if(isset($_REQUEST['request_date']))
    28126    {
    29           if ( ! isset( $_POST['saksh_nonce'] )
    30     || ! wp_verify_nonce( sanitize_text_field(wp_unslash ( $_POST['saksh_nonce'])) , 'saksh_nonce_action' )
    31 ) {
    32   return  esc_html_e( 'Sorry, your nonce did not verify.', 'saksh-wp-hotel-booking-lite' );
    33 
    34    exit;
    35 }
     127       
    36128    $request_date=sanitize_text_field($_REQUEST['request_date']);
    37129       
    38130    saksh_booking_by_date($request_date);
     131   
     132    saksh_other_booking_by_date($request_date);
     133   
     134   
    39135   
    40136    }else
     
    51147   
    52148   
    53   saksh_hb_plugin_table_install();
     149 
    54150 
    55151        ?>
     
    57153 
    58154           
    59                
     155                <script src='https://cdn.jsdelivr.net/npm/[email protected]/index.global.min.js'></script>
    60156          <h1 class="wp-heading-inline">
    61157             
    62               <?php esc_html_e('All list of booking', 'saksh-wp-hotel-booking-lite');
     158              <?php _e('All list of booking', 'saksh'); ?>
     159             
     160               
     161           
     162                   
     163</h1> 
     164       For support whatsapp +91 8840574997
     165   
     166 
     167    <div id='calendar'></div>
     168        <?php
     169       
     170         
     171       
     172       
     173 
     174     echo "</div>";
     175
     176
     177 
     178   
     179   
     180}
     181
     182
     183function saksh_booking_by_date($request_date){
     184   
     185   
     186   
     187        global $wpdb;
     188 
     189       
     190       
     191       
     192       
     193    //  $sql="SELECT * FROM {$wpdb->prefix}bookings where booking_date=date('".$request_date."')";
     194       
     195       
     196 
     197 
     198   
     199
     200        $results = $wpdb->get_results(  $wpdb->prepare(
     201    "SELECT * FROM {$wpdb->prefix}bookings  WHERE `date_start` =date(%s)", 
     202$request_date
     203) );
     204        ?>
     205        <div class="  wrap">
     206 
     207           
     208           
     209          <h1 class="wp-heading-inline">
    63210             
    64211             
    65212             
    66              
    67               ?>
    68                  
    69                
    70                  
    71                    
    72 </h1> 
    73    
    74           <p class="wp-heading-inline">
    75              
    76              <?php esc_html_e('For any support please   ', 'saksh-wp-hotel-booking-lite');
    77              
    78                   ?>
    79              
    80              <a href="https://api.whatsapp.com/send?phone=918840574997&test=appointment+booking+support" target="_blank" >
    81              
    82              <?php esc_html_e(' whatsapp at +91 8840574997   ', 'saksh-wp-hotel-booking-lite');
    83              
    84              
    85              
    86              
    87               ?> </a>
    88                
    89              
    90            
    91              
    92              <?php esc_html_e('or Email [email protected]', 'saksh-wp-hotel-booking-lite');
    93              
    94              
    95              
    96              
    97               ?> 
    98  
    99    
    100    
    101 Visit
    102          <a href="https://wordpresshotelbookingplugin.com/" target="_blank" >
    103              
    104              <?php esc_html_e('https://wordpresshotelbookingplugin.com/', 'saksh-wp-hotel-booking-lite');
    105              
    106              
    107              
    108              
    109               ?> </a>
    110                </p>
    111              
    112    
    113    
    114     <p>
    115        
    116           <a href="https://github.com/sakshstore/WordPress-Hotel-Booking-Plugin" target="_blank" >
    117              
    118              <?php esc_html_e('You can also use beta version of this plugin https://github.com/sakshstore/WordPress-Hotel-Booking-Plugin', 'saksh-wp-hotel-booking-lite');
    119              
    120              
    121              
    122              
    123               ?> </a>
    124                </p>
    125              
    126              
    127              
    128  
    129  
    130     <div id='sakhsh_calendar'></div>
    131         <?php
    132        
    133          
    134        
    135        
    136  
    137      echo "</div>";
    138 
    139 
    140  
    141    
    142    
    143 }
    144 
    145 
    146 
    147 
    148 function saksh_booking_by_date($request_date){
    149    
    150    
    151    
    152         global $wpdb;
    153  
    154        
    155        
    156      
    157  
    158    
    159 
    160         $results = $wpdb->get_results($wpdb->prepare(
    161     "SELECT * FROM {$wpdb->prefix}bookings  WHERE `booking_date` =date(%s)", 
    162 $request_date
    163 )  );
    164         ?>
    165         <div class="  wrap">
    166  
    167            
    168            
    169           <h1 class="wp-heading-inline">
    170 All list of booking</h1> 
    171    
    172        
     213New bookings</h1> 
     214
     215<h2>
     216   
     217   
     218 Date <?php echo $request_date; ?>
     219   
     220   
     221</h2>   
    173222        <?php
    174223       
     
    198247       
    199248        echo "<td>No rooms </td>";
    200        
    201        echo "<td> Room number </td>";
     249        
     250       echo "<td>Purchase plan </td>";
    202251       
    203252        echo "<td> Total Charge</td>";
    204253       
    205254         
    206         echo "<td>Order ID </td>";
    207          
    208      
     255         
    209256       
    210257       echo "<td>Created at </td>";
     
    223270     
    224271       echo "<td>";
    225       echo  esc_attr( $res->id );
     272      echo  esc_attr( $res->order_id );
    226273       echo "</td>";
    227274     
     
    238285               
    239286        echo "<td>";
    240       echo  esc_attr($res->name );
     287      echo  esc_attr($res->first_name );
     288     
     289      echo  esc_attr($res->last_name );
    241290       echo "</td>";
    242291       
     
    264313       echo "</td>";
    265314       
    266        echo "<td>";
    267       echo  esc_attr($res->room_number );
    268        echo "</td>";
    269        
    270         echo "<td>";
    271       echo  esc_attr($res->total_charge );
    272        echo "</td>";
    273        
    274      
    275          
    276         echo "<td>";
    277       echo  esc_attr($res->order_id );
    278        echo "</td>";
    279        
    280    
    281        echo "<td>";
    282       echo  esc_attr($res->created_at );
     315 
     316               echo "<td>";
     317      echo  esc_attr($res->purchase_plan_id );
     318       echo "</td>";
     319       
     320     
     321       echo "<td>";
     322      echo wc_price( esc_attr($res->total_charge ));
     323       echo "</td>";
     324       
     325
     326     
     327   
     328       echo "<td>";
     329      echo  esc_attr($res->booking_date );
    283330       echo "</td>";
    284331       
     
    306353   
    307354}
     355
     356function saksh_other_booking_by_date($request_date){
     357   
     358   
     359   
     360        global $wpdb;
     361 
     362       
     363       
     364         
     365       
     366 
     367   
     368
     369        $results = $wpdb->get_results(      $wpdb->prepare(
     370    "SELECT * FROM {$wpdb->prefix}bookings  WHERE `booking_date` =date(%s)", 
     371$request_date
     372)  );
     373        ?>
     374        <div class="  wrap">
     375 
     376           
     377           
     378          <h1 class="wp-heading-inline">
     379             
     380               
     381All list of booking </h1> 
     382   
     383       
     384<h2>
     385   
     386   
     387 Date <?php echo $request_date; ?>
     388   
     389   
     390</h2>
     391        <?php
     392       
     393     echo "<table class=' table wp-list-table widefat    '>";
     394     
     395     
     396     
     397     
     398      echo "<tr>";
     399     
     400       echo "<td> Booking ID </td>";
     401       
     402   
     403       
     404       echo "<td> Date start </td>";
     405       
     406       echo "<td> Date end </td>";
     407          echo "<td> Name </td>";
     408       
     409       echo "<td> Email </td>";
     410         
     411        echo "<td> Phone </td>";
     412       echo "<td> Adult </td>";
     413       
     414       echo "<td>Kid </td>";
     415       
     416       
     417       echo "<td>Purchase plan </td>";
     418       
     419        echo "<td> Total Charge</td>";
     420       
     421         
     422         
     423       
     424       echo "<td>Created at </td>";
     425       
     426       
     427       
     428       echo "<td>Status </td>";
     429       
     430       echo "</tr>";
     431     
     432     
     433  foreach( $results as $res)
     434  {
     435       
     436      echo "<tr>";
     437     
     438       echo "<td>";
     439      echo  esc_attr( $res->order_id );
     440       echo "</td>";
     441     
     442       
     443       echo "<td>";
     444      echo  esc_attr($res->date_start );
     445       echo "</td>";
     446       
     447       echo "<td>";
     448      echo  esc_attr($res->date_end );
     449       echo "</td>";
     450       
     451       
     452               
     453        echo "<td>";
     454      echo  esc_attr($res->first_name );
     455     
     456      echo  esc_attr($res->last_name );
     457       echo "</td>";
     458       
     459       echo "<td>";
     460      echo  esc_attr($res->email );
     461       echo "</td>";
     462         
     463        echo "<td>";
     464      echo  esc_attr($res->phone );
     465       echo "</td>";
     466       
     467       
     468       
     469       echo "<td>";
     470      echo   esc_attr($res->adult );
     471       echo "</td>";
     472       
     473       echo "<td>";
     474      echo   esc_attr($res->kid );
     475       echo "</td>";
     476       
     477       
     478   
     479       
     480 
     481               echo "<td>";
     482               
     483               
     484      echo  esc_attr($res->room_id );
     485      echo "--";
     486      echo  $res->purchase_plan_id  ;
     487     
     488      echo  esc_attr($res->purchase_plan_id );
     489     
     490     
     491       echo "</td>";
     492       
     493     
     494       echo "<td>";
     495      echo wc_price( esc_attr($res->total_charge ));
     496       echo "</td>";
     497       
     498
     499     
     500   
     501       echo "<td>";
     502      echo  esc_attr($res->booking_date );
     503       echo "</td>";
     504       
     505       
     506       
     507       echo "<td>";
     508      echo  esc_attr($res->status );
     509       echo "</td>";
     510       
     511       
     512       
     513       
     514       
     515      echo "</tr>";
     516  }
     517   
     518 
     519     echo "</table>";
     520 
     521     echo "</div>";
     522
     523
     524 
     525   
     526   
     527}
  • saksh-wp-hotel-booking-lite/trunk/saksh_ajax.php

    r3084838 r3090240  
    11<?php
    2         if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
     2if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    33
    44add_action("wp_ajax_saksh_booking_history", "saksh_get_booking_history");
     
    1414 
    1515 
    16       $saksh_get_booking_history= wp_cache_get( 'saksh_get_booking_history' );
     16 
    1717       
    18  if(false===saksh_get_booking_history){
     18 
    1919    $results= $wpdb->get_results( "SELECT booking_date as start ,booking_date as end  , count(*) as title  FROM  {$wpdb->prefix}bookings GROUP by booking_date  ");
    2020
    21 $data= wp_json_encode($results);
    2221
    2322
    24         wp_cache_set( 'saksh_get_booking_history', $data, '', HOUR_IN_SECONDS );
    2523
    26 echo esc_attr($data);
     24echo wp_json_encode($results);
    2725
    28  }
    29  else
    30  {
    31      echo esc_attr( $saksh_get_booking_history);
    3226 
    33 }
    3427        wp_die();
    3528
  • saksh-wp-hotel-booking-lite/trunk/saksh_enqueue.php

    r3084838 r3090240  
    11<?php
    2         if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
     2if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    33
    44 
     
    1111   
    1212   
    13   wp_enqueue_style('saksh-admin-styles',$url , '', '0.1.0');
     13  wp_enqueue_style('saksh-admin-styles',$url);
     14 
     15 
     16 
     17  wp_enqueue_style('saksh-styles-ui', "https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css");
     18
    1419 
    1520 
    1621 
    1722 
    18  
     23 
     24
     25 
    1926}
    2027
     
    3239   
    3340   
    34   wp_enqueue_style('saksh-styles',$url ,'', '0.1.0');
     41  wp_enqueue_style('saksh-styles',$url);
    3542 
     43 
     44 
     45 
     46   
     47 
     48$url=esc_url( plugins_url( 'assets/js/daterangepicker/daterangepicker.css', __FILE__ ) );
     49
     50wp_enqueue_style('saksh-daterangepicker',$url);
     51 
     52   
     53 
     54 
     55 
     56$url=esc_url( plugins_url( 'assets/js/daterangepicker/moment.min.js', __FILE__ ) );
     57 
     58 wp_enqueue_script( 'saksh_moment', $url, array('jquery'), null, true );   
     59 
     60 
     61 
     62 
     63 
     64 
     65$url=esc_url( plugins_url( 'assets/js/daterangepicker/daterangepicker.js', __FILE__ ) );
     66 
     67 wp_enqueue_script( 'saksh_lib_daterangepicker', $url, array('jquery'), null, true );   
     68 
     69 
     70 
     71 
     72 
     73 
     74 
     75 
     76 
     77 
     78 
     79$url=esc_url( plugins_url( 'assets/js/saksh-daterangepicker.js', __FILE__ ) );
     80 
     81 wp_enqueue_script( 'saksh_daterangepicker', $url, array('jquery'), null, true );   
     82   
    3683 
    3784}
     
    4794   
    4895   
    49     wp_enqueue_script( 'saksh_js', plugin_dir_url(__FILE__).'assets/js/saksh-admin.js', array('jquery'), '0.1.0', true );
     96 wp_enqueue_script( 'saksh_js', plugin_dir_url(__FILE__).'assets/js/saksh-admin.js', array('jquery'), null, true );
    5097
    5198 
     
    53100
    54101     wp_localize_script( 'saksh_js', 'saksh_object',
    55             array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ,'saksh_report_url'=>admin_url(   ) ) );
     102            array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ,'saksh_report_url'=>'https://bhagvadgita.ukbestdeal.com/wp-admin/admin.php' ) );
    56103           
    57104           
     
    59106   
    60107   
    61     wp_enqueue_script( 'saksh_js', plugin_dir_url(__FILE__).'assets/js/fullcalendar.global.min.js', array(), '0.1.0', true );
    62108   
     109    wp_enqueue_script( 'saksh_js',  'https://cdn.jsdelivr.net/npm/[email protected]/index.global.min.js', array(), null, true );
     110           
     111   
     112   
     113    wp_enqueue_script( 'saksh_ui_js',  'https://code.jquery.com/ui/1.13.2/jquery-ui.js', array(), null, true );
     114   
     115     
     116   
     117   
     118    wp_enqueue_script( 'saksh_ckeditor11',  'https://cdn.ckeditor.com/ckeditor5/29.0.0/classic/ckeditor.js', array(), null, true );
    63119 
    64                
    65120   
    66121}
  • saksh-wp-hotel-booking-lite/trunk/saksh_meta_box.php

    r3084838 r3090240  
    11<?php
    22 
    3         if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
     3if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    44function saksh_add_room_type_taxonomies() {
    55 
     
    1212   
    1313    'labels' => array(
    14       'name' => __( 'Room type', 'saksh-wp-hotel-booking-lite' ),
    15       'singular_name' => __( 'Room type', 'saksh-wp-hotel-booking-lite' ),
    16       'search_items' =>  __( 'Search Room type' , 'saksh-wp-hotel-booking-lite' ),
    17       'all_items' => __( 'All Room type', 'saksh-wp-hotel-booking-lite' ),
    18      
    19       'edit_item' => __( 'Edit Room type' , 'saksh-wp-hotel-booking-lite' ),
    20       'update_item' => __( 'Update Room type', 'saksh-wp-hotel-booking-lite' ),
    21       'add_new_item' => __( 'Add New Room type', 'saksh-wp-hotel-booking-lite' ),
    22       'new_item_name' => __( 'New Room type Name', 'saksh-wp-hotel-booking-lite' ),
    23       'menu_name' => __( 'Room type', 'saksh-wp-hotel-booking-lite' ),
     14      'name' => _x( 'Room type'  ,'saksh-wp-hotel-booking-lite'),
     15      'singular_name' => _x( 'Room type'  ,'saksh-wp-hotel-booking-lite'),
     16      'search_items' =>  __( 'Search Room type' ),
     17      'all_items' => __( 'All Room type' ),
     18     
     19      'edit_item' => __( 'Edit Room type' ),
     20      'update_item' => __( 'Update Room type' ),
     21      'add_new_item' => __( 'Add New Room type' ),
     22      'new_item_name' => __( 'New Room type Name' ),
     23      'menu_name' => __( 'Room type' ),
    2424    ),
    2525   
     
    5050   
    5151    'labels' => array(
    52       'name' => __( 'Amenities', 'saksh-wp-hotel-booking-lite' ),
    53       'singular_name' => __( 'Amenity', 'saksh-wp-hotel-booking-lite' ),
    54       'search_items' =>  __( 'Search Amenities' , 'saksh-wp-hotel-booking-lite' ),
    55       'all_items' => __( 'All Amenities', 'saksh-wp-hotel-booking-lite' ),
    56       'parent_item' => __( 'Parent Amenity', 'saksh-wp-hotel-booking-lite' ),
    57       'parent_item_colon' => __( 'Parent Amenity:' , 'saksh-wp-hotel-booking-lite' ),
    58       'edit_item' => __( 'Edit Amenity', 'saksh-wp-hotel-booking-lite' ),
    59       'update_item' => __( 'Update Amenity' , 'saksh-wp-hotel-booking-lite' ),
    60       'add_new_item' => __( 'Add New Amenity' , 'saksh-wp-hotel-booking-lite' ),
    61       'new_item_name' => __( 'New Amenity Name' , 'saksh-wp-hotel-booking-lite' ),
    62       'menu_name' => __( 'Amenities' , 'saksh-wp-hotel-booking-lite' ),
     52      'name' => _x( 'Amenities','saksh-wp-hotel-booking-lite' ),
     53      'singular_name' => _x( 'Amenity','saksh-wp-hotel-booking-lite' ),
     54      'search_items' =>  __( 'Search Amenities' ),
     55      'all_items' => __( 'All Amenities' ),
     56      'parent_item' => __( 'Parent Amenity' ),
     57      'parent_item_colon' => __( 'Parent Amenity:' ),
     58      'edit_item' => __( 'Edit Amenity' ),
     59      'update_item' => __( 'Update Amenity' ),
     60      'add_new_item' => __( 'Add New Amenity' ),
     61      'new_item_name' => __( 'New Amenity Name' ),
     62      'menu_name' => __( 'Amenities' ),
    6363    ),
    6464   
     
    8686{
    8787   
     88 
     89
    8890    // Check if our nonce is set.
    8991    if (!isset($_POST['saksh_nonce'])) {
     
    9193    }
    9294   
    93  
    94 
    95     // Verify that the nonce is valid.
    96     if (!wp_verify_nonce(sanitize_text_field(wp_unslash ($_POST['saksh_nonce'])), 'saksh_nonce')) {
    97         return;
    98     }
    99  
     95     if ( ! isset( $_POST['saksh_nonce'] )
     96    || ! wp_verify_nonce( sanitize_text_field(wp_unslash ( $_POST['saksh_nonce'])) , 'saksh_nonce_action' )
     97) {
     98   return  esc_html_e( 'Sorry, your nonce did not verify.', 'saksh-wp-hotel-booking-lite' );
     99
     100   exit;
     101}
     102
     103   
    100104 
    101105    // If this is an autosave, our form has not been submitted, so we don't want to do anything.
     
    116120
    117121 
    118  
    119    
    120      $total_rooms  = get_post_meta( $post->ID, 'total_rooms', true );
    121    
    122    
    123     $rate_per_night_value = intval(sanitize_text_field( $_POST['rate_per_night'] ));
    124     if ( ! $rate_per_night_value ) {
    125       $rate_per_night_value = 0;
    126     }
    127    
    128  
    129     update_post_meta($post_id, 'rate_per_night', $rate_per_night_value);
    130    
    131    
    132    
    133    
    134    
    135     $total_rooms = intval(sanitize_text_field( $_POST['total_rooms']) );
    136     if ( ! $total_rooms ) {
    137       $total_rooms = 0;
    138     }
    139    
    140  
    141     update_post_meta($post_id, 'total_rooms', $total_rooms);
    142    
     122 
     123 
     124     
     125    $saksh_payment_option =  $_POST['saksh_payment_option']  ;
     126   
     127 
     128    update_post_meta($post_id, 'saksh_payment_option', $saksh_payment_option);
    143129   
    144130    $other_room_details = sanitize_text_field(  $_POST['other_room_details']);
     
    171157    $editor_id = 'room_short_intro';
    172158
    173  
     159   global $settings;
    174160
    175161
     
    177163}
    178164
     165
     166
     167
     168
     169function saksh_booking_option_form($post,$saksh_payment_option , $id)
     170{
     171   
     172 
     173      $post_id= $post->ID;
     174     
     175//  $plan_name  = get_post_meta( $post->ID, 'plan_name_'.$id, true );
     176 
     177 // $rate_per_night  = get_post_meta( $post->ID, 'rate_per_night_'.$id, true );
     178
     179 
     180   
     181   
     182    $fields=array( );
     183   
     184   $fields = apply_filters( 'saksh_room_payment_options_metabox', $fields );
     185  //
     186   
     187     echo "<hr />";
     188     
     189   //  print_r($value);
     190     
     191 saksh_print_form($post_id, $fields,$saksh_payment_option ,$id);
     192    echo "<hr />";
     193   
     194   
     195   
     196}
     197
     198
     199
     200
    179201function saksh_meta_box_callback_rate_per_night($post)
    180202{
    181  
    182    wp_nonce_field('saksh_nonce', 'saksh_nonce');
    183  $rate_per_night_value = get_post_meta( $post->ID, 'rate_per_night', true );
    184 
    185  
    186      $total_rooms  = get_post_meta( $post->ID, 'total_rooms', true );
    187    
    188     ?>
    189    
    190   <label for="rate_per_night"><?php esc_html_e('Rate per night', 'saksh-wp-hotel-booking-lite'); ?></label><br>
    191  
    192   <input class="input" type="text" id="rate_per_night" name="rate_per_night" value="<?php echo esc_attr($rate_per_night_value); ?>" required><br>
    193   <br>
    194  
    195   <label for="rate_per_night"><?php esc_html_e('Total Rooms', 'saksh-wp-hotel-booking-lite'); ?></label><br>
    196  
    197   <input class="input" type="text" id="total_rooms" name="total_rooms" value="<?php echo esc_attr( $total_rooms); ?>" required><br>
    198   <br>
    199  
    200   <?php
     203   wp_nonce_field('saksh_nonce', 'saksh_nonce');
     204   
     205   
     206     
     207     $saksh_payment_option=  get_post_meta( $post->ID, 'saksh_payment_option' , true ) ;
     208 
     209 
     210 
     211 
     212  // echo "<pre>";
     213  //   print_r( $saksh_payment_option);   
     214 
     215 
     216 $product_id=  saksh_hotel_booking_product() ;
     217  $product = wc_get_product( $product_id );
     218 
     219    // var_dump($product  );
     220 //    var_dump($product->get_price() );
     221//echo "</pre>";
     222 ?>
     223    <hr />
     224     
     225   
     226    <div id="tabs">
     227  <ul>
     228    <li><a href="#tabs-1"><?php _e('Booking option 1', 'saksh-wp-hotel-booking-lite'); ?>  </a></li>
     229   
     230    <li><a href="#tabs-2"><?php _e('Booking option 2', 'saksh-wp-hotel-booking-lite'); ?>  </a></li>
     231     
     232   
     233    <li><a href="#tabs-3"><?php _e('Booking option 3', 'saksh-wp-hotel-booking-lite'); ?>  </a></li>
     234   
     235    <li><a href="#tabs-4"><?php _e('Booking option 4', 'saksh-wp-hotel-booking-lite'); ?>  </a></li>
     236   
     237    <li><a href="#tabs-5"><?php _e('Booking option 5', 'saksh-wp-hotel-booking-lite'); ?>  </a></li>
     238   
     239  </ul>
     240 
     241 
     242 
     243   
     244  <div id="tabs-1">
     245    <?php   saksh_booking_option_form($post,$saksh_payment_option,"1"); ?>
     246   
     247   
     248  </div>
     249 
     250   
     251  <div id="tabs-2">
     252    <?php   saksh_booking_option_form($post,$saksh_payment_option,"2"); ?>
     253   
     254   
     255  </div>   
     256  <div id="tabs-3">
     257    <?php   saksh_booking_option_form($post,$saksh_payment_option,"3"); ?>
     258   
     259   
     260  </div>  <div id="tabs-4">
     261    <?php   saksh_booking_option_form($post,$saksh_payment_option,"4"); ?>
     262   
     263   
     264  </div> <div id="tabs-5">
     265    <?php   saksh_booking_option_form($post,$saksh_payment_option,"5"); ?>
     266   
     267   
     268  </div>
     269</div>
     270 
     271 
     272   
     273 
     274   
     275       
     276 
     277       
     278  <?php
     279 
     280  echo "<pre>";
     281     print_r( $saksh_payment_option);   
     282 
     283
     284echo "</pre>";
    201285}
    202286function saksh_meta_box_callback_other_details($post)
     
    209293    $editor_id = 'other_room_details';
    210294
    211    
     295   global $settings;
    212296   
    213297
     
    218302function saksh_meta_box()
    219303{
    220     $screens = [ 'rooms'];
    221 
    222     foreach ($screens as $screen) {
    223        
     304   
    224305     
    225306
     
    228309            __('Short intro', 'saksh-wp-hotel-booking-lite'),
    229310            'saksh_meta_box_callback_short_intro',
    230             $screen
     311            'rooms'
    231312        );
    232313       
     
    236317            __('Booking data', 'saksh-wp-hotel-booking-lite'),
    237318            'saksh_meta_box_callback_rate_per_night',
    238             $screen
     319           'rooms'
    239320        );
    240321
     
    245326            __('Other details', 'saksh-wp-hotel-booking-lite'),
    246327            'saksh_meta_box_callback_other_details',
    247             $screen
     328            'rooms'
    248329        );
    249330       
    250331       
    251     }
     332   
    252333}
    253334
  • saksh-wp-hotel-booking-lite/trunk/saksh_room_search_v2.php

    r3084838 r3090240  
    11<?php
    2         if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    3         ?>
     2if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
     3?>
    44   
    5    
    6 <div class="container ">
    7   <div class="row">
    8     <div class="col ">
     5 
     6 
     7 
     8 
     9 
     10 <div     class="saksh saksh_form  saksh_booking_form"  >
     11     <form action="" method="post">
     12         
     13         
     14    <?php wp_nonce_field( 'saksh_nonce_action', 'saksh_nonce' ); ?>
     15 
     16 
     17 
    918 
    1019 
     20<h2 class='date'>Date</h2>
     21 <div class="date">
     22     
     23 
     24<input type="text" class="form-control" name="booking_date"  id="booking_date" />
     25     
     26     
     27<input type="hidden" class="form-control" name="date_start" value="<?php echo date("Y-m-d" ); ?>"  id="date_start" />
     28   
     29<input type="hidden" class="form-control" name="date_end" value="<?php echo date("Y-m-d" ); ?>" id="date_end" />
     30
     31 </div>
     32 
     33 
     34 
     35 
     36 <h2 class='adult'>Adults</h2>
     37 <div class="adult">
     38     
     39 
     40<input type="number"  class="form-control" name="adult" />
     41     
     42 </div>
     43 
     44   <h2 class='kid'>Kids</h2>
     45 <div class="kid">
     46     
     47 
     48<input type="number" class="form-control" name="kid" />
     49     
     50 </div>
     51  <div class="no_rooms" style="display:none;">
     52  <h2 class='no_rooms'>No of rooms</h2>
     53
     54     
     55 
     56<input type="number" value=1 class="form-control" name="no_rooms" />
     57     
     58 </div>
     59 
     60  <br />
     61   
     62 <input type="submit" value="Search Room"  class="button button-primary button-large   saksh_booking" />
     63     </form>
     64 </div>
    1165 
    1266   
     
    1670     if (!empty($_POST))
    1771  {
    18       
    19       
    20       if ( ! isset( $_POST['saksh_nonce'] )
    21     || ! wp_verify_nonce( sanitize_text_field( wp_unslash ($_POST['saksh_nonce'])) , 'saksh_nonce_action' )
     72     
     73     
     74        if ( ! isset( $_POST['saksh_nonce'] )
     75    || ! wp_verify_nonce( sanitize_text_field(wp_unslash ( $_POST['saksh_nonce'])) , 'saksh_nonce_action' )
    2276) {
    2377   return  esc_html_e( 'Sorry, your nonce did not verify.', 'saksh-wp-hotel-booking-lite' );
     
    2680}
    2781   
     82   
     83 
    2884 
    2985 global $wpdb;
     
    48104     
    49105     
    50       $cart_item_data = array( 'date_start' => $date_start , "date_end"=>$date_end ,'adult'=>$adult,"kid"=>$kid , "no_rooms"=>$no_rooms);
     106      $query_data = array( 'date_start' => $date_start , "date_end"=>$date_end ,'adult'=>$adult,"kid"=>$kid , "no_rooms"=>$no_rooms);
    51107
    52108
     109       
    53110     
    54      
    55       $res=saksh_get_rooms_which_r_available( $cart_item_data);
    56      
     111      $room_data=saksh_get_rooms_which_r_available( $query_data);
    57112     
    58113       
    59       echo "<hr/>";
     114       
    60115 
    61     $args = array( 'post_type' => 'rooms','post__in' =>$res['room_id']);
     116    $args = array( 'post_type' => 'rooms' );
    62117
    63118
     
    78133      $post_id=get_the_ID();
    79134           
    80  $rate_per_night_value = get_post_meta($post_id, 'rate_per_night', true );
    81  $other_room_details = get_post_meta($post_id, 'other_room_details', true );
    82  $room_short_intro = get_post_meta( $post_id, 'room_short_intro', true );
     135 
     136     saksh_print_room_info_dynamic($post_id,$query_data);
     137    }
     138 
     139   
    83140     
    84      
    85        
    86         ?>
    87        
    88         <div class="row mb-5">
    89            
    90            
    91        
    92         <div class="col-md-12">
    93            
    94            
    95            
    96             <?php if ( has_post_thumbnail() ) : ?>
    97     <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
    98         <?php the_post_thumbnail('post-thumbnail', ['class' => 'img-fluid', 'title' => 'Feature image']); ?>
    99     </a>
    100 <?php endif; ?>
    101 
    102 
    103            
    104             </div>
    105            
    106            
    107            
    108            
    109         <div class="col-md-9">
    110             <?php   the_title(); ?>
    111            
    112              <?php 
    113  echo esc_attr($room_short_intro );   ?>
    114    
    115  
    116                 <?php 
    117  echo esc_attr($rate_per_night_value  );  ?>
    118                
    119            
    120                 <?php 
    121  echo esc_attr($other_room_details  );    ?>
    122                
    123                          
    124      <form action="" method="post">
    125          
    126     <?php wp_nonce_field( 'saksh_nonce_action', 'saksh_nonce' ); ?>
    127    
    128  
    129   <input type="hidden"   value="book_now" name="saksh_case" />
    130  
    131    
    132  
    133  
    134    
    135   <input type="hidden"  value="<?php echo  esc_attr($post_id);?>" name="room_id" />
    136      
    137  <?php
    138  
    139  
    140  foreach ($cart_item_data as $key => $value) {
    141  
    142     echo '<input type="hidden"   value="'.esc_attr($value).'" name="'.esc_attr($key).'" />';
    143 }
    144 
    145 
    146 ?>
    147  
    148    
    149  <input type="submit" value="Book now"  class="saksh_booking" />
    150      </form>
    151             </div>
    152            
    153            
    154         <div class="col-md-3">
    155              <?php
    156  
    157  
    158  
    159  $amenities_list = get_the_terms( $post_id, 'amenities');
    160  
    161  if($amenities_list )
    162  
    163  {
    164      
    165  
    166 $types ='';
    167 foreach($amenities_list as $term_single) {
    168    
    169     if(isset($term_single->slug) )
    170      $types .= ucfirst($term_single->slug).', ';
    171      
    172      
    173 }
    174 $typesz = rtrim($types, ', ');
    175 
    176 
    177 echo esc_attr($typesz);
    178 
    179 }
    180    ?>
    181             </div>
    182            
    183         </div>
    184        
    185        
    186            
    187                
    188              
    189                
    190      
    191          
    192            
    193    
    194          
    195        
    196        
    197        
    198         <?php
    199        
    200        
    201        
    202      
    203        
    204        
    205141       
    206142       
    207  
    208  
    209     }
     143 
    210144   
    211145}
     
    213147{
    214148 
    215    esc_html_e( 'Sorry, no posts matched your criteria.', 'saksh-wp-hotel-booking-lite' );
     149    _e( 'Sorry, no posts matched your criteria.', 'saksh-wp-hotel-booking-lite' );
    216150
    217151}
    218152
    219153
    220 
    221 echo "</table>";
     154 
    222155wp_reset_postdata();
    223156 
     
    226159 
    227160 }
    228  else
    229  {
    230  
    231  ?> <div class="saksh saksh_form">
    232      <form action="" method="post">
    233          
    234          
    235  
    236  
    237    
    238  
    239  
    240  
    241  
    242  
    243 <h2 class='date_start'>From</h2>
    244  <div class="date_start">
    245      
    246  
    247 <input type="date" class="form-control" name="date_start" />
    248      
    249  </div>
    250  
    251  
    252 <h2 class='date_end'>To</h2>
    253  <div class="date_end">
    254      
    255  
    256 <input type="date" class="form-control" name="date_end" />
    257      
    258  </div>
    259  
    260  
    261  <h2 class='adult'>Adults</h2>
    262  <div class="adult">
    263      
    264  
    265 <input type="number"  class="form-control" name="adult" />
    266      
    267  </div>
    268  
    269    <h2 class='kid'>Kids</h2>
    270  <div class="kid">
    271      
    272  
    273 <input type="number" class="form-control" name="kid" />
    274      
    275  </div>
    276  
    277   <h2 class='no_rooms'>No of rooms</h2>
    278  <div class="no_rooms">
    279      
    280  
    281 <input type="number" class="form-control" name="no_rooms" />
    282      
    283  </div>
    284  
    285   <br />
    286    
    287  <input type="submit" value="Search Room"  class="button button-primary button-large   saksh_booking" />
    288      </form>
    289  </div>
    290      
    291      <?php
    292      
    293  }
    294161 
    295162 ?>
     163 
    296164 
    297  </div>
    298  
    299      
    300  
    301  
    302  
    303  
    304  
    305  
    306  
    307 
    308 </div>
    309 
    310 </div>
    311 
    312 </div>
    313 
    314 </div>
    315 
    316 
    317  
  • saksh-wp-hotel-booking-lite/trunk/saksh_room_template.php

    r3084838 r3090240  
    11<?php
    2         if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    32
     3if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    44
    55get_header();
     
    5353
    5454
    55  echo esc_attr($room_short_intro );
     55 echo esc_html_e($room_short_intro );
    5656 
    5757 
     
    8181
    8282
    83  echo esc_attr($other_room_details  );
     83 echo esc_html_e($other_room_details  );
    8484 
    8585   ?>
  • saksh-wp-hotel-booking-lite/trunk/saksh_rooms_custom_post.php

    r3084838 r3090240  
    11<?php
    2         if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
     2if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    33
    44function saksh_rooms_custom_post_type()
     
    66    // Set UI labels for Custom Post Type
    77    $labels = [
    8         'name' => _x('Room', 'Post Type General Name', 'saksh-wp-hotel-booking-lite'),
    9         'singular_name' => _x('Room', 'Post Type Singular Name', 'saksh-wp-hotel-booking-lite'),
    10         'menu_name' => __('Rooms', 'saksh-wp-hotel-booking-lite'),
    11         'parent_item_colon' => __('Parent Room', 'saksh-wp-hotel-booking-lite'),
    12         'all_items' => __('All Rooms', 'saksh-wp-hotel-booking-lite'),
    13         'view_item' => __('View Room', 'saksh-wp-hotel-booking-lite'),
    14         'add_new_item' => __('Add New Room', 'saksh-wp-hotel-booking-lite'),
    15         'add_new' => __('Add New', 'saksh-wp-hotel-booking-lite'),
    16         'edit_item' => __('Edit Room', 'saksh-wp-hotel-booking-lite'),
    17         'update_item' => __('Update Room', 'saksh-wp-hotel-booking-lite'),
    18         'search_items' => __('Search Room', 'saksh-wp-hotel-booking-lite'),
    19         'not_found' => __('Not Found', 'saksh-wp-hotel-booking-lite'),
    20         'not_found_in_trash' => __('Not found in Trash', 'saksh-wp-hotel-booking-lite'),
     8        'name' => _x('Room', 'Post Type General Name', 'saksh'),
     9        'singular_name' => _x('Room', 'Post Type Singular Name', 'saksh'),
     10        'menu_name' => __('Rooms', 'saksh'),
     11        'parent_item_colon' => __('Parent Room', 'saksh'),
     12        'all_items' => __('All Rooms', 'saksh'),
     13        'view_item' => __('View Room', 'saksh'),
     14        'add_new_item' => __('Add New Room', 'saksh'),
     15        'add_new' => __('Add New', 'saksh'),
     16        'edit_item' => __('Edit Room', 'saksh'),
     17        'update_item' => __('Update Room', 'saksh'),
     18        'search_items' => __('Search Room', 'saksh'),
     19        'not_found' => __('Not Found', 'saksh'),
     20        'not_found_in_trash' => __('Not found in Trash', 'saksh'),
    2121    ];
    2222
     
    2424
    2525    $args = [
    26         'label' => __('Rooms', 'saksh-wp-hotel-booking-lite'),
    27         'description' => __('Room news and reviews', 'saksh-wp-hotel-booking-lite'),
     26        'label' => __('Rooms', 'saksh'),
     27        'description' => __('Room news and reviews', 'saksh'),
    2828        'labels' => $labels,
    2929        // Features this CPT supports in Post Editor
     
    8888
    8989
    90  
    9190
    92 
    93 
    94 
    95 
    96 
    97 
    98 
    99 
    100 
    101 
    102 
    103 
  • saksh-wp-hotel-booking-lite/trunk/saksh_util.php

    r3084838 r3090240  
    11<?php
    2         if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
     2if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    33
    44 function saksh_date_diff_in_days($date1, $date2) {
  • saksh-wp-hotel-booking-lite/trunk/saksh_wchook.php

    r3085300 r3090240  
    11<?php
    2         if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    3 
    4     function  saksh_get_hotel_booking_product() {
     2if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
     3
     4    function saksh_hotel_booking_product() {
    55       
    6          
    7        
    8        
    9     return    get_option( '_saksh_booking_product_v1' )  ;
    10     }
    11  
    12  
     6       
     7 return  saksh_create_product_if_not_exist();
     8       
     9       
     10 
     11    }
     12 
     13
     14//add_action('init', 'saksh_create_product_if_not_exist', 0);
    1315
    1416
    1517  function saksh_create_product_if_not_exist() {
    16         if ( ! wc_get_product( get_option( '_saksh_booking_product_v1' ) ) ) {
    17             saksh_create_product();
    18         }
    19        
    20  
     18
     19
     20        if ( get_option( 'saksh_booking_product_v3' )   ) {
     21         
     22       
     23$product_id=  get_option( 'saksh_booking_product_v3' )  ;
     24$product = wc_get_product( $product_id );
     25
     26$status=$product->get_status();
     27
     28
     29if($status=="public")
     30return $product_id;
     31
     32
     33
     34}
     35
     36
     37
     38
     39return  saksh_create_product();
     40
     41
     42 
     43       
     44     
    2145    }
    2246
     
    2751            'post_type'    => 'product',
    2852            'post_excerpt' => '',
    29             'post_content' => stripslashes( html_entity_decode( 'Auto generated product for room booking please do not delete or update.', ENT_QUOTES, 'UTF-8' ) ),
     53        //  'post_content' => stripslashes( html_entity_decode( 'Auto generated product for room booking please do not delete or update.', ENT_QUOTES, 'UTF-8' ) ),
    3054            'post_author'  => get_current_user_id(),
    3155        );
     
    5074            update_post_meta( $product_id, '_sale_price_dates_from', '' );
    5175            update_post_meta( $product_id, '_sale_price_dates_to', '' );
    52             update_post_meta( $product_id, '_price', '' );
     76            update_post_meta( $product_id, '_price', '10' );
    5377            update_post_meta( $product_id, '_sold_individually', 'yes' );
    5478            update_post_meta( $product_id, '_manage_stock', 'no' );
     
    6185            }
    6286
    63             update_option( '_saksh_booking_product_v1', $product_id );
     87            update_option( 'saksh_booking_product_v3', $product_id );
    6488        }
     89       
     90        return $product_id;
     91       
     92       
    6593    }
    6694
     
    73101   function saksh_check_wc() {
    74102       
     103       $r=array(print_r($_REQUEST,true));
    75104       
     105          do_action('saksh_hotel_booking',$r);
     106         
     107         
     108         
     109         
     110         
    76111      $active_plugins= (array) get_option( 'active_plugins', array() );
    77112     
     
    98133   
    99134function saksh_display_engraving_text_cart( $item_data, $cart_item ) {
    100  
    101  
     135 
    102136   
    103137        $item_data[] = array(
     
    130164        'display' => '',
    131165    );
     166     
    132167   
    133168    return $item_data;
     
    142177function saksh_add_text_to_order_items( $item, $cart_item_key, $values, $order ) {
    143178   
    144    
    145    
    146      
    147 
     179 
    148180    if ( empty( $values['date_start'] ) ) {
    149181        return;
     
    166198    }
    167199   
    168    
    169    
    170 /*
    171 $item->add_meta_data( __( 'Sate start', 'saksh' ), $values['date_start'] );
    172    
    173     $item->add_meta_data( __( 'Date end', 'saksh' ), $values['date_end'] );
    174 $item->add_meta_data( __( 'Adult', 'saksh' ), $values['adult'] );
    175  
    176 $item->add_meta_data( __( 'Kid', 'saksh' ), $values['kid'] );
    177 */
     200        if ( empty( $values['purchase_plan_id'] ) ) {
     201        return;
     202    }
     203 
     204   
     205 
    178206 
    179207$item->add_meta_data( __( 'date_start', 'saksh-wp-hotel-booking-lite' ), $values['date_start'] );
     
    187215 
    188216
    189 
    190 
    191 
     217$item->add_meta_data( __( 'room_id', 'saksh-wp-hotel-booking-lite' ), $values['room_id'] );
     218 
     219
     220$item->add_meta_data( __( 'purchase_plan_id', 'saksh-wp-hotel-booking-lite' ), $values['purchase_plan_id'] );
     221 
     222
     223
     224saksh_capture_log(__LINE__,  $values);
     225
     226   
     227 
    192228}
    193229
     
    226262   $no_rooms = wc_get_order_item_meta( $key, 'no_rooms' );
    227263   
     264     
    228265   
    229266   
     
    280317 function saksh_hb_order_status_update($order_id,$status){
    281318
    282  
    283  
     319
    284320
    285321
     
    299335   
    300336   
    301     $data  = array('order_id' => $order_id ,'user_id' => $user_id , 'name' => $first_name  . " " . $last_name  ,'email' => $user_info->user_email  );
     337    $data  = array('order_id' => $order_id ,'user_id' => $user_id , 'first_name' => $first_name  ,'last_name' => $last_name , 'email' => $user_info->user_email  );
    302338   
    303339   
     
    336372   
    337373 $no_rooms = wc_get_order_item_meta( $key, 'no_rooms' );
    338    
    339    
    340    
     374 $purchase_plan_id = wc_get_order_item_meta( $key, 'purchase_plan_id' );
     375   
     376   
     377     $room_id = wc_get_order_item_meta( $key, 'room_id' );
     378          $purchase_plan_id = wc_get_order_item_meta( $key, 'purchase_plan_id' );
     379   
    341380   
    342381    $table_name = $wpdb->prefix . 'bookings';
     
    347386
    348387
     388
    349389 
    350390
    351391 $data['no_rooms']= $no_rooms;
    352  $data['room_number']= $product_id;
     392 
     393 $data['room_id']= $room_id;
    353394 $data['date_start']= $date_start;
    354395 $data['date_end']= $date_end;
    355396 $data['adult']= $adult;
    356397 $data['kid']= $kid;
     398   $data['purchase_plan_id']= $purchase_plan_id;
    357399 
    358400   
     
    361403     
    362404     
    363      
    364      
    365    
    366      
    367      
    368      
    369      
    370      
    371      
    372    
    373      $checkIfExists = $wpdb->get_var($wpdb->prepare(  "SELECT  order_id FROM  $wpdb->prefix . 'bookings' WHERE order_id = %d",$order_id));
     405 
     406saksh_capture_log(__LINE__,  $data);
     407
     408   
     409
     410     
     411   
     412     $checkIfExists = $wpdb->get_var($wpdb->prepare(  "SELECT  order_id FROM   $wpdb->prefix . 'bookings'  WHERE order_id = %d",$order_id ) );
    374413
    375414    if ($checkIfExists == NULL) {
     
    384423 
    385424
    386 $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->prefix . 'bookings' SET `status` = %s  WHERE  `order_id` = %d", $status,  $order_id   ) );
    387 
    388 
    389 
     425$wpdb->query( $wpdb->prepare( "UPDATE   $wpdb->prefix . 'bookings'   SET `status` = %s  WHERE  order_id  = %d", $status,  $order_id   ) );
     426
     427
     428 
     429   do_action('saksh_hb_status_update',$data);
    390430
    391431       
     
    429469
    430470
     471
     472saksh_capture_log(__LINE__,  $query_data);
     473
     474
     475
     476 
     477
    431478  $wpdb->insert( $table_name, $query_data );
    432479 
     
    446493
    447494 add_action( 'woocommerce_before_calculate_totals', 'saksh_add_custom_price', 1000, 1);
     495 
     496 
    448497function saksh_add_custom_price( $cart ) {
    449498   
     
    459508    foreach ( $cart->get_cart() as $cart_item ) {
    460509       
    461        if(isset($cart_item['total_charge']))
     510      if(isset($cart_item['total_charge']))
    462511        $cart_item['data']->set_price(  $cart_item['total_charge']  );
    463     }
     512 }
    464513}
    465514
Note: See TracChangeset for help on using the changeset viewer.