test

‘;*/

$sunday = ($sunday== ») ? 99 : 0;

$monday = ! empty($monday) ? $monday : 99;

$tuesday = ! empty($tuesday) ? $tuesday : 99;

$wednessday = ! empty($wednessday) ? $wednessday : 99;

$thursday = ! empty($thursday) ? $thursday : 99;

$friday = ! empty($friday) ? $friday : 99;

$saturday = ! empty($saturday) ? $saturday : 99;

//$allweekdays=array($sunday,$monday,$tuesday,$wednessday,$thursday,$friday,$saturday);

//print_r($allweekdays);

// check if shop is closed today

if($sunday==$gattodaynumericval || $monday==$gattodaynumericval || $tuesday==$gattodaynumericval || $wednessday==$gattodaynumericval || $thursday==$gattodaynumericval || $friday==$gattodaynumericval || $saturday==$gattodaynumericval)

{

$isholiday = ‘YES’;

}

$get_all_national_holidays_dates = get_option(‘byconsolewooodt_admin_national_holiday_date’);

$byconsolewooodt_allow_orders_on_closing_days = get_option(‘byconsolewooodt_allow_orders_on_closing_days’);

$national_holidays_array=explode(« , »,$get_all_national_holidays_dates);

// chaking if it is national holiday

if(in_array($todaydate_dm , $national_holidays_array))

{

$isholiday = ‘YES’;

}

if($isholiday === ‘NO’ || $byconsolewooodt_allow_orders_on_closing_days === ‘YES’)

{

?>

‘;*/

// populate order type based on order type selection on settings page

if(get_option(‘byconsolewooodt_order_type’)==’take_away’ || get_option(‘byconsolewooodt_order_type’)==’both’){

$get_option_byconsolewooodt_pickup_lable=get_option(‘byconsolewooodt_pickup_lable’);

if(!empty($get_option_byconsolewooodt_pickup_lable))

{

$byconsolewooodt_pickup_lable = get_option(‘byconsolewooodt_pickup_lable’);

}

else

{

$byconsolewooodt_pickup_lable = ‘Pickup’;

}

$pickup_label_text=$byconsolewooodt_pickup_lable;

if($pickup_label_text== »)

{

$pickup_label_text=’Pickup’;

}

?>

/>

/>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

checked= »checked » style= »float: left;margin-top: 10px; » >

 

checked= »checked » style= »float: left;margin-top: 10px; » >

 

 

 

style= »display: none; » />

 

echo ‘‘;
}else{
echo ‘‘;
}

?>

 

« />

 

 

 

 

 

 

‘;

global $woocommerce;// get cookie as array

/********************************/

$bycwooodt_has_virtual_products = false;

// Default virtual products number

$bycwooodt_virtual_products = 0;

// Get all products in cart

$bycwooodt_products = $woocommerce->cart->get_cart();

// Loop through cart products

foreach( $bycwooodt_products as $bycwooodt_product ) {

// Get product ID and ‘_virtual’ post meta

$bycwooodt_product_id = $bycwooodt_product[‘product_id’];

$bycwooodt_is_virtual = get_post_meta( $bycwooodt_product_id, ‘_virtual’, true );

// Update $has_virtual_product if product is virtual

if( $bycwooodt_is_virtual == ‘yes’ )

$bycwooodt_virtual_products += 1;

}

if( count($bycwooodt_products) == $bycwooodt_virtual_products )

{

$bycwooodt_both_product_count_val = ‘same’;

}

else

{

$bycwooodt_both_product_count_val = ‘not_same’;

}

if($bycwooodt_both_product_count_val == ‘not_same’)

{

$stripped_out_byconsolewooodt_delivery_widget_cookie=stripslashes($_COOKIE[‘byconsolewooodt_delivery_widget_cookie’]);

$byconsolewooodt_delivery_widget_cookie_array=json_decode($stripped_out_byconsolewooodt_delivery_widget_cookie,true);

//get pickup and delivery location

$pickup_loactions_array= get_option(‘byconsolewooodt_pickup_location’);

$delivery_loactions_array= get_option(‘byconsolewooodt_delivery_location’);

// Shop Closed By Date And Day

$isholiday = ‘NO’;

$todaydate = date(« m/d/Y »);

$todaydate_dm = date(« m/d »);

$shownotice=’none’;

$get_all_dates = get_option(‘byconsolewooodt_admin_holiday_date’);

$dateexplode=explode(« , »,$get_all_dates);

//Chaking if today is casual holiday

if(in_array($todaydate , $dateexplode))

{

$isholiday = ‘YES’;

}

// get todays date

$gattodayname=date(« l »);

$gattodaynumericval=date(« w »);

$sunday = get_option(‘byconsolewooodt_admin_closing_sunday’);

$monday = get_option(‘byconsolewooodt_admin_closing_monday’);

$tuesday = get_option(‘byconsolewooodt_admin_closing_tuesday’);

$wednessday = get_option(‘byconsolewooodt_admin_closing_wednessday’);

$thursday = get_option(‘byconsolewooodt_admin_closing_thursday’);

$friday = get_option(‘byconsolewooodt_admin_closing_friday’);

$saturday = get_option(‘byconsolewooodt_admin_closing_saturday’);

$sunday = ($sunday== ») ? 99 : 0;

$monday = ! empty($monday) ? $monday : 99;

$tuesday = ! empty($tuesday) ? $tuesday : 99;

$wednessday = ! empty($wednessday) ? $wednessday : 99;

$thursday = ! empty($thursday) ? $thursday : 99;

$friday = ! empty($friday) ? $friday : 99;

$saturday = ! empty($saturday) ? $saturday : 99;

// check if shop is closed today

if($sunday==$gattodaynumericval || $monday==$gattodaynumericval || $tuesday==$gattodaynumericval || $wednessday==$gattodaynumericval || $thursday==$gattodaynumericval || $friday==$gattodaynumericval || $saturday==$gattodaynumericval)

{

$isholiday = ‘YES’;

}

$get_all_national_holidays_dates = get_option(‘byconsolewooodt_admin_national_holiday_date’);

$byconsolewooodt_allow_orders_on_closing_days = get_option(‘byconsolewooodt_allow_orders_on_closing_days’);

$national_holidays_array=explode(« , »,$get_all_national_holidays_dates);

// chaking if it is national holiday

if(in_array($todaydate_dm , $national_holidays_array))

{

$isholiday = ‘YES’;

}

if($isholiday === ‘NO’ || $byconsolewooodt_allow_orders_on_closing_days === ‘YES’)

{

$get_option_byconsolewooodt_chekout_page_section_heading=get_option(‘byconsolewooodt_chekout_page_section_heading’);

if(!empty($get_option_byconsolewooodt_chekout_page_section_heading))

{

$byconsolewooodt_chekout_page_section_heading = get_option(‘byconsolewooodt_chekout_page_section_heading’);

}

else

{

$byconsolewooodt_chekout_page_section_heading = ‘Select your date time and location’;

}

echo ‘

‘. $byconsolewooodt_chekout_page_section_heading . ‘

‘;

$byconsolewooodt_checkout_page_loading_image_manage = get_option(‘byconsolewooodt_checkout_page_loading_image_manage’);

if($byconsolewooodt_checkout_page_loading_image_manage == ‘yes’)

{

echo’

‘;

}

// show order type as per settings page

//if both

if(get_option(‘byconsolewooodt_order_type’)==’both’){

$get_option_byconsolewooodt_chekout_page_order_type_lebel = get_option(‘byconsolewooodt_chekout_page_order_type_lebel’);

if(!empty($get_option_byconsolewooodt_chekout_page_order_type_lebel))

{

$byconsolewooodt_chekout_page_order_type_lebel = get_option(‘byconsolewooodt_chekout_page_order_type_lebel’);

}

else

{

$byconsolewooodt_chekout_page_order_type_lebel = ‘Select order type’;

}

$get_option_byconsolewooodt_pickup_lable = get_option(‘byconsolewooodt_pickup_lable’);

if(!empty($get_option_byconsolewooodt_pickup_lable))

{

$byconsolewooodt_pickup_lable = get_option(‘byconsolewooodt_pickup_lable’);

}

else

{

$byconsolewooodt_pickup_lable = ‘Pickup’;

}

$get_option_byconsolewooodt_delivery_lable = get_option(‘byconsolewooodt_delivery_lable’);

if(!empty($get_option_byconsolewooodt_delivery_lable))

{

$byconsolewooodt_delivery_lable = get_option(‘byconsolewooodt_delivery_lable’);

}

else

{

$byconsolewooodt_delivery_lable = ‘Delivery’;

}

$byconsolewooodt_order_type_checkout_array=array(

‘type’ => ‘radio’,

‘class’ => array(‘byconsolewooodt_delivery_type’),

‘label’ => $byconsolewooodt_chekout_page_order_type_lebel,

‘label_class’ => ‘byconsolewooodt_ordertype_label’,

‘placeholder’ => __(‘Select delivery type’,’ByConsoleWooODTExtended’),

‘default’ => $byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’],

‘checked’ => ‘checked’,

‘required’ => true,

‘options’ => array(

‘take_away’ => $byconsolewooodt_pickup_lable,

‘levering’ => $byconsolewooodt_delivery_lable,

),

);

}

//if only pickup

if(get_option(‘byconsolewooodt_order_type’)==’take_away’){

$get_option_byconsolewooodt_chekout_page_order_type_lebel = get_option(‘byconsolewooodt_chekout_page_order_type_lebel’);

if(!empty($get_option_byconsolewooodt_chekout_page_order_type_lebel))

{

$byconsolewooodt_chekout_page_order_type_lebel = get_option(‘byconsolewooodt_chekout_page_order_type_lebel’);

}

else

{

$byconsolewooodt_chekout_page_order_type_lebel = ‘Select order type’;

}

$get_option_byconsolewooodt_pickup_lable = get_option(‘byconsolewooodt_pickup_lable’);

if(!empty($get_option_byconsolewooodt_pickup_lable))

{

$byconsolewooodt_pickup_lable = get_option(‘byconsolewooodt_pickup_lable’);

}

else

{

$byconsolewooodt_pickup_lable = ‘Pickup’;

}

$byconsolewooodt_order_type_checkout_array=array(

‘type’ => ‘radio’,

‘class’ => array(‘byconsolewooodt_delivery_type’),

‘label’ => $byconsolewooodt_chekout_page_order_type_lebel,

‘label_class’ => ‘byconsolewooodt_ordertype_label’,

‘placeholder’ => __(‘Select delivery type’,’ByConsoleWooODTExtended’),

‘default’ => ‘take_away’,

‘checked’ => ‘checked’,

‘required’ => true,

‘options’ => array(

‘take_away’ => $byconsolewooodt_pickup_lable,

),

);

}

//if only delivery

if(get_option(‘byconsolewooodt_order_type’)==’levering’){

$get_option_byconsolewooodt_chekout_page_order_type_lebel = get_option(‘byconsolewooodt_chekout_page_order_type_lebel’);

if(!empty($get_option_byconsolewooodt_chekout_page_order_type_lebel))

{

$byconsolewooodt_chekout_page_order_type_lebel = get_option(‘byconsolewooodt_chekout_page_order_type_lebel’);

}

else

{

$byconsolewooodt_chekout_page_order_type_lebel = ‘Select order type’;

}

$get_option_byconsolewooodt_delivery_lable = get_option(‘byconsolewooodt_delivery_lable’);

if(!empty($get_option_byconsolewooodt_delivery_lable))

{

$byconsolewooodt_delivery_lable = get_option(‘byconsolewooodt_delivery_lable’);

}

else

{

$byconsolewooodt_delivery_lable = ‘Delivery’;

}

$byconsolewooodt_order_type_checkout_array=array(

‘type’ => ‘radio’,

‘class’ => array(‘byconsolewooodt_delivery_type’),

‘label’ => $byconsolewooodt_chekout_page_order_type_lebel,

‘label_class’ => ‘byconsolewooodt_ordertype_label’,

‘placeholder’ => __(‘Select delivery type’,’ByConsoleWooODTExtended’),

‘default’ => ‘levering’,

‘checked’ => ‘checked’,

‘required’ => true,

‘options’ => array(

‘levering’ => $byconsolewooodt_delivery_lable,

),

);

}

woocommerce_form_field( ‘byconsolewooodt_delivery_type’, $byconsolewooodt_order_type_checkout_array);

// populate the pickup location drop-down only if delivery type is take_away and pickup location list is not empty

$byconsolewooodt_multiple_pickup_location=get_option(‘byconsolewooodt_multiple_pickup_location’);

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’take_away’ && !empty($pickup_loactions_array) && $byconsolewooodt_multiple_pickup_location==’YES’){

//create array for our woocommerce select type form field function

//$pickup_loactions_array=get_option(‘byconsolewooodt_pickup_location’);

//lets use value instead of array index in option value

$get_option_byconsolewooodt_pickup_location_lebel = get_option(‘byconsolewooodt_pickup_location_lebel’);

if(!empty($get_option_byconsolewooodt_pickup_location_lebel))

{

$byconsolewooodt_pickup_location_lebel = get_option(‘byconsolewooodt_pickup_location_lebel’);

}

else

{

$byconsolewooodt_pickup_location_lebel = ‘veuillez sélectionner le lieu pour emporter’;

}

//echo ‘

‘.__($byconsolewooodt_pickup_location_lebel,’ByConsoleWooODTExtended’).’

‘;

//echo ‘

‘.__(‘veuillez sélectionner le lieu pour emporter’,’ByConsoleWooODTExtended’).’

‘;

//$TotalCartAmountValue = $woocommerce->cart->get_cart_total(); // This is with currency symbol

$TotalCartAmountValue = $woocommerce->cart->total; // This is without currency symbol

//print_r($pickup_loactions_array);

$pickup_loaction_array_value=array();

//print_r($pickup_loactions_array);

foreach($pickup_loactions_array as $pickup_loaction_key => $pickup_loaction_value)

{

$PickupLocationArray[] = $pickup_loaction_value[‘min_cart_value’] .’/’.$pickup_loaction_key;

if(empty($pickup_loaction_value[‘min_cart_value’]) || $pickup_loaction_value[‘min_cart_value’]== » || $pickup_loaction_value[‘min_cart_value’]==0 ){

$minimum_order_value=__(‘No bar’,’ByConsoleWooODTExtended’);

}else{

$minimum_order_value=get_woocommerce_currency_symbol() .$pickup_loaction_value[‘min_cart_value’];

}

//$pickup_loaction_option_text_value=$pickup_loaction_value[‘location’].’  —   Time  ( ‘. $pickup_loaction_value[‘start_time’] .’-‘.$pickup_loaction_value[‘end_time’].’ )  —    Min. Order: (‘.$minimum_order_value.’)  —   ‘.$pickup_loaction_array_value[« sun »].’|’.$pickup_loaction_array_value[« mon »].’|’.$pickup_loaction_array_value[« tue »].’|’.$pickup_loaction_array_value[« wed »].’|’.$pickup_loaction_array_value[« thu »].’|’.$pickup_loaction_array_value[« fri »].’|’.$pickup_loaction_array_value[« sat »];

$pickup_loaction_option_text_value=$pickup_loaction_value[‘location’].’  —   min. commande: (‘.$minimum_order_value.’)’;

if(array_key_exists(‘location_disable’,$pickup_loaction_value))

{

if($pickup_loaction_value[‘location_disable’]!=’on’)

{

$pickup_loaction_array_value[$pickup_loaction_key] = $pickup_loaction_option_text_value;

}

}

else

{

$pickup_loaction_array_value[$pickup_loaction_key] = $pickup_loaction_option_text_value;

}

}

//$pickup_loaction_combined_array=array_combine($pickup_loactions_array,$pickup_loactions_array);

if(!empty(get_option(‘byconsolewooodt_chekout_page_pickup_location_lebel’)))

{

$choose_pickup_location = get_option(‘byconsolewooodt_chekout_page_pickup_location_lebel’);

}

else

{

$choose_pickup_location = __(‘Veuillez sélectionner le lieu pour emporter’,’ByConsoleWooODTExtended’);

}

woocommerce_form_field( ‘byconsolewooodt_pickup_location’, array(

‘type’ => ‘select’,

‘class’ => array(‘byconsolewooodt_pickup_location’),

‘label’ => $choose_pickup_location,

‘placeholder’ => __(‘Choose pickup location’,’ByConsoleWooODTExtended’),

‘default’ => $byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_pickup_location’],

‘options’ => $pickup_loaction_array_value,

‘required’ => true,

));

}// end of if take_away

// populate the delivery location drop-down only if delivery type is levering and delivery location list is not empty

$byconsolewooodt_multiple_delivery_location=get_option(‘byconsolewooodt_multiple_delivery_location’);

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’levering’ && !empty($delivery_loactions_array) && $byconsolewooodt_multiple_delivery_location==’YES’){

//create array for our woocommerce select type form field function

//$pickup_loactions_array=get_option(‘byconsolewooodt_pickup_location’);

//lets use value onstead od array index in option value

$get_option_byconsolewooodt_delivery_location_lebel = get_option(‘byconsolewooodt_delivery_location_lebel’);

if(!empty($get_option_byconsolewooodt_delivery_location_lebel))

{

$byconsolewooodt_delivery_location_lebel = get_option(‘byconsolewooodt_delivery_location_lebel’);

}

else

{

$byconsolewooodt_delivery_location_lebel = __(‘Veuillez sélectionner le lieu pour livraison’,’ByConsoleWooODTExtended’);

}

//echo ‘

‘.$byconsolewooodt_delivery_location_lebel.’

‘;

$TotalCartAmountValue = $woocommerce->cart->total; // This is without currency symbol

$delivery_loaction_array_value=array();

foreach($delivery_loactions_array as $delivery_loaction_key => $delivery_loaction_value)

{

$DeliveryLocationArray[] = $delivery_loaction_value[‘min_cart_value’] .’/’.$delivery_loaction_key;

if(empty($delivery_loaction_value[‘min_cart_value’])|| $delivery_loaction_value[‘min_cart_value’]== » || $delivery_loaction_value[‘min_cart_value’]==0){

$minimum_order_value=__(‘No bar’, ‘ByConsoleWooODTExtended’);

}else{

$minimum_order_value=get_woocommerce_currency_symbol() .$delivery_loaction_value[‘min_cart_value’];

}

$Delivery_Location_With_Mincartvalue_Location_key_Start_time_End_time_Array[] = $delivery_loaction_value[‘min_cart_value’] .'<@@>’.$delivery_loaction_key .'<@@>’. $delivery_loaction_value[‘start_time’].'<@@>’. $delivery_loaction_value[‘end_time’];

//$delivery_loaction_option_text_value=$delivery_loaction_value[‘location’].’  —   Time  ( ‘. $delivery_loaction_value[‘start_time’] .’-‘.$delivery_loaction_value[‘end_time’].’ )  —    Min. Order: (‘.$minimum_order_value.’)’;

$delivery_loaction_option_text_value=$delivery_loaction_value[‘location’].’  —   ‘.’min. commande: (‘.$minimum_order_value.’)’;

if(array_key_exists(‘location_disable’,$delivery_loaction_value))

{

if($delivery_loaction_value[‘location_disable’]!=’on’)

{

$delivery_loaction_array_value[$delivery_loaction_key] = $delivery_loaction_option_text_value;

}

}else{

$delivery_loaction_array_value[$delivery_loaction_key] = $delivery_loaction_option_text_value;

}

}

//$delivery_loaction_combined_array=array_combine($delivery_loactions_array,$delivery_loactions_array);

if(!empty(get_option(‘byconsolewooodt_chekout_page_delivery_location_lebel’)))

{

$choose_delivery_location = get_option(‘byconsolewooodt_chekout_page_delivery_location_lebel’);

}

else

{

$choose_delivery_location = __(‘Veuillez sélectionner le lieu pour livraison’,’ByConsoleWooODTExtended’);

}

woocommerce_form_field( ‘byconsolewooodt_delivery_location’, array(

‘type’ => ‘select’,

‘class’ => array(‘byconsolewooodt_delivery_location’),

‘label’ => $choose_delivery_location,

‘placeholder’ => __(‘Choose delivery location’,’ByConsoleWooODTExtended’),

‘default’ => $byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_delivery_location’],

‘options’ => $delivery_loaction_array_value,

‘required’ => true,

));

}// end of if delivery

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’levering’)

{

$byconsolewooodt_location_date_placeholder=get_option(‘byconsolewooodt_chekout_page_delivery_date_placeholder’);

$byconsolewooodt_location_time_placeholder=get_option(‘byconsolewooodt_chekout_page_delivery_time_placeholder’);

if(!empty(get_option(‘byconsolewooodt_order_page_delivery_time_lable’)))

{

$byconsolewooodt_pickup_or_delivery_time = get_option(‘byconsolewooodt_order_page_delivery_time_lable’);

}

else

{

$byconsolewooodt_pickup_or_delivery_time = __(‘Select Time’,’ByConsoleWooODTExtended’);

}

}

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’take_away’)

{

if(!empty(get_option(‘byconsolewooodt_order_page_pickup_time_lable’)))

{

$byconsolewooodt_pickup_or_delivery_time = get_option(‘byconsolewooodt_order_page_pickup_time_lable’);

}

else

{

$byconsolewooodt_pickup_or_delivery_time = __(‘Select Time’,’ByConsoleWooODTExtended’);

}

$get_option_byconsolewooodt_chekout_page_date_placeholder = get_option(‘byconsolewooodt_chekout_page_date_placeholder’);

if(!empty($get_option_byconsolewooodt_chekout_page_date_placeholder))

{

$byconsolewooodt_chekout_page_date_placeholder = get_option(‘byconsolewooodt_chekout_page_date_placeholder’);

}

else

{

$byconsolewooodt_chekout_page_date_placeholder = ‘Select your pickup date’;

}

$byconsolewooodt_location_date_placeholder=$byconsolewooodt_chekout_page_date_placeholder;

$byconsolewooodt_location_time_placeholder=get_option(‘byconsolewooodt_chekout_page_time_placeholder’);

}

$get_option_byconsolewooodt_chekout_page_date_lebel = get_option(‘byconsolewooodt_chekout_page_date_lebel’);

if(!empty($get_option_byconsolewooodt_chekout_page_date_lebel))

{

$byconsolewooodt_chekout_page_date_lebel = get_option(‘byconsolewooodt_chekout_page_date_lebel’);

}

else

{

$byconsolewooodt_chekout_page_date_lebel = ‘Select date’;

}

woocommerce_form_field( ‘byconsolewooodt_delivery_date’, array(

‘type’ => ‘text’,

‘class’ => array(‘byconsolewooodt_delivery_date’),

‘label’ => $byconsolewooodt_chekout_page_date_lebel,

‘placeholder’ => __($byconsolewooodt_location_date_placeholder,’ByConsoleWooODTExtended’),

‘default’ => $byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_date_field’],

‘required’ => true,

));

$start_time=get_option(‘byconsolewooodt_opening_hours_from’);

$closing_time=get_option(‘byconsolewooodt_opening_hours_to’);

//$current_time=date(‘H:i’, time());

woocommerce_form_field( ‘byconsolewooodt_delivery_date_alternate’, array(

‘type’ => ‘text’,

‘class’ => array(‘byconsolewooodt_delivery_date_alternate’),

‘label’ =>  »,

‘placeholder’ =>  »,

‘default’ =>  »,

));

if(get_option(‘byconsolewooodt_as_early_as_possible_and_exact_time_text_lable_enable_mode’) == ‘yes’) {

woocommerce_form_field(« byconsolewooodt_delivery_type_of_delivery_time », array(

‘type’ => ‘radio’,

‘class’ => array(‘byconsolewooodt_delivery_type_of_delivery_time’),

‘label’ =>  »,

‘label_class’ => ‘byconsolewooodt_delivery_type_of_delivery_time_radio_box’,

‘options’ => array( ‘exact_time’ => get_option(‘byconsolewooodt_exact_time_lable_text’) , ‘as_early_as_possible’ => get_option(« byconsolewooodt_as_early_as_possible_lable_text »)),

));

}

if(get_option(‘byconsolewooodt_as_early_as_possible_and_exact_time_text_lable_enable_mode’) ==  ») {

woocommerce_form_field(« byconsolewooodt_delivery_type_of_delivery_time_hidden », array(

‘type’ => ‘radio’,

‘class’ => array(‘byconsolewooodt_delivery_type_of_delivery_time_hidden’),

‘label’ =>  »,

‘label_class’ => ‘byconsolewooodt_delivery_type_of_delivery_time_radio_box_hidden’,

‘options’ => array( ‘exact_time’ => get_option(‘byconsolewooodt_exact_time_lable_text’)),

));

}

$current_time=current_time( ‘H:m’ );

//if($current_time<$closing_time && $current_time>$start_time){

$get_option_byconsolewooodt_chekout_page_time_lebel = get_option(‘byconsolewooodt_chekout_page_time_lebel’);

if(!empty($get_option_byconsolewooodt_chekout_page_time_lebel))

{

$byconsolewooodt_chekout_page_time_lebel = get_option(‘byconsolewooodt_chekout_page_time_lebel’);

}

else

{

$byconsolewooodt_chekout_page_time_lebel = ‘Preferred time’;

}

if(get_option(‘byconsolewooodt_delivery_per_custom_slot_confirm_box’) == ‘yes’)

{

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’levering’)

{

$delivery_per_custom_slot_array = get_option(‘delivery_per_custom_slot’);

}

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’take_away’)

{

$delivery_per_custom_slot_array = get_option(‘pickup_per_custom_slot’);

}

foreach($delivery_per_custom_slot_array as $delivery_per_custom_slot_key => $delivery_per_custom_slot_val)

{

foreach($delivery_per_custom_slot_val as $delivery_per_custom_slot_val_single_key => $delivery_per_custom_slot_val_single_value)

{

$delivery_time_array_value[] = $delivery_per_custom_slot_val_single_value[« start_time_slot »] . ‘ – ‘ . $delivery_per_custom_slot_val_single_value[« end_time_slot »] ;

}

}

woocommerce_form_field( ‘byconsolewooodt_delivery_time’, array(

‘type’ => ‘select’,

‘class’ => array(‘byconsolewooodt_delivery_time’),

‘label’ => $byconsolewooodt_pickup_or_delivery_time,

‘placeholder’ => __(‘Choose delivery location’,’ByConsoleWooODTExtended’),

‘default’ => $byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_time_field’],

‘options’ => array($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_time_field’] => __($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_time_field’])),

‘required’ => true,

));

}

else

{

woocommerce_form_field( ‘byconsolewooodt_delivery_time’, array(

‘type’ => ‘text’,

‘class’ => array(‘byconsolewooodt_delivery_time’),

‘label’ => $byconsolewooodt_pickup_or_delivery_time,

‘placeholder’ => $byconsolewooodt_location_time_placeholder,

‘default’ => $byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_time_field’],

‘required’ => true,

));

}

echo ‘

‘;

/*}else{

echo ‘‘;

printf( __(‘We are closed now (%s), openning at %s’,’ByConsoleWooODTExtended’),$current_time,$start_time);

echo  »;

}

*/

/*echo ‘

‘;*/

echo ‘

‘;

}

$byconsolewooodt_allow_orders_on_closing_days = get_option(‘byconsolewooodt_allow_orders_on_closing_days’);

if($isholiday === ‘YES’)

{

if($byconsolewooodt_allow_orders_on_closing_days ===  »)

{

echo ‘

‘.get_option(‘byconsolewooodt_store_close_notice’).’

‘;

}

else

{

}

}

if($isholiday != ‘YES’ && $isholiday != ‘NO’)

{

echo ‘

‘._e(‘ERROR : Please contact Vendor’).’

‘;

}

/**** FOR DISABLED OPTION SCRIPT****/

if(!empty($PickupLocationArray)){

foreach($PickupLocationArray as $PickupLocationSingleArrayVal)

{

$ExplodePickupLocationAndKeyValue=explode(« / » ,$PickupLocationSingleArrayVal);

// || $ExplodePickupLocationAndKeyValue[0]== » || $ExplodePickupLocationAndKeyValue[0]==’0’

if($TotalCartAmountValue < $ExplodePickupLocationAndKeyValue[0] && ($ExplodePickupLocationAndKeyValue[0]!=0 || !empty($ExplodePickupLocationAndKeyValue[0])) ) { //echo $xyz[1]; //disable selection of below min. order options ?>

 

 

 

//print_r($byconsolewooodt_delivery_widget_cookie_array);

if ( is_plugin_active( ‘ByConsoleDynamicShippingCharge/ByConsoleDynamicShippingCharge.php’ ) )

{

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’take_away’)

{

$selected_zones_names = get_option(‘byconsolewooodt_pickup_disable_date_and_time_by_available_zones_locations’);

//print_r($selected_zones_names);

if(!empty($selected_zones_names))

{

$do_shipping_methods_manipulation = ‘NO’;

}

else

{

$do_shipping_methods_manipulation = ‘YES’;

}

}

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’levering’)

{

$selected_zones_names = get_option(‘byconsolewooodt_delivery_disable_date_and_time_by_available_zones_locations’);

if(!empty($selected_zones_names))

{

$do_shipping_methods_manipulation = ‘NO’;

}

else

{

$do_shipping_methods_manipulation = ‘YES’;

}

}

}

//echo $do_shipping_methods_manipulation;

global $woocommerce;

$version = « 2.6 »;

if (version_compare($woocommerce->version, $version, « >= »)) {

$new_rates = array();

/*echo ‘


‘;

print_r($rates);*/

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’take_away’){

foreach($rates as $key => $rate) {

if (‘local_pickup’ === $rate->method_id || ‘legacy_local_pickup’ === $rate->method_id) {

$new_rates[$key] = $rates[$key];

}

}

/*print_r($new_rates);

print_r($rates);*/

}

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’levering’){

foreach($rates as $key => $rate)

{

$shipping_methods = $rate->method_id;

if (‘local_pickup’ != $shipping_methods)

{

$new_rates[$key] = $rates[$key];

//unset($rates[‘local_pickup’]);

}

}

}

//return empty($new_rates) ? $rates : $new_rates;

$site_full_url = $_SERVER[‘SERVER_NAME’];

//echo $do_shipping_methods_manipulation;

//print_r($rates);

//echo ‘


‘;

//print_r($new_rates);

if($do_shipping_methods_manipulation == ‘YES’)

{

return $new_rates;

}

else

{

//return empty($new_rates) ? $rates : $new_rates;

return $rates;

}

}

else {

if ($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’take_away’) {

$predefined_shipping = $rates[‘local_pickup’];

$rates = array();

$rates[‘local_pickup’] = $predefined_shipping;

}

if ($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’levering’) {

$predefined_shipping = $rates[‘flat_rate’];

$rates = array();

$rates[‘flat_rate’] = $predefined_shipping;

}

}

return $rates;

}

add_action(‘woocommerce_before_checkout_form’, ‘byconsolewoodt_order_not_possible’);

function byconsolewoodt_order_not_possible()

{

echo ‘

‘;

}

/*

add_action( ‘wp_ajax_get_delivery_limit_by_selected_date’, ‘get_delivery_limit_by_selected_date’ );

add_action( ‘wp_ajax_nopriv_get_delivery_limit_by_selected_date’, ‘get_delivery_limit_by_selected_date’ );

function get_delivery_limit_by_selected_date()

{

global $wpdb;

//echo ‘aaaaaaaaaaaaaaaaaaaaaaaaaaa’;

$selected_date_explode_val = explode(« / », $_POST[‘selected_date’]);

$selected_date_string = $selected_date_explode_val[2].’-‘.$selected_date_explode_val[0].’-‘.$selected_date_explode_val[1];

$byconsolewooodt_order_per_day_name = get_option(‘byconsolewooodt_order_per_day_name’);

$allowed_order_no = $byconsolewooodt_order_per_day_name[$_POST[‘selected_date_dayName_value’]];

$filters = array(

‘post_status’ =>array(‘wc-completed’, ‘wc-pending’, ‘wc-processing’, ‘wc-on-hold’),

‘post_type’ => ‘shop_order’,

‘posts_per_page’ => -1,

‘paged’ => 1,

‘meta_key’ => ‘_customer_user’,

‘order’ => ‘DESC’,

‘meta_query’ => array(

array(

‘key’ => ‘byconsolewooodt_delivery_date’,

‘value’ => date(‘m/d/Y’, strtotime($selected_date_string)),

‘compare’ => ‘>=’

),

array(

‘key’ => ‘byconsolewooodt_delivery_date’,

‘value’ => date(‘m/d/Y’, strtotime($selected_date_string)),

‘compare’ => ‘<=’ ) ) ); $ordered_product_id_array= array(); $loop = new WP_Query( $filters ); while ( $loop->have_posts() ) {

$loop->the_post();

$order = new WC_Order($loop->post->ID);

$product_id_count=1;

foreach ($order->get_items() as $key => $lineItem)

{

array_push($ordered_product_id_array,$lineItem->get_product_id());

}

}

$ordered_product_id_val = count($ordered_product_id_array);

//echo $ordered_product_id_val . ‘<‘ . $allowed_order_no;

if($ordered_product_id_val < $allowed_order_no) { $cart_added_product_id_array = array(); if ( sizeof( WC()->cart->get_cart() ) > 0 )

{

foreach(WC()->cart->get_cart() as $cart_item_key => $values )

{

$_product = $values[‘data’];

$productid = version_compare( WC_VERSION, ‘3.0.0’, ‘<‘ ) ? $_product->id : $_product->get_id();

if(!empty($productid))

{

array_push($cart_added_product_id_array,$productid);

}

else

{

$cart_added_product_id_array = 0;

}

$cart_added_product_id_count = count($cart_added_product_id_array);

}

$total_order = $ordered_product_id_val+$cart_added_product_id_count;

// echo ‘$total_order > ‘.$total_order .’>’. ‘$allowed_order_no > ‘.$allowed_order_no;

if($total_order > $allowed_order_no)

{

echo $reduct_product = $total_order-$allowed_order_no;

//echo $total_order.'<@_|_@>’.$reduct_product.'<@_|_@>’.$_POST[‘selected_date_dayName_value’];

}

else

{

// echo ‘Order possible’;

}

}

}

else

{

echo $reduct_product = ‘0’;

}

wp_die(); // this is required to terminate immediately and return a proper response

}*/

add_action( ‘wp_ajax_get_delivery_time_by_selected_date’, ‘get_delivery_time_by_selected_date’ );

add_action( ‘wp_ajax_nopriv_get_delivery_time_by_selected_date’, ‘get_delivery_time_by_selected_date’ );

function get_delivery_time_by_selected_date() {

global $wpdb; // this is how you get access to the database

$byconsolewooodt_hours_format = get_option(‘byconsolewooodt_hours_format’);

$stripped_out_byconsolewooodt_delivery_widget_cookie=stripslashes($_COOKIE[‘byconsolewooodt_delivery_widget_cookie’]);

$byconsolewooodt_delivery_widget_cookie_array=json_decode($stripped_out_byconsolewooodt_delivery_widget_cookie,true);

$location_time_disable_by_date_array = array();

$selected_location_value = $_POST[‘selected_location_value’];

//$selected_data_val = $_POST[‘selected_date_value’];
$selected_data_val = $_POST[‘selected_alternate_pickdate_value’];

//echo $_POST[‘selected_alternate_pickdate_value’];

//echo ‘—–‘;

$selected_date_day_name=strtolower(date(‘D’, strtotime($_POST[‘selected_alternate_pickdate_value’])));

$date_from = date(‘m/d/Y’, strtotime($selected_data_val . ‘ -4 day’));

$date_to = $selected_data_val;

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’take_away’)

{

$byconsolewooodt_pickup_or_delivery_time = get_option(‘byconsolewooodt_chekout_page_time_placeholder’);

$filters = array(

/*’post_status’ => ‘any’,*/

‘post_status’ =>array(‘wc-pending’, ‘wc-processing’, ‘wc-on-hold’),

‘post_type’ => ‘shop_order’,

‘posts_per_page’ => 90000,

‘paged’ => -1,

‘meta_key’ => ‘_customer_user’,

‘meta_query’ => array(

array(

‘key’ => ‘byconsolewooodt_delivery_date’,

‘value’ => $date_to,

‘compare’ => ‘=’

),

array(

‘key’ => ‘byconsolewooodt_pickup_location’,

‘value’ => $selected_location_value,

‘compare’ => ‘=’

)

));

}

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’levering’)

{

$byconsolewooodt_pickup_or_delivery_time = get_option(‘byconsolewooodt_chekout_page_delivery_time_placeholder’);

$filters = array(

/*’post_status’ => ‘any’,*/

‘post_status’ =>array(‘wc-pending’, ‘wc-processing’, ‘wc-on-hold’),

‘post_type’ => ‘shop_order’,

‘posts_per_page’ => 90000,

‘paged’ => -1,

‘meta_key’ => ‘_customer_user’,

‘meta_query’ => array(

array(

‘key’ => ‘byconsolewooodt_delivery_date’,

‘value’ => $date_to,

‘compare’ => ‘=’

),

array(

‘key’ => ‘byconsolewooodt_delivery_location’,

‘value’ => $selected_location_value,

‘compare’ => ‘=’

)

));

}

// The Query

$the_query = new WP_Query( $filters );

//echo ‘

';


//var_dump($the_query);


//echo '

‘;

// The Loop

$sorted_orders=$the_query->posts;

/*echo ‘AYAN.’;
print_r($sorted_orders);
echo ‘PAUL.’;*/

$delivery_on_selected_time_array=array();

if(!empty($sorted_orders)){

array_push($selected_loaction_maxmimum_delivery_array,get_post_meta( $selected_location_value, ‘delivery_per_custom_slot[number_of_delivery]’, true ));

foreach($sorted_orders as $single_order){

//echo $single_order_id=$single_order->ID;

array_push($delivery_on_selected_time_array,get_post_meta( $single_order->ID, ‘byconsolewooodt_delivery_time’, true ));

}

// get max order limit and custom slot from option table

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’take_away’)

{

$location_max_order_array=get_option(‘pickup_per_custom_slot’);

}

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’levering’)

{

$location_max_order_array=get_option(‘delivery_per_custom_slot’);

}

$selected_location_max_order_array=$location_max_order_array[$selected_location_value];

//print_r($selected_location_max_order_array);

$count=count($delivery_on_selected_time_array);

foreach($selected_location_max_order_array as $key=>$max_order_per_custom_slot){

$order_booked_count=0;

$delivery_on_selected_time_array_temp=$delivery_on_selected_time_array;

//echo ‘—————————-‘;

//print_r($delivery_on_selected_time_array_temp);

$i=1;

while($i<= $count){

$admin_time_slot = date($byconsolewooodt_hours_format, strtotime($max_order_per_custom_slot[« start_time_slot »])).’ – ‘.date($byconsolewooodt_hours_format, strtotime($max_order_per_custom_slot[« end_time_slot »]));

//echo ‘
‘;

if(in_array($admin_time_slot,$delivery_on_selected_time_array_temp))

{

$key_to_remove=array_search($admin_time_slot,$delivery_on_selected_time_array_temp);

//echo ‘$key_to_remove – ‘.$key_to_remove;

unset($delivery_on_selected_time_array_temp[$key_to_remove]);

//echo ‘printing $delivery_on_selected_time_array_temp’;

//print_r($delivery_on_selected_time_array_temp);

//echo ‘—————————–‘;

$order_booked_count++;

$location_order_status[$selected_location_value][$key][« max_allowed »]=$max_order_per_custom_slot[« number_of_delivery »];

$location_order_status[$selected_location_value][$key][« posted_order »]=$order_booked_count;

$location_order_status[$selected_location_value][$key][« used_time_slot »]=$max_order_per_custom_slot[« start_time_slot »].’ – ‘.$max_order_per_custom_slot[« end_time_slot »];

}

$i++;

}

//array_push($location_time_disable_by_date_array,$max_order_per_custom_slot[« time_slot »]);

}

} // not empty

foreach($location_order_status as $location_order_status_values)

{

foreach($location_order_status_values as $single_key => $single_value)

{

//echo ‘$single_value[max_allowed] — ‘. $single_value[‘max_allowed’];

//echo ‘
‘;

//echo ‘$single_value[posted_order] — ‘. $single_value[‘posted_order’];

if($single_value[‘max_allowed’] == $single_value[‘posted_order’])

{

array_push($location_time_disable_by_date_array,$single_value[‘used_time_slot’]);

}

}

}

//echo ‘——————-‘;

//print_r($location_order_status);

//echo ‘——————-‘;

//var_dump($sorted_orders);

//print_r($delivery_on_selected_time_array);

//print_r($selected_loaction_maxmimum_delivery_array);

//echo ‘—————————‘;

//print_r($location_time_disable_by_date_array);

//echo ‘—————————‘;

$delivery_location_id = $_POST[‘selected_location_value’];

/*if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’take_away’){
$delivery_per_custom_slot_array = get_option(‘pickup_per_custom_slot’);
}

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’levering’){
$delivery_per_custom_slot_array = get_option(‘delivery_per_custom_slot’);
}*/

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’take_away’){
$delivery_per_custom_slot_array = get_option(‘pickup_per_custom_slot’);
if(get_option(‘byconsolewooodt_multiple_pickup_location’)==’YES’){
$delivery_location_id = $_POST[‘selected_location_value’];
}else{
$delivery_location_id = 1;
}
}

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’levering’){
$delivery_per_custom_slot_array = get_option(‘delivery_per_custom_slot’);
if(get_option(‘byconsolewooodt_multiple_delivery_location’)==’YES’){
$delivery_location_id = $_POST[‘selected_location_value’];
}else{
$delivery_location_id = 1;
}
}

$delivery_per_custom_slot_array_by_location_id = $delivery_per_custom_slot_array[$delivery_location_id];

//print_r($delivery_per_custom_slot_array_by_location_id);

$byconsolewooodt_hours_format = get_option(‘byconsolewooodt_hours_format’);

echo  ».$byconsolewooodt_pickup_or_delivery_time. »;

foreach($delivery_per_custom_slot_array_by_location_id as $delivery_per_custom_slot_val_single_key => $delivery_per_custom_slot_val_single_value)

{

//echo ‘********************************************’;

//$selected_date_day_name

if(array_key_exists($selected_date_day_name,$delivery_per_custom_slot_val_single_value)){

//echo ‘yes exist’;

$total_time_value = $delivery_per_custom_slot_val_single_value[« start_time_slot »].’ – ‘.$delivery_per_custom_slot_val_single_value[« end_time_slot »];

//echo ‘—-‘;

//echo $total_time_value;

//echo ‘—-‘;

//echo ‘********************************************’;

//echo ‘AYAN PAUL…’;
/*$current_system_time = $_POST[‘current_system_time’];

$start_time_slot = $delivery_per_custom_slot_val_single_value[« start_time_slot »];

$end_time_slot = $delivery_per_custom_slot_val_single_value[« end_time_slot »];*/

$current_system_time = $_POST[‘current_system_time’];

if(!empty(get_option(‘byconsolewooodt_delivery_times’))){
echo $byconsolewooodt_delivery_times = get_option(‘byconsolewooodt_delivery_times’);
$current_system_time = strtotime(« + ».$byconsolewooodt_delivery_times. » minutes », strtotime($current_system_time));
}else{
$current_system_time = $current_system_time;
}

$start_time_slot = $delivery_per_custom_slot_val_single_value[« start_time_slot »];
$end_time_slot = $delivery_per_custom_slot_val_single_value[« end_time_slot »];

$start_time_slot_with_str = strtotime($start_time_slot);

//check maximum allowed order

/*if(in_array($total_time_value,$location_time_disable_by_date_array))
{
echo  ».date($byconsolewooodt_hours_format, strtotime($start_time_slot)).’ – ‘.date($byconsolewooodt_hours_format, strtotime($end_time_slot)). »;
}
else
{
echo  ».date($byconsolewooodt_hours_format, strtotime($start_time_slot)).’ – ‘.date($byconsolewooodt_hours_format, strtotime($end_time_slot)). »;
}*/

//echo $_POST[‘selected_alternate_pickdate_value’] .’==’. current_time(‘m-d-Y’);
if($_POST[‘selected_alternate_pickdate_value’] == current_time(‘m/d/Y’))
{
//if(strtotime($current_system_time) <= strtotime($start_time_slot))
if($current_system_time <= $start_time_slot_with_str)
{
if(in_array($total_time_value,$location_time_disable_by_date_array))
{

echo  ».date($byconsolewooodt_hours_format, strtotime($start_time_slot)).’ – ‘.date($byconsolewooodt_hours_format, strtotime($end_time_slot)).’ Order limit is over’;

}
else
{
echo  ».date($byconsolewooodt_hours_format, strtotime($start_time_slot)).’ – ‘.date($byconsolewooodt_hours_format, strtotime($end_time_slot)). »;

}
}
else
{
//echo ‘This time is not avalible for today’;
}
}
else
{
if(in_array($total_time_value,$location_time_disable_by_date_array))
{

echo  ».date($byconsolewooodt_hours_format, strtotime($start_time_slot)).’ – ‘.date($byconsolewooodt_hours_format, strtotime($end_time_slot)).’ Order limit is over’;

}
else
{
echo  ».date($byconsolewooodt_hours_format, strtotime($start_time_slot)).’ – ‘.date($byconsolewooodt_hours_format, strtotime($end_time_slot)). »;

}
}

}

else

{

//echo ‘does not exist’;

}

}

wp_die(); // this is required to terminate immediately and return a proper response

}

add_action( ‘wp_ajax_delivery_location_id_action’, ‘delivery_location_id_action’ );

add_action( ‘wp_ajax_nopriv_delivery_location_id_action’, ‘delivery_location_id_action’ );

function delivery_location_id_action() {

global $wpdb; // this is how you get access to the database

$stripped_out_byconsolewooodt_delivery_widget_cookie=stripslashes($_COOKIE[‘byconsolewooodt_delivery_widget_cookie’]);

$byconsolewooodt_delivery_widget_cookie_array=json_decode($stripped_out_byconsolewooodt_delivery_widget_cookie,true);

$delivery_location_id = $_POST[‘delivery_location_id_val’];

//$whatever += 10;

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’take_away’)

{

$delivery_per_custom_slot_array = get_option(‘pickup_per_custom_slot’);

}

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’]==’levering’)

{

$delivery_per_custom_slot_array = get_option(‘delivery_per_custom_slot’);

}

$delivery_per_custom_slot_array_by_location_id = $delivery_per_custom_slot_array[$delivery_location_id];

print_r($delivery_per_custom_slot_array_by_location_id);

echo  ».__(‘Select delivery time’,’ByConsoleWooODTExtended’). »;

foreach($delivery_per_custom_slot_array_by_location_id as $delivery_per_custom_slot_val_single_key => $delivery_per_custom_slot_val_single_value)

{

echo  ».$delivery_per_custom_slot_val_single_value[« time_slot »]. »;

}

//echo $delivery_location_id;

wp_die(); // this is required to terminate immediately and return a proper response

}

function byconsolewooodt_header_script()

{

$byconsolewooodt_plugin_url = plugins_url();

$byconsolewooodt_checkout_page_loading_image_manage = get_option(‘byconsolewooodt_checkout_page_loading_image_manage’);

if($byconsolewooodt_checkout_page_loading_image_manage == ‘yes’)
{
?>

 

 

 

 

 

 

 

 

‘;

echo ‘‘;

echo ‘‘;

echo ‘

‘;

}

}

}

function byconsolewoodt_cart_total_action() { // Widget section location disable as per price.

$stripped_out_byconsolewooodt_delivery_widget_cookie=stripslashes($_COOKIE[‘byconsolewooodt_delivery_widget_cookie’]);

$byconsolewooodt_delivery_widget_cookie_array=json_decode($stripped_out_byconsolewooodt_delivery_widget_cookie,true);

global $woocommerce;

$byc_cart_total_price_substr_val = substr($_POST[‘byc_cart_total_price_val’],0,-1);

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’] = ‘take_away’)

{

$byconsolewooodt_all_added_location_by_ajax = get_option(‘byconsolewooodt_pickup_location’);

echo ‘Veuillez sélectionner le lieu pour emporter1’;

foreach($byconsolewooodt_all_added_location_by_ajax as $byconsolewooodt_all_added_location_key => $byconsolewooodt_all_added_location_val)

{

if($byc_cart_total_price_substr_val >= $byconsolewooodt_all_added_location_val[‘min_cart_value’])

{

echo «  ».$byconsolewooodt_all_added_location_val[‘location’]. »   —    min. commande: (« .get_woocommerce_currency_symbol().$byconsolewooodt_all_added_location_val[‘min_cart_value’]. ») »;

}

else

{

echo «  ».$byconsolewooodt_all_added_location_val[‘location’]. »   —    min. commande: (« .get_woocommerce_currency_symbol().$byconsolewooodt_all_added_location_val[‘min_cart_value’]. ») »;

}

}

}

if($byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’] = ‘levering’)

{

$byconsolewooodt_all_added_location_by_ajax = get_option(‘byconsolewooodt_delivery_location’);

echo  ».__(‘Veuillez sélectionner le lieu pour livraison’,’ByConsoleWooODTExtended’). »;

foreach($byconsolewooodt_all_added_location_by_ajax as $byconsolewooodt_all_added_location_key => $byconsolewooodt_all_added_location_val)

{

if($byc_cart_total_price_substr_val >= $byconsolewooodt_all_added_location_val[‘min_cart_value’])

{

echo «  ».$byconsolewooodt_all_added_location_val[‘location’]. »   —    min. commande: (« .get_woocommerce_currency_symbol().$byconsolewooodt_all_added_location_val[‘min_cart_value’]. ») »;

}

else

{

echo «  ».$byconsolewooodt_all_added_location_val[‘location’]. »   —    min. commande: (« .get_woocommerce_currency_symbol().$byconsolewooodt_all_added_location_val[‘min_cart_value’]. ») »;

}

}

}

//echo ‘‘.$byconsolewooodt_delivery_widget_cookie_array[‘byconsolewooodt_widget_type_field’].’‘;

//print_r($byconsolewooodt_all_added_location_by_ajax);

}

add_action( ‘wp_ajax_byconsolewoodt_cart_total_action’, ‘byconsolewoodt_cart_total_action’ );

add_action( ‘wp_ajax_nopriv_byconsolewoodt_cart_total_action’, ‘byconsolewoodt_cart_total_action’ );

/****************Calling Store Notice*******************/

/****************************************************************************/

include(‘inc/location_based_shipping_charges.php’);

/*****************************************************************************/

function byconsolewooodt_store_closed_remove_addtocart()

{

//$todaydate = date(« m/d/Y »);

$todaydate=current_time(‘m/d/Y’);

$shownotice=’none’;

$get_all_dates = get_option(‘byconsolewooodt_admin_holiday_date’);

$byconsolewooodt_allow_orders_on_closing_days = get_option(‘byconsolewooodt_allow_orders_on_closing_days’);

$dateexplode=explode(« , »,$get_all_dates);

/*if($current_time<$closing_time && $current_time>$start_time){

$shownotice=’byconsolewooodt_store_holiday’;

}*/

if(!empty($dateexplode))

{

foreach($dateexplode as $get_single_dates)

{

if($get_single_dates==$todaydate)

{

$shownotice = ‘byconsolewooodt_store_holiday’;

}

}

}// !empty

if($shownotice===’byconsolewooodt_store_holiday’)

{

if($byconsolewooodt_allow_orders_on_closing_days ===  »)

{

remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’, 10 );

remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’, 30 );

}

}

else

{

// get todays date

$gattodayname=date(« l »);

$gattodaynumericval=date(« w »);

$sunday = get_option(‘byconsolewooodt_admin_closing_sunday’);

$monday = get_option(‘byconsolewooodt_admin_closing_monday’);

$tuesday = get_option(‘byconsolewooodt_admin_closing_tuesday’);

$wednessday = get_option(‘byconsolewooodt_admin_closing_wednessday’);

$thursday = get_option(‘byconsolewooodt_admin_closing_thursday’);

$friday = get_option(‘byconsolewooodt_admin_closing_friday’);

$saturday = get_option(‘byconsolewooodt_admin_closing_saturday’);

$sunday = ! empty($sunday) ? $sunday : 99;

$monday = ! empty($monday) ? $monday : 99;

$tuesday = ! empty($tuesday) ? $tuesday : 99;

$wednessday = ! empty($wednessday) ? $wednessday : 99;

$thursday = ! empty($thursday) ? $thursday : 99;

$friday = ! empty($friday) ? $friday : 99;

$saturday = ! empty($saturday) ? $saturday : 99;

$byconsolewooodt_allow_orders_on_closing_days = get_option(‘byconsolewooodt_allow_orders_on_closing_days’);

if($sunday==$gattodaynumericval || $monday==$gattodaynumericval || $tuesday==$gattodaynumericval || $wednessday==$gattodaynumericval || $thursday==$gattodaynumericval || $friday==$gattodaynumericval || $saturday==$gattodaynumericval)

{

if($byconsolewooodt_allow_orders_on_closing_days ==  » )

{

remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’, 10 );

remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’, 30 );

}

else

{

}

}

else

{

}

}

}

add_action(‘init’,’byconsolewooodt_store_closed_remove_addtocart’);

// ADDING COLUMN TITLES (Here 1 columns)

add_filter( ‘manage_edit-shop_order_columns’, ‘byconsolewooodt_product_delivery_and_pickup_date_column’);

function byconsolewooodt_product_delivery_and_pickup_date_column($columns)

{

//add columns

$byconsolewooodt_order_list_new_columns = (is_array($columns)) ? $columns : array();

unset( $byconsolewooodt_order_list_new_columns[‘order_actions’] );

$byconsolewooodt_order_list_new_columns[‘byconsolewooodt_product_pickup_or_delivery_date’] = ‘Pickup / Delivery Date’;

$byconsolewooodt_order_list_new_columns[‘order_actions’] = $columns[‘order_actions’];

return $byconsolewooodt_order_list_new_columns;

}

// adding the data for each orders by column

add_action( ‘manage_shop_order_posts_custom_column’ , ‘byconsolewooodt_product_delivery_and_pickup_date_value’,1);

function byconsolewooodt_product_delivery_and_pickup_date_value( $column )

{

global $post, $woocommerce, $the_order;

$order_id = $the_order->id;

if ( $column == ‘byconsolewooodt_product_pickup_or_delivery_date’ )

{

$productdeliverydate=get_post_meta( $order_id, ‘byconsolewooodt_delivery_date’, true );

$formattedproductdeliverydate = get_option(‘byconsolewooodt_wooodt_date_formate_setting’);

$fetch_seleted_date = new DateTime($productdeliverydate);

echo $byconsolewooodtmyVarOne = $fetch_seleted_date->format($formattedproductdeliverydate);

}

}

/*// check fopr updates

add_action( ‘init’, ‘byconsolewooodt_activate_extented_copy’ );

function byconsolewooodt_activate_extented_copy()

{

//echo ‘hi…’;

//exit;

require_once ( ‘inc/update.php’ );

$plugin_current_version = ‘1.0.2.0’;

$plugin_remote_path = ‘plugins.byconsole.com/upgrade.php’;

echo ‘printing plugin slug__’;

echo $plugin_slug = plugin_basename(__FILE__);

echo ‘__Plugin slig end’;

$license_user = ‘user’;

$license_key = ‘abcd’;

echo ‘calling function..’;

if ( $license_user && $license_key && $plugin_remote_path )

{

echo ‘__inside_if___’;

new wp_autoupdate ($plugin_current_version, $plugin_remote_path, $plugin_slug, $license_user, $license_key);

}

echo ‘function called..’;

}*/

/***********************/

/**

* Custom Woocommerce Email Headers

* add multiple bcc recipients

*/

function byconsolewooodt_custom_wooemail_headers( $headers, $object, $order ) {

/*echo ‘‘;*/

$placed_order_type=get_post_meta( $order->ID, ‘byconsolewooodt_delivery_type’, true );

if($placed_order_type==’levering’){

$delivery_email_id_get_option_array_value = get_option(‘byconsolewooodt_delivery_location’);

$delivery_email_id_index=get_post_meta( $order->ID, ‘byconsolewooodt_delivery_location’, true );

$additional_email_id=$delivery_email_id_get_option_array_value[$delivery_email_id_index][« email_id_on_each_location »];

}

if($placed_order_type==’take_away’){

$pickup_email_id_get_option_array_value = get_option(‘byconsolewooodt_pickup_location’);

$pickup_email_id_index=get_post_meta( $order->ID, ‘byconsolewooodt_pickup_location’, true );

$additional_email_id=$pickup_email_id_get_option_array_value[$pickup_email_id_index][« email_id_on_each_location »];

}

// replace the emails below to your desire email

$emails = array($additional_email_id);

switch($object) {

case ‘new_order’:

$headers .= ‘Bcc: ‘ . implode(‘,’, $emails) . « \r\n »;

break;

case ‘customer_processing_order’:

case ‘customer_completed_order’:

case ‘customer_invoice’:

default:

}

return $headers;

}

add_filter( ‘woocommerce_email_headers’, ‘byconsolewooodt_custom_wooemail_headers’, 10, 3);

// shortcodes

include( plugin_dir_path( __FILE__ ).’inc/shortcodes/bycwooodt_pickup_locations.php’);

include( plugin_dir_path( __FILE__ ).’inc/shortcodes/bycwooodt_delivery_locations.php’);

include( plugin_dir_path( __FILE__ ).’inc/shortcodes/bycwooodt_widget.php’);

include( plugin_dir_path( __FILE__ ).’inc/shortcodes/bycwooodt_order_date_time_location.php’);

add_filter( ‘woocommerce_add_to_cart_fragments’, ‘woocommerce_header_add_to_cart_fragment’ );

function woocommerce_header_add_to_cart_fragment( $fragments ) {

ob_start();

?>

Return to plugins page. » );

}

}

else{

}

}

else

{

}

}

add_action( ‘admin_init’, ‘byconsolewooodt_requires_wordpress_version’ );

?>

(Visited 1 times, 1 visits today)