Show WooODT data on third party plugin or any other template


To display ODT data on any third party plugin or on any other template copy pest the below code and carefully replace $order_id with your related order id or assign the related order id to this variable $order_id.


if(get_post_meta( $order_id, 'byconsolewooodt_delivery_type', true )=='take_away'){
$order_delivery_type='Pickup';
$pickup_location=get_post_meta( $order_id, 'byconsolewooodt_pickup_location', true );
$pickup_location_get_option_array_value = get_option('byconsolewooodt_pickup_location');
if(!empty($pickup_location)){
$pickup_location_index=get_post_meta( $order_id, 'byconsolewooodt_pickup_location', true );
$pickup_location_name=$pickup_location_get_option_array_value[$pickup_location_index]['location'];
$get_option_byconsolewooodt_order_page_pickup_location_lable = get_option('byconsolewooodt_order_page_pickup_location_lable');
if(!empty($get_option_byconsolewooodt_order_page_pickup_location_lable))
{
$byconsolewooodt_order_page_pickup_location_lable = get_option('byconsolewooodt_order_page_pickup_location_lable');
}
else
{
$byconsolewooodt_order_page_pickup_location_lable = 'Pickup location';
}
$location_string='

'.__($byconsolewooodt_order_page_pickup_location_lable,'ByConsoleWooODTExtended').': ' . $pickup_location_name . '

';
}else{
$location_string=__('

No pickup loaction was selected

','ByConsoleWooODTExtended');
}
$seleted_date = get_post_meta( $order_id, 'byconsolewooodt_delivery_date', true );
if(!empty($seleted_date))
{
$user_date = get_post_meta( $order_id, 'byconsolewooodt_delivery_date', true );
$productdeliverydate = $user_date;
}
else
{
$productdeliverydate = get_post_meta( $order_id, 'byconsolewooodt_delivery_date', true );
}
$formattedproductdeliverydate = get_option('byconsolewooodt_wooodt_date_formate_setting');
$delivery_time_val = get_post_meta( $order_id, 'byconsolewooodt_delivery_time', true );
if($delivery_time_val == 'as_early_as_possible')
{
$delivery_time_val_content = get_option('byconsolewooodt_as_early_as_possible_lable_text');
}
else
{
$delivery_time_val_content = get_post_meta( $order_id, 'byconsolewooodt_delivery_time', true );
}
$get_option_byconsolewooodt_order_page_pickup_date_lable = get_option('byconsolewooodt_order_page_pickup_date_lable');
if(!empty($get_option_byconsolewooodt_order_page_pickup_date_lable))
{
$byconsolewooodt_order_page_pickup_date_lable = get_option('byconsolewooodt_order_page_pickup_date_lable');
}
else
{
$byconsolewooodt_order_page_pickup_date_lable = 'Pickup date';
}
if(!empty($productdeliverydate))
{
$delivery_pickup_date = '

'.__($byconsolewooodt_order_page_pickup_date_lable,'ByConsoleWooODTExtended').': ' . date($formattedproductdeliverydate, strtotime($productdeliverydate)) . '

';
}
else
{
$delivery_pickup_date = '

'.__($byconsolewooodt_order_page_pickup_date_lable,'ByConsoleWooODTExtended').': ' . $productdeliverydate . '

';
}
$get_option_byconsolewooodt_order_page_pickup_time_lable = get_option('byconsolewooodt_order_page_pickup_time_lable');
if(!empty($get_option_byconsolewooodt_order_page_pickup_time_lable))
{
$byconsolewooodt_order_page_pickup_time_lable = get_option('byconsolewooodt_order_page_pickup_time_lable');
}
else
{
$byconsolewooodt_order_page_pickup_time_lable = 'Pickup time';
}
$byc_date_formate = get_option('byconsolewooodt_hours_format');
$full_date_string_strpos = strpos($delivery_time_val_content, " - ");
if($full_date_string_strpos != '')
{
$full_date_string_explode_val = explode(" - ",$delivery_time_val_content);
$first_time = date($byc_date_formate,strtotime($full_date_string_explode_val[0]));
$second_time = date($byc_date_formate,strtotime($full_date_string_explode_val[1]));
$delivery_time_val_content = $first_time.' - '.$second_time;
}
else
{
$delivery_time_val_content = date($byc_date_formate, strtotime($delivery_time_val_content));
}
$delivery_pickup_time = '

'.__($byconsolewooodt_order_page_pickup_time_lable,'ByConsoleWooODTExtended').': ' . $delivery_time_val_content . '

';
}
if(get_post_meta( $order_id, 'byconsolewooodt_delivery_type', true )=='levering'){
$order_delivery_type='Delivery';
$delivery_location=get_post_meta( $order_id, 'byconsolewooodt_delivery_location', true );
$delivery_location_get_option_array_value = get_option('byconsolewooodt_delivery_location');
if(!empty($delivery_location)){
$delivery_location_index=get_post_meta( $order_id, 'byconsolewooodt_delivery_location', true );
$delivery_location_name=$delivery_location_get_option_array_value[$delivery_location_index]['location'];
$get_option_byconsolewooodt_order_page_delivery_location_lable = get_option('byconsolewooodt_order_page_delivery_location_lable');
if(!empty($get_option_byconsolewooodt_order_page_delivery_location_lable))
{
$byconsolewooodt_order_page_delivery_location_lable = get_option('byconsolewooodt_order_page_delivery_location_lable');
}
else
{
$byconsolewooodt_order_page_delivery_location_lable = 'Delivery location';
}
$location_string='

'.__($byconsolewooodt_order_page_delivery_location_lable,'ByConsoleWooODTExtended').': ' . $delivery_location_name . '

';
}else{
$location_string=__('

No delivery loaction was selected

','ByConsoleWooODTExtended');
}
$seleted_date = get_post_meta( $order_id, 'byconsolewooodt_delivery_date', true );
if(!empty($seleted_date))
{
$user_date = get_post_meta( $order_id, 'byconsolewooodt_delivery_date', true );
$productdeliverydate = $user_date;
}
else
{
$productdeliverydate = get_post_meta( $order_id, 'byconsolewooodt_delivery_date', true );
}
$formattedproductdeliverydate = get_option('byconsolewooodt_wooodt_date_formate_setting');
$delivery_time_val = get_post_meta( $order_id, 'byconsolewooodt_delivery_time', true );
if($delivery_time_val == 'as_early_as_possible')
{
$delivery_time_val_content = get_option('byconsolewooodt_as_early_as_possible_lable_text');
}
else
{
$delivery_time_val_content = get_post_meta( $order_id, 'byconsolewooodt_delivery_time', true );
}
$get_option_byconsolewooodt_order_page_delivery_date_lable = get_option('byconsolewooodt_order_page_delivery_date_lable');
if(!empty($get_option_byconsolewooodt_order_page_delivery_date_lable))
{
$byconsolewooodt_order_page_delivery_date_lable = get_option('byconsolewooodt_order_page_delivery_date_lable');
}
else
{
$byconsolewooodt_order_page_delivery_date_lable = 'Delivery date';
}
if(!empty($productdeliverydate))
{
$delivery_pickup_date = '

'.__($byconsolewooodt_order_page_delivery_date_lable,'ByConsoleWooODTExtended').': ' . date($formattedproductdeliverydate, strtotime($productdeliverydate)) . '

';
}
else
{
$delivery_pickup_date = '

'.__($byconsolewooodt_order_page_delivery_date_lable,'ByConsoleWooODTExtended').': ' .$productdeliverydate. '

';
}
$get_option_byconsolewooodt_order_page_delivery_time_lable = get_option('byconsolewooodt_order_page_delivery_time_lable');
if(!empty($get_option_byconsolewooodt_order_page_delivery_time_lable))
{
$byconsolewooodt_order_page_delivery_time_lable = get_option('byconsolewooodt_order_page_delivery_time_lable');
}
else
{
$byconsolewooodt_order_page_delivery_time_lable = 'Delivery time';
}
$byc_date_formate = get_option('byconsolewooodt_hours_format');
$full_date_string_strpos = strpos($delivery_time_val_content, " - ");
if($full_date_string_strpos != '')
{
$full_date_string_explode_val = explode(" - ",$delivery_time_val_content);
$first_time = date($byc_date_formate,strtotime($full_date_string_explode_val[0]));
$second_time = date($byc_date_formate,strtotime($full_date_string_explode_val[1]));
$delivery_time_val_content = $first_time.' - '.$second_time;
}
else
{
$delivery_time_val_content = date($byc_date_formate, strtotime($delivery_time_val_content));
}
$delivery_pickup_time = '

'.__($byconsolewooodt_order_page_delivery_time_lable,'ByConsoleWooODTExtended').': ' . $delivery_time_val_content . '

';
}
$get_option_byconsolewooodt_order_page_order_type_lable = get_option('byconsolewooodt_order_page_order_type_lable');
if(!empty($get_option_byconsolewooodt_order_page_order_type_lable))
{
$byconsolewooodt_order_page_order_type_lable = get_option('byconsolewooodt_order_page_order_type_lable');
}
else
{
$byconsolewooodt_order_page_order_type_lable = 'Order Type';
}
echo '

'.__($byconsolewooodt_order_page_order_type_lable,'ByConsoleWooODTExtended').': ' . $order_delivery_type . '

';
if($productdeliverydate!='' && $delivery_time_val_content!='' )
{
echo $location_string;
echo $delivery_pickup_date;
echo $delivery_pickup_time;
}


NB: DON’T CORRECT SPELLINGS

If you need more help feel free the same at support@byconsole.com.

Have any Question or Comment?

2 comments on “Show WooODT data on third party plugin or any other template

Luis M

where do we copy/paste?

Reply
ByConsole

Copy pest it on any page template where a single order is rendering or looping through orders. Like if you have any other plugin or a custom page template where it show a particular order data or a list of orders. Keep in mind variable $order_id is the order ID of the order that you wanna show. So just assign the order id variable from your existing code to this variable $order_id just before the code to pest.

Reply

Leave a Reply

Follow us on G+

Follow us on Twitter

Blog stats since 12th July, 2017

  • 11,373 hits
%d bloggers like this: