get_items();
ob_start();
$path = YAYMAIL_PLUGIN_PATH . 'views/templates/emails/LatePoint/latepoint-booking-detail.php';
include $path;
$html = ob_get_contents();
ob_end_clean();
return $html;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointCalendarStartDate( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_calendar_start_date = '
';
$list_calendar_start_date .= '- ' . date_i18n( wc_date_format(), current_time( 'Y-m-d' ) ) . '
';
$list_calendar_start_date .= '
';
return $list_calendar_start_date;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$list_calendar_start_date = '';
foreach ( $order_items as $item ) {
$data = wc_get_order_item_meta( $item->get_id(), TECHXELA_WOOCOMMERCE_LATEPOINT_ORDER_ITEM_META_KEY );
$calendar_start_date = isset( $data['restrictions']['calendar_start_date'] ) ? $data['restrictions']['calendar_start_date'] : null;
if ( empty( $calendar_start_date ) ) {
return null;
}
$list_calendar_start_date .= '- ' . date_i18n( wc_date_format(), strtotime( $calendar_start_date ) ) . '
';
}
$list_calendar_start_date .= '
';
return $list_calendar_start_date;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
//WooCommerce for LatePoint
public static function wooLatepointSelectedTotalAttendees( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- ' . 5 . '
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'selected_total_attendies' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointCaption( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- caption
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'caption' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointBgColor( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- bg_color
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'bg_color' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointTextColor( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- text_color
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'text_color' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointFontSize( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- font_size
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'font_size' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointBorder( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- border
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'border' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointBorderRadius( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- border_radius
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'border_radius' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointMargin( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- margin
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'margin' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointPaddings( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- padding
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'padding' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointCss( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- css
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'css' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointShowLocations( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- show_locations
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'show_locations' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointShowAgents( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- show_agents
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'show_agents' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointShowServices( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- show_services
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'show_services' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointShowServiceCategories( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- show_service_categories
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'show_service_categories' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointSelectedLocation( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- selected_location
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'selected_location' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointSelectedAgent( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- selected_agent
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'selected_agent' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointSelectedService( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- ' . 5 . '
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'selected_service' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointSelectedServiceCategory( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- ' . 5 . '
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'selected_service_category' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointSelectedDuration( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- ' . 5 . '
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'selected_duration' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointHideSidePanel( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- hide_side_panel
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'hide_side_panel' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
public static function wooLatepointHideSummary( $args, $order, $sent_to_admin ) {
if ( null === $order ) {
$list_attributes = '';
$list_attributes .= '- hide_summary
';
$list_attributes .= '
';
return $list_attributes;
} else {
if ( method_exists( $order, 'get_items' ) ) {
$order_items = $order->get_items();
$valueRestrictionsAttributes = self::getRestrictionsAttributes( $order_items, 'hide_summary' );
return $valueRestrictionsAttributes;
} else {
// Handle error: $order object doesn't have get_items() method
return null;
}
}
}
/**
* It takes the order items and the value of the attribute you want to display, and returns a list of
* the attributes
*
* @param order_items This is the array of order items.
* @param value The name of the attribute you want to display.
*
* @return A list of attributes.
*/
public static function getRestrictionsAttributes( $order_items, $value ) {
$list_attributes = '';
$attributes = $value;
foreach ( $order_items as $item ) {
$data = wc_get_order_item_meta( $item->get_id(), TECHXELA_WOOCOMMERCE_LATEPOINT_ORDER_ITEM_META_KEY );
$data_attributes = isset( $data['restrictions'][ $attributes ] ) ? $data['restrictions'][ $attributes ] : null;
if ( empty( $data_attributes ) ) {
return null;
}
$list_attributes .= '- ' . $data_attributes . '
';
}
$list_attributes .= '
';
return $list_attributes;
}
}