function estate_listing_price($post_id) { $return_string = ''; $property_price = floatval(get_post_meta($post_id, 'property_price', true)); $property_price_per_week = floatval(get_post_meta($post_id, 'property_price_per_week', true)); $property_price_per_month = floatval(get_post_meta($post_id, 'property_price_per_month', true)); $cleaning_fee = floatval(get_post_meta($post_id, 'cleaning_fee', true)); $city_fee = floatval(get_post_meta($post_id, 'city_fee', true)); $currency = esc_html(get_option('wp_estate_currency_symbol', '')); $where_currency = esc_html(get_option('wp_estate_where_currency_symbol', '')); $th_separator = get_option('wp_estate_prices_th_separator', ''); $custom_fields = get_option('wp_estate_multi_curr', true); $property_price_show = wpestate_show_price_booking($property_price, $currency, $where_currency, 1); $property_price_per_week_show = wpestate_show_price_booking($property_price_per_week, $currency, $where_currency, 1); $property_price_per_month_show = wpestate_show_price_booking($property_price_per_month, $currency, $where_currency, 1); $cleaning_fee_show = wpestate_show_price_booking($cleaning_fee, $currency, $where_currency, 1); $city_fee_show = wpestate_show_price_booking($city_fee, $currency, $where_currency, 1); if ($property_price != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Price per night', 'wpestate') . ':</span> ' . $property_price_show . '</div>'; } if ($property_price_per_week != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Price per night (7d+)', 'wpestate') . ':</span> ' . $property_price_per_week_show . '</div>'; } if ($property_price_per_month != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Price per night (30d+)', 'wpestate') . ':</span> ' . $property_price_per_month_show . '</div>'; } if ($cleaning_fee != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Cleaning Fee', 'wpestate') . ':</span> ' . $cleaning_fee_show . '</div>'; } if ($city_fee != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('City Tax Fee', 'wpestate') . ':</span> ' . $city_fee_show . '</div>'; } return $return_string; }
function wpestate_ajax_show_booking_costs() { $property_id = intval($_POST['property_id']); $booking_from_date = esc_html($_POST['fromdate']); $booking_to_date = esc_html($_POST['todate']); $invoice_id = 0; $booking_array = wpestate_booking_price($invoice_id, $property_id, $booking_from_date, $booking_to_date); $deposit_show = ''; $balance_show = ''; $currency = esc_html(get_option('wp_estate_currency_symbol', '')); //currency_symbol $where_currency = esc_html(get_option('wp_estate_where_currency_symbol', '')); //where_currency_symbol if ($booking_array['default_price'] != 0) { $price_show = wpestate_show_price_booking($booking_array['default_price'], $currency, $where_currency, 1); $total_price_show = wpestate_show_price_booking($booking_array['total_price'], $currency, $where_currency, 1); $deposit_show = wpestate_show_price_booking($booking_array['deposit'], $currency, $where_currency, 1); $balance_show = wpestate_show_price_booking($booking_array['balance'], $currency, $where_currency, 1); $city_fee_show = wpestate_show_price_booking($booking_array['city_fee'], $currency, $where_currency, 1); $cleaning_fee_show = wpestate_show_price_booking($booking_array['cleaning_fee'], $currency, $where_currency, 1); $inter_price_show = wpestate_show_price_booking($booking_array['inter_price'], $currency, $where_currency, 1); } else { $price_show = ''; } print ' <div class="show_cost_form" id="show_cost_form" > <div class="cost_row"> <div class="cost_explanation">'; if ($booking_array['has_custom'] == 0) { print $price_show . ' x ' . $booking_array['numberDays'] . ' ' . esc_html__('nights', 'wpestate'); } else { print $booking_array['numberDays'] . ' ' . esc_html__('nights with custom price', 'wpestate'); } print '</div> <div class="cost_value">' . $inter_price_show . '</div> </div>'; if ($booking_array['cleaning_fee'] != 0 && $booking_array['cleaning_fee'] != '') { print ' <div class="cost_row"> <div class="cost_explanation">' . esc_html__('Cleaning Fee', 'wpestate') . '</div> <div class="cost_value">' . $cleaning_fee_show . '</div> </div>'; } if ($booking_array['city_fee'] != 0 && $booking_array['city_fee'] != '') { print ' <div class="cost_row"> <div class="cost_explanation">' . esc_html__('City Fee', 'wpestate') . '</div> <div class="cost_value">' . $city_fee_show . '</div> </div>'; } print ' <div class="cost_row"> <div class="cost_explanation"><strong>' . esc_html__('TOTAL', 'wpestate') . '</strong></div> <div class="cost_value">' . $total_price_show . '</div> </div> </div>'; die; }
<span class="booking_details_title"><?php esc_html_e('Invoice No: ', 'wpestate'); ?> </span> <span class="invoice_list_id"><?php print $invoice_no; ?> </span> </div> <div class="user_dashboard_listed"> <span class="booking_details_title"><?php esc_html_e('Pay Amount: ', 'wpestate'); ?> </span> <?php print wpestate_show_price_booking(floatval(get_post_meta($invoice_no, 'item_price', true)), $currency, $where_currency, 1); ?> <span class="booking_details_title guest_details"><?php esc_html_e('Guests: ', 'wpestate'); ?> </span> <?php print $booking_guests; ?> </div> <div class="user_dashboard_listed"> </div> <?php
function wpestate_ajax_show_booking_costs() { $property_id = intval($_POST['property_id']); $booking_from_date = esc_html($_POST['fromdate']); $booking_to_date = esc_html($_POST['todate']); $invoice_id = 0; $booking_array = wpestate_booking_price($invoice_id, $property_id, $booking_from_date, $booking_to_date); $deposit_show = ''; $balance_show = ''; $currency = esc_html(get_option('wp_estate_currency_symbol', '')); //currency_symbol $where_currency = esc_html(get_option('wp_estate_where_currency_symbol', '')); //where_currency_symbol if ($booking_array['default_price'] != 0) { $price_show = wpestate_show_price_booking($booking_array['default_price'], $currency, $where_currency, 1); $total_price_show = wpestate_show_price_booking($booking_array['total_price'], $currency, $where_currency, 1); $deposit_show = wpestate_show_price_booking($booking_array['deposit'], $currency, $where_currency, 1); $balance_show = wpestate_show_price_booking($booking_array['balance'], $currency, $where_currency, 1); $city_fee_show = wpestate_show_price_booking($booking_array['city_fee'], $currency, $where_currency, 1); $monthly_fee = wpestate_show_price_booking($booking_array['month_price'], $currency, $where_currency, 1); $cleaning_fee_show = wpestate_show_price_booking($booking_array['cleaning_fee'], $currency, $where_currency, 1); $inter_price_show = wpestate_show_price_booking($booking_array['inter_price'], $currency, $where_currency, 1); } else { $price_show = ''; } print ' <div class="show_cost_form" id="show_cost_form" > <div class="cost_row"> <div class="cost_explanation">'; $value = get_option('wp_estate_prices_per', ''); // CUSTOM MOD switch ($value) { case 'day': if ($booking_array['has_custom'] == 0) { print $price_show . ' x ' . $booking_array['numberDays'] . ' ' . esc_html__('nights', 'wpestate'); } else { print $booking_array['numberDays'] . ' ' . esc_html__('nights with custom price', 'wpestate'); } break; case 'week': if ($booking_array['has_custom'] == 0) { print $price_show . ' x ' . $booking_array['numberDays'] . ' ' . esc_html__('weeks', 'wpestate'); } else { print $booking_array['numberDays'] . ' ' . esc_html__('weeks with custom price', 'wpestate'); } break; case 'month': if ($booking_array['has_custom'] == 0) { // $booking_array['numberDays'] contain numbers of months $date_in = new DateTime($booking_from_date); $date_out = new DateTime($booking_to_date); $date_out->modify('+1 day'); $diff = $date_in->diff($date_out); if ($diff->d > 0 && $booking_array['numberDays'] > 0) { print $price_show . ' x ' . $booking_array['numberDays'] . ' ' . esc_html__('months', 'wpestate') . ' and ' . $diff->d . ' ' . esc_html__('days', 'wpestate'); } elseif ($diff->d <= 0 && $booking_array['numberDays'] > 0) { print $price_show . ' x ' . $booking_array['numberDays'] . ' ' . esc_html__('months', 'wpestate'); } elseif ($diff->d > 0 && $booking_array['numberDays'] <= 0) { print $price_show . ' x ' . $diff->d . ' ' . esc_html__('days', 'wpestate'); } } else { print $booking_array['numberDays'] . ' ' . esc_html__('months with custom price', 'wpestate'); } break; } print '</div> <div class="cost_value">' . $inter_price_show . '</div> </div>'; if ($booking_array['cleaning_fee'] != 0 && $booking_array['cleaning_fee'] != '') { print ' <div class="cost_row"> <div class="cost_explanation">' . esc_html__('Application Fee', 'wpestate') . '</div> <div class="cost_value">' . $cleaning_fee_show . '</div> </div>'; } if ($booking_array['city_fee'] != 0 && $booking_array['city_fee'] != '') { print ' <div class="cost_row"> <div class="cost_explanation">' . esc_html__('Moving Fee', 'wpestate') . '</div> <div class="cost_value">' . $city_fee_show . '</div> </div>'; } if ($booking_array['month_price'] != 0) { print ' <div class="cost_row"> <div class="cost_explanation">' . esc_html__('Monthly Fee', 'wpestate') . '</div> <div class="cost_value">' . $monthly_fee . '</div> </div>'; } print ' <div class="cost_row"> <div class="cost_explanation"><strong>' . esc_html__('TOTAL', 'wpestate') . '</strong></div> <div class="cost_value">' . $total_price_show . '</div> </div> </div>'; die; }
function estate_listing_price($post_id) { $return_string = ''; $value = get_option('wp_estate_prices_per', ''); // CUSTOM MOD (switch) switch ($value) { case 'day': $property_price = floatval(get_post_meta($post_id, 'property_price', true)); $property_price_per_week = floatval(get_post_meta($post_id, 'property_price_per_week', true)); $property_price_per_month = floatval(get_post_meta($post_id, 'property_price_per_month', true)); break; case 'week': $property_price = floatval(get_post_meta($post_id, 'property_price_onweek', true)); $property_price_per_week = floatval(get_post_meta($post_id, 'property_price_on_3_week', true)); $property_price_per_month = floatval(get_post_meta($post_id, 'property_price_on_6_week', true)); break; case 'month': $property_price = floatval(get_post_meta($post_id, 'property_price_onmonth', true)); $property_price_per_week = floatval(get_post_meta($post_id, 'property_price_on_6_month', true)); $property_price_per_month = floatval(get_post_meta($post_id, 'property_price_on_9_month', true)); break; } $cleaning_fee = floatval(get_post_meta($post_id, 'cleaning_fee', true)); $city_fee = floatval(get_post_meta($post_id, 'city_fee', true)); $currency = esc_html(get_option('wp_estate_currency_symbol', '')); $where_currency = esc_html(get_option('wp_estate_where_currency_symbol', '')); $th_separator = get_option('wp_estate_prices_th_separator', ''); $custom_fields = get_option('wp_estate_multi_curr', true); $property_price_show = wpestate_show_price_booking($property_price, $currency, $where_currency, 1); $property_price_per_week_show = wpestate_show_price_booking($property_price_per_week, $currency, $where_currency, 1); $property_price_per_month_show = wpestate_show_price_booking($property_price_per_month, $currency, $where_currency, 1); $cleaning_fee_show = wpestate_show_price_booking($cleaning_fee, $currency, $where_currency, 1); $city_fee_show = wpestate_show_price_booking($city_fee, $currency, $where_currency, 1); // CUSTOM MOD () // The Original code is only Price per night $value = get_option('wp_estate_prices_per', ''); switch ($value) { case 'day': if ($property_price != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Price per night', 'wpestate') . ':</span> ' . $property_price_show . '</div>'; } if ($property_price_per_week != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Price per night (7d+)', 'wpestate') . ':</span> ' . $property_price_per_week_show . '</div>'; } if ($property_price_per_month != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Price per night (30d+)', 'wpestate') . ':</span> ' . $property_price_per_month_show . '</div>'; } break; case 'week': if ($property_price != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Price per Week', 'wpestate') . ':</span> ' . $property_price_show . '</div>'; } if ($property_price_per_week != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Price per Week (3w+)', 'wpestate') . ':</span> ' . $property_price_per_week_show . '</div>'; } if ($property_price_per_month != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Price per Week (6w+)', 'wpestate') . ':</span> ' . $property_price_per_month_show . '</div>'; } break; case 'month': if ($property_price != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Price per Month', 'wpestate') . ':</span> ' . $property_price_show . '</div>'; } if ($property_price_per_week != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Price per Month (6m+)', 'wpestate') . ':</span> ' . $property_price_per_week_show . '</div>'; } if ($property_price_per_month != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Price per Month (9m+)', 'wpestate') . ':</span> ' . $property_price_per_month_show . '</div>'; } break; } if ($cleaning_fee != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Application Fee', 'wpestate') . ':</span> ' . $cleaning_fee_show . '</div>'; } if ($city_fee != 0) { $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Moving Fee', 'wpestate') . ':</span> ' . $city_fee_show . '</div>'; } return $return_string; }