Class bkap_common
Contains common functions used all over the plugin.
Methods summary
public static
|
#
bkap_min_date_based_on_AdvanceBookingPeriod( integer $product_id, string $current_time )
Return min date based on the Advance Booking Period. |
public static
boolean
|
#
bkap_check_timeslot_for_weekday( integer $product_id, string $start_date )
Return true/false based on the timeslot available for selected date. |
public static
string
|
#
bkap_ajax_on_select_date( integer $product_id )
Return function name to be executed when multiple time slots are enabled. |
public static
array
|
#
bkap_get_betweendays( string $StartDate, string $EndDate, $format = 'd-n-Y' )
Return an array of dates that fall in a date range |
public static
array
|
#
bkap_get_betweendays_when_flat( string $StartDate, string $EndDate, $pro_id, $format = 'd-n-Y' )
Return an array of dates that fall in a date range |
public static
integer
|
|
public static
integer
|
|
public static
integer
|
#
bkap_get_custom_post( integer $product_id, integer $variation_id, string $product_type )
Returns the selected setting of Multicurrency at product level from WPML plugin when it is active |
public static
integer
|
#
bkap_get_price( integer $product_id, integer $variation_id, string $product_type, string $check_in = '', string $check_out = '' )
Return Woocommerce price |
public static
|
#
get_bundle_price( $price, integer $product_id, integer $variation_id )
Calculates the Total Bundle Price |
public static
integer
|
#
get_composite_price( integer $price, integer $product_id, integer $variation_id )
Calculates the Total Composite Price |
public static
string
|
|
public static
integer
|
#
woo_product_addons_compatibility_cart( integer $diff_days, array $cart_item_meta, integer $product_quantity )
Returns the WooCommerce Product Addons Options total |
public static
boolean
|
#
bkap_product_requires_confirmation( integer $product_id )
Checks if the product requires booking confirmation from admin |
public static
boolean
|
#
bkap_cart_requires_confirmation( )
Checks if Cart contains bookable products that require confirmation |
public static
boolean
|
#
bkap_order_requires_confirmation( WC_Order $order )
Checks if an order contains products that require admin confirmation. |
public static
stdClass
|
#
get_bkap_booking( integer $item_id )
Returns a booking object containing booking details for a bookable item in an order. Used in Confirmation/Cancellation emails |
public static
integer
|
#
bkap_get_number_of_slots( integer $product_id, string $date_check_in )
Returns the number of time slots present for a date. The date needs to be passed in the j-n-Y format |
public static
boolean
|
|
public static
array
|
#
get_woocommerce_product_list( boolean $variations = true )
Get all products and variations and sort alphbetically, return in array (title, id) |
public static
array
|
#
get_woocommerce_product_list_f_p( )
Get all products and sort alphbetically. Return in array (title, id, fixed block option, price range option) |
public static
|
#
bkap_update_order_item_meta( integer $item_id, integer $product_id, array $booking_data, boolean $gcal_import = false )
Adds item meta for bookable products when an order is placed |
public static
array
|
#
bkap_get_total_bookings_to_export( integer $user_id )
Creates a list of orders that are not yet exported to GCal |
public static
array
|
|
public static
|
#
bkap_add_notice( )
The below function adds notices to be displayed. It displays the notices as well using print notices function. This helps in displaying notices without having to reload the page. |
public static
|
|
public static
object
|
#
dateTimeDiff( object $date1, object $date2 )
This function will return the differance days between two dates. An object similar to the one returned by the new DateTime() is returned. |
public static
array
|
#
_date_range_limit( integer $start, integer $end, integer $adj, string $a, string $b, array $result )
Calculates the difference between the dates. Called from dateTimeDiff() |
public static
object
|
#
_date_range_limit_days( array $base, object $result )
Calculates the Ramge Limit. Called from dateTimeDiff() |
public static
array
|
|
public static
boolean
|
#
bkap_check_date_set( string $date )
Ensures whether the date is a future date. Used when exporting bookings to Google Calendar |
public static
boolean
|
|
public static
array
|
|
public static
array
|
#
get_bkap_event_statuses( )
Create and return an array of valid event statuses - For Imported Events from Google Calendar |
public static
integer
|
|
public static
boolean
|
#
bkap_check_specific_date_has_timeslot( integer $product_id )
This function Checks if the Specific Date contains time slot or not. |
public static
integer
|
#
bkap_get_parent_id( integer $child_id )
The function checks if the passed product ID is listed as a child in _children postmeta. |
public static
WC_Product
|
|
public static
array
|
#
bkap_get_cart_item_addon_data( array $cart_item )
Get Gravity Forms Addon Data for pricing purpose from cart item |
public static
float
|
|
public static
array
|
#
bkap_get_order_item_addon_data( WC_Order_Item $order_item )
Get Addon data for pricing purpose from Order Item data Includes Gravity Form Addons as well as WooCommerce Product Addons |
public static
boolean
|
#
bkap_is_cartitem_composite( array $cart_item )
Check if cart item passed is composite in some parent product |
public static
boolean
|
#
bkap_is_orderitem_composite( WC_Order_Item $item )
Check if order item is composite in some parent product |
public static
boolean
|
#
bkap_is_cartitem_bundled( array $cart_item )
Check if cart item passed is bundled in some parent product |
public static
boolean
|
#
bkap_is_orderitem_bundled( WC_Order_Item $item )
Check if order item is bundled in some parent product |
public static
array
|
|
public static
|
#
get_booking_ids_from_order_id( integer $order_id )
Returns an array of Booking IDs for the order ID sent. |
public static
array
|
#
bkap_get_bookings( string|array $post_status, array $additional_args = '' )
Returns an array of all bookings for passed status. |
public static
string
|