<?php /* $this->start = Carbon::createFromFormat( 'Y-m-d', $start ); $this->end = Carbon::createFromFormat( 'Y-m-d', $end ); $this->nights = $this->start->diffInDays( $this->end, false ); $this->property = $this->getProperty(); $this->min_nights = $this->getMinNights(); $this->max_nights = $this->getMaxNights(); $this->min_guests = $this->getMinGuests(); $this->max_guests = $this->getMaxGuests(); $this->booking_interval = $this->getBookingInterval(); $this->bookable = $this->getBookable(); */ $booking = new BonsaiBooking(75, 2, '2013-06-28', '2013-06-29'); echo $booking->calculateTotalPrice();
function est_action_get_booking_prices() { $currency = get_post_meta($_POST['_est_property_id'], '_est_rent_currency', true); $currency_position = get_post_meta($_POST['_est_property_id'], '_est_rent_currency_position', true); $_POST['_est_guests'] = empty($_POST['_est_guests']) ? 1 : $_POST['_est_guests']; if (empty($_POST['_est_end']) or empty($_POST['_est_start'])) { $response['price_per_night'] = est_get_amount(0, $currency, $currency_position); $response['total_price'] = est_get_amount(0, $currency, $currency_position); } else { $booking = new BonsaiBooking($_POST['_est_property_id'], $_POST['_est_guests'], $_POST['_est_start'], $_POST['_est_end']); $response['price_per_night'] = est_get_amount($booking->calculatePricePerNight(), $currency, $currency_position); $response['total_price'] = est_get_amount($booking->calculateTotalPrice(), $currency, $currency_position); } echo json_encode($response); die; }