<p> <span><?php if ($list_staus->num_rows() == 0) { echo 'List Deletion'; } else { echo $row->name; } ?> </span> <?php if (isset($topay) && $topay != '' && $paid != 1) { if ($hostpaid != 1 && $guestpaid != 1) { // $topay = get_currency_value2($currency,$topay); ?> <br> <span><?php echo get_currency_symbol($row->list_id) . get_currency_value_lys($currency, get_currency_code(), $topay); ?> </span> <?php } } ?> </p> </div> <?php } ?> </li> <?php } } else {
<a style="background-image:url(<?php echo $image; ?> );background-size: cover;" class="media-photo media-cover wishlist-bg-img" href="/rooms/281390"> </a> <div class="panel-overlay-bottom-left panel-overlay-label panel-overlay-listing-label"> <sup class="h6 text-contrast" style="font-size: 14px;"><?php echo get_currency_symbol1(); ?> </sup> <span class="h3 price-amount" style="font-size: 24px;"><?php echo get_currency_value1($row->list_id, $row->price); ?> </span> <sup class="h6 text-contrast" style="font-size: 14px;"><?php echo get_currency_code(); ?> </sup> </div> <div class="panel-overlay-top-right wl-social-connection-panel"> <span class="rich-toggle wish_list_button wishlist-button not_saved"> <label for=""> <?php $wishlist_user_check = $this->Common_model->getTableData('user_wishlist', array('list_id' => $row->list_id, 'user_id' => $this->dx_auth->get_user_id())); if (!$this->dx_auth->is_logged_in()) { ?> <img class="search_heart_normal search_heart" id="<?php echo $row->list_id; ?>
public function ajax_refresh_subtotal() { $id = $this->input->get('hosting_id'); $this->session->unset_userdata("total_price_'" . $id . "'_'" . $this->dx_auth->get_user_id() . "'"); $checkin = $this->input->get('checkin'); $checkout = $this->input->get('checkout'); $data['guests'] = $this->input->get('number_of_guests'); $capacity = $this->Common_model->getTableData('list', array('id' => $id))->row()->capacity; $ckin = explode('/', $checkin); $ckout = explode('/', $checkout); $xprice = $this->Common_model->getTableData('price', array('id' => $id))->row(); $guests = $xprice->guests; $per_night = $xprice->night; if (isset($xprice->cleaning)) { $cleaning = $xprice->cleaning; } else { $cleaning = 0; } if (isset($xprice->security)) { $security = $xprice->security; } else { $security = 0; } if (isset($xprice->night)) { $price = $xprice->night; } else { $price = 0; } if (isset($xprice->week)) { $Wprice = $xprice->week; } else { $Wprice = 0; } if (isset($xprice->month)) { $Mprice = $xprice->month; } else { $Mprice = 0; } $guest_count = $xprice->guests; //check admin premium condition and apply so for $query = $this->Common_model->getTableData('paymode', array('id' => 2)); $row = $query->row(); //Seasonal Price //1. Store all the dates between checkin and checkout in an array $checkin_time = get_gmt_time(strtotime($checkin)); $checkout_time = get_gmt_time(strtotime($checkout)); $travel_dates = array(); $seasonal_prices = array(); $total_nights = 1; $total_price = 0; $is_seasonal = 0; $i = $checkin_time; while ($i < $checkout_time) { $checkin_date = date('m/d/Y', $i); $checkin_date = explode('/', $checkin_date); $travel_dates[$total_nights] = $checkin_date[1] . $checkin_date[0] . $checkin_date[2]; $i = get_gmt_time(strtotime('+1 day', $i)); $total_nights++; } for ($i = 1; $i < $total_nights; $i++) { $seasonal_prices[$travel_dates[$i]] = ""; } //Store seasonal price of a list in an array $seasonal_query = $this->Common_model->getTableData('seasonalprice', array('list_id' => $id)); $seasonal_result = $seasonal_query->result_array(); if ($seasonal_query->num_rows() > 0) { foreach ($seasonal_result as $time) { //Get Seasonal price $seasonalprice_query = $this->Common_model->getTableData('seasonalprice', array('list_id' => $id, 'start_date' => $time['start_date'], 'end_date' => $time['end_date'])); $seasonalprice = $seasonalprice_query->row()->price; //Days between start date and end date -> seasonal price $start_time = $time['start_date']; $end_time = $time['end_date']; $i = $start_time; while ($i <= $end_time) { $start_date = date('m/d/Y', $i); $s_date = explode('/', $start_date); $s_date = $s_date[1] . $s_date[0] . $s_date[2]; $seasonal_prices[$s_date] = $seasonalprice; $i = get_gmt_time(strtotime('+1 day', $i)); } } //Total Price for ($i = 1; $i < $total_nights; $i++) { if ($seasonal_prices[$travel_dates[$i]] == "") { $total_price = $total_price + $xprice->night; } else { $total_price = $total_price + $seasonal_prices[$travel_dates[$i]]; $is_seasonal = 1; } } //Additional Guests if ($data['guests'] > $guests) { $days = $total_nights - 1; $diff_guests = $data['guests'] - $guests; $total_price = $total_price + $days * $xprice->addguests * $diff_guests; $extra_guest = 1; $extra_guest_price = $xprice->addguests * $diff_guests; } //Cleaning if ($cleaning != 0) { $total_price = $total_price + $cleaning; } if ($security != 0) { $total_price = $total_price + $security; } //Admin Commission $data['commission'] = 0; if ($row->is_premium == 1) { if ($row->is_fixed == 1) { $fix = $row->fixed_amount; $amt = $total_price + $fix; $data['commission'] = $fix; } else { $per = $row->percentage_amount; $camt = floatval($total_price * $per / 100); $amt = $total_price + $camt; $data['commission'] = $camt; } } } if ($is_seasonal == 1) { //Total days $days = $total_nights; //Final price $data['price'] = $total_price; } else { if ($ckin[0] == "mm" && $ckout[0] == "mm" or $ckin[0] == "" && $ckout[0] == "" or $checkin == 'Check in' or $checkout == 'Check out') { $days = 0; $data['price'] = $price; if ($Wprice == 0) { $data['Wprice'] = $price * 7; } else { $data['Wprice'] = $Wprice; } if ($Mprice == 0) { $data['Mprice'] = $price * 30; } else { $data['Mprice'] = $Mprice; } $data['commission'] = 0; if ($row->is_premium == 1) { if ($row->is_fixed == 1) { $fix = $row->fixed_amount; $amt = $price + $fix; $data['commission'] = $fix; $Fprice = $amt; } else { $per = $row->percentage_amount; $camt = floatval($price * $per / 100); $amt = $price + $camt; $data['commission'] = $camt; $Fprice = $amt; } if ($Wprice == 0) { $data['Wprice'] = $price * 7; } else { $data['Wprice'] = $Wprice; } if ($Mprice == 0) { $data['Mprice'] = $price * 30; } else { $data['Mprice'] = $Mprice; } } } else { $diff = strtotime($ckout[2] . '-' . $ckout[0] . '-' . $ckout[1]) - strtotime($ckin[2] . '-' . $ckin[0] . '-' . $ckin[1]); $days = ceil($diff / (3600 * 24)); $price = $price * $days; //Additional guests if ($data['guests'] > $guests) { $diff_days = $data['guests'] - $guests; $price = $price + $days * $xprice->addguests * $diff_days; $extra_guest = 1; $extra_guest_price = $xprice->addguests * $diff_days; } if ($Wprice == 0) { $data['Wprice'] = $price * 7; } else { $data['Wprice'] = $Wprice; } if ($Mprice == 0) { $data['Mprice'] = $price * 30; } else { $data['Mprice'] = $Mprice; } $data['commission'] = 0; if ($days >= 7 && $days < 30) { if (!empty($Wprice)) { $finalAmount = $Wprice; $differNights = $days - 7; $perDay = $Wprice / 7; $per_night = round($perDay, 2); if ($differNights > 0) { $addAmount = $differNights * $per_night; $finalAmount = $Wprice + $addAmount; } $price = $finalAmount; //Additional guests if ($data['guests'] > $guests) { $diff_days = $data['guests'] - $guests; $price = $price + $days * $xprice->addguests * $diff_days; $extra_guest = 1; $extra_guest_price = $xprice->addguests * $diff_days; } } } if ($days >= 30) { if (!empty($Mprice)) { $finalAmount = $Mprice; $differNights = $days - 30; $perDay = $Mprice / 30; $per_night = round($perDay, 2); if ($differNights > 0) { $addAmount = $differNights * $per_night; $finalAmount = $Mprice + $addAmount; } $price = $finalAmount; //Additional guests if ($data['guests'] > $guests) { $diff_days = $data['guests'] - $guests; $price = $price + $days * $xprice->addguests * $diff_days; $extra_guest = 1; $extra_guest_price = $xprice->addguests * $diff_days; } } } if ($row->is_premium == 1) { if ($row->is_fixed == 1) { $fix = $row->fixed_amount; $amt = $price + $fix; $data['commission'] = $fix; $Fprice = $amt; } else { $per = $row->percentage_amount; $camt = floatval($price * $per / 100); $amt = $price + $camt; $data['commission'] = $camt; $Fprice = $amt; } if ($Wprice == 0) { $data['Wprice'] = $price * 7; } else { $data['Wprice'] = $Wprice; } if ($Mprice == 0) { $data['Mprice'] = $price * 30; } else { $data['Mprice'] = $Mprice; } } $xprice = $this->Common_model->getTableData('list', array('id' => $id))->row(); if ($cleaning != 0) { $price = $price + $cleaning; } if ($security != 0) { $price = $price + $security; } $data['price'] = $price; } } $query = $this->db->query("SELECT id,list_id FROM `calendar` WHERE `list_id` = '" . $id . "' AND (`booked_days` = '" . get_gmt_time(strtotime($checkin)) . "' OR `booked_days` = '" . get_gmt_time(strtotime($checkout)) . "') GROUP BY `list_id`"); $rows = $query->num_rows(); $daysexist = $this->db->query("SELECT id,list_id,booked_days FROM `calendar` WHERE `list_id` = '" . $id . "' AND (`booked_days` >= '" . get_gmt_time(strtotime($checkin)) . "' AND `booked_days` <= '" . get_gmt_time(strtotime($checkout)) . "') GROUP BY `list_id`"); $rowsexist = $daysexist->num_rows(); if ($rowsexist > 0) { if (isset($extra_guest)) { if ($extra_guest == 1) { echo '{"available":false,"extra_guest":1,"extra_guest_price":"' . get_currency_symbol($id) . get_currency_value1($id, $extra_guest_price) . '","total_price":' . $data['price'] . ',"reason_message":"Those dates are not available"}'; } } else { echo '{"available":false,"total_price":' . $data['price'] . ',"reason_message":"Those dates are not available"}'; } } else { if ($data['guests'] > $capacity) { echo '{"available":false,"total_price":' . $data['price'] . ',"reason_message":"' . $capacity . ' guest(s) only allowed"}'; } else { $this->session->set_userdata("total_price_'" . $id . "'_'" . $this->dx_auth->get_user_id() . "'", $data['price']); $staggered_price = ""; if ($days >= 30) { $staggered_price = ',"staggered_price":"' . get_currency_symbol($id) . get_currency_value1($id, $data['price']) . '","staggered":false'; } if (isset($extra_guest)) { if ($extra_guest == 1) { echo '{"service_fee":"' . get_currency_symbol($id) . get_currency_value_lys($row->currency, get_currency_code(), $data['commission']) . '","extra_guest_price":"' . get_currency_symbol($id) . get_currency_value1($id, $extra_guest_price) . '","extra_guest":1,"reason_message":"","price_per_night":"' . get_currency_symbol($id) . get_currency_value1($id, $per_night) . '","nights":' . $days . ',"available":true,"can_instant_book":false,"total_price":"' . get_currency_symbol($id) . get_currency_value1($id, $data['price']) . '"' . $staggered_price . '}'; } } else { echo '{"service_fee":"' . get_currency_symbol($id) . get_currency_value_lys($row->currency, get_currency_code(), $data['commission']) . '","reason_message":"","price_per_night":"' . get_currency_symbol($id) . get_currency_value1($id, $per_night) . '","nights":' . $days . ',"available":true,"can_instant_book":false,"total_price":"' . get_currency_symbol($id) . get_currency_value1($id, $data['price']) . '"' . $staggered_price . '}'; } } } }
public function ajax_get_results() { $this->load->library("Ajax_pagination"); //get starred list status $star = $this->input->get('starred'); //Get the checkin and chekout dates $checkin = ''; $checkout = ''; $stack = array(); $room_types = array(); $property_type_id = array(); $this->session->set_userdata('ajax_search_location', $this->input->get('location')); $checkin = $this->input->get('checkin'); $checkout = $this->input->get('checkout'); $nof_guest = $this->input->get('guests'); $room_types = $this->input->get('room_types'); $this->session->set_userdata('Vcheckin', $checkin); $this->session->set_userdata('Vcheckout', $checkout); $this->session->set_userdata('Vnumber_of_guests', $nof_guest); $search_view = $this->input->get('search_view'); $min = $this->input->get('price_min'); $max = $this->input->get('price_max'); $keywords = $this->input->get('keywords'); $search_by_map = $this->input->get('search_by_map'); $sw_lat = $this->input->get('sw_lat'); $sw_lng = $this->input->get('sw_lng'); $ne_lat = $this->input->get('ne_lat'); $ne_lng = $this->input->get('ne_lng'); $min_bedrooms = $this->input->get('min_bedrooms'); $property_type = $this->input->get('property_type'); $min_bathrooms = $this->input->get('min_bathrooms'); $min_beds = $this->input->get('min_beds'); $min_bed_type = $this->input->get('min_bed_type'); $instance_book = $this->input->get('instance_book'); $property_type_id = $this->input->get('property_type_id'); $hosting_amenities = $this->input->get('hosting_amenities'); $page = $this->input->get('page'); $sort = $this->input->get('sort'); $lat = $this->session->userdata('lat'); $lng = $this->session->userdata('lng'); /*if(empty($sort)) { $sort = 1; }*/ $data['page'] = $page; if ($checkin != '--' && $checkout != '--' && $checkin != "yy-mm-dd" && $checkout != "yy-mm-dd") { // Specify the start date. This date can be any English textual format $date_from = $checkin; $date_from = strtotime($date_from); // Convert date to a UNIX timestamp // Specify the end date. This date can be any English textual format $date_to = $checkout; $date_to = strtotime($date_to); // Convert date to a UNIX timestamp $arr = array(); // Loop from the start date to end date and output all dates inbetween for ($i = $date_from; $i <= $date_to; $i += 86400) { $arr[] = $i; } $ans = $this->db->query("SELECT id,list_id FROM `calendar` WHERE `booked_days` = '" . get_gmt_time(strtotime($checkin)) . "' OR `booked_days` = '" . get_gmt_time(strtotime($checkout)) . "' GROUP BY `list_id`"); if ($ans->num_rows() == 0) { $ans = $this->db->where_in('booked_days', $arr)->group_by('list_id')->get('calendar'); } $a = $ans->result(); $this->db->flush_cache(); // Now after the checkin is completed if (!empty($a)) { foreach ($a as $a1) { array_push($stack, $a1->list_id); } } } $condition = ''; $location = $this->input->get('location'); $FileName = str_replace("'", "", $location); $FileName4 = str_replace("-", "", $FileName); //$FileName5 = str_replace(" ", ",", $FileName4); $pieces = explode(",", $FileName4); $print = ""; $len = count($pieces); $condition .= "(`status` != '0')"; if ($search_by_map) { $condition .= "AND (`lat` BETWEEN {$sw_lat} AND {$ne_lat}) AND (`long` BETWEEN {$sw_lng} AND {$ne_lng})"; } else { if ($location != '') { $i = 1; //$condition .= " AND (`address` LIKE '%".$pieces[0]."%')"; $condition .= " AND ((`address` LIKE '%" . $pieces[0] . "%') OR (`state` LIKE '%" . $pieces[0] . "%') OR (`city` LIKE '%" . $pieces[0] . "%') OR (`country` LIKE '%" . $pieces[0] . "%') OR (`desc` LIKE '%" . $pieces[0] . "%') OR (`room_type` LIKE '%" . $pieces[0] . "%') OR (`title` LIKE '%" . $pieces[0] . "%') )"; } } if (!empty($min_bedrooms)) { $condition .= " AND (`bedrooms` = '" . $min_bedrooms . "')"; } if ($property_type != 0) { $condition .= " AND (`property_id` = '" . $property_type . "')"; } if (!empty($min_bathrooms)) { $condition .= " AND (`bathrooms` = '" . $min_bathrooms . "')"; } if (!empty($min_beds)) { $condition .= " AND (`beds` = '" . $min_beds . "')"; } if (!empty($instance_book)) { $condition .= " AND (`instance_book` = '1')"; } if (!empty($min_bed_type)) { $condition .= " AND (`bed_type` = '" . $min_bed_type . "')"; } if (!empty($stack)) { $condition .= " AND (`id` NOT IN(" . implode(',', $stack) . "))"; } if ($nof_guest > 1) { $condition .= " AND (`capacity` >= '" . $nof_guest . "')"; } if (is_array($room_types)) { if (count($room_types) > 0) { $i = 1; foreach ($room_types as $room_type) { if ($i == count($room_types)) { $and = ""; } else { $and = " AND "; } $or = " OR "; if ($i == 1) { $condition .= " AND ("; } $condition .= "`room_type` LIKE '%" . $room_type . "%'" . $or . "`neighbor` = '" . $room_type . "'" . $or . "`neighbor` = '" . $room_type . "'" . $or . "`room_type` = '" . $room_type . "'" . $or . "`room_type` = '" . $room_type . "'" . $and; if ($i == count($room_types)) { $condition .= ")"; } $i++; } } } if (is_array($hosting_amenities)) { if (count($hosting_amenities) > 0) { $i = 1; foreach ($hosting_amenities as $amenity) { if ($i == count($hosting_amenities)) { $and = ""; } else { $and = " AND "; } if ($i == 1) { $condition .= " AND ("; } $condition .= "`amenities` LIKE '%" . $amenity . "%'" . $and; if ($i == count($hosting_amenities)) { $condition .= ")"; } $i++; } } } if (is_array($property_type_id)) { if (count($property_type_id) > 0) { $i = 1; foreach ($property_type_id as $property_id) { if ($i == count($property_type_id)) { $and = ""; } else { $and = " OR "; } if ($i == 1) { $condition .= " AND ("; } $condition .= "`property_id` = '" . $property_id . "'" . $and; if ($i == count($property_type_id)) { $condition .= ")"; } $i++; } } } if (!empty($keywords)) { $keywords = $this->db->escape_like_str($keywords); $condition .= " AND (`address` LIKE '%" . $keywords . "%' OR `title` LIKE '%" . $keywords . "%' OR `desc` LIKE '%" . $keywords . "%')"; } //Final query $condition .= " AND (`status` != '0') AND (`user_id` != '0') AND (`address` != '0') AND (`is_enable` = '1') AND (`banned` = '0')"; // Get offset and limit for page viewing $start = (int) $page; // Number of record showing per page $per_page = 20; if ($start > 0) { $offset = ($start - 1) * $per_page; } else { $offset = $start * $per_page; } if ($sort == 2) { $order = "ORDER BY price ASC"; } else { if ($sort == 3) { $order = "ORDER BY price DESC"; } else { if ($sort == 4) { $order = "ORDER BY id DESC"; } else { $order = "ORDER BY id ASC"; } } } $query_status = $this->db->where($condition)->get('list'); if ($query_status->num_rows() != 0) { foreach ($query_status->result() as $row_status) { $result_status = $this->db->where('id', $row_status->id)->get('lys_status'); if ($result_status->num_rows() != 0) { $result_status = $result_status->row(); $total = $result_status->calendar + $result_status->price + $result_status->overview + $result_status->photo + $result_status->address + $result_status->listing; if ($total != 6) { $condition .= " AND (`id` != '" . $row_status->id . "')"; } } } } if ($min == '' && $max == '') { } else { $query_price = $this->db->where($condition)->get('list'); if ($query_price->num_rows() != 0) { foreach ($query_price->result() as $row_price) { $check_price = get_currency_value1($row_price->id, $row_price->price); $max = get_currency_value_lys(get_currency_code(), 'USD', $max); if ($max == 10000) { $max = $max * 1000000000; $max = get_currency_value1($row_price->id, $max); } else { $max = get_currency_value_lys('USD', get_currency_code(), $max); } //echo $max. ' - '.$check_price;exit; if ($this->input->get('new_search')) { if ($check_price <= $max && $check_price >= $min) { } else { $condition .= " AND (`id` != '" . $row_price->id . "')"; } } else { if ($check_price <= $max || $check_price >= $min) { } else { $condition .= " AND (`id` != '" . $row_price->id . "')"; } } } } } //My ShortLists if ($search_view == 2) { $constraint = ""; $shortlists = $this->db->where('id', $this->dx_auth->get_user_id())->get('users')->row()->shortlist; $my_lists = explode(',', $shortlists); $i = 1; foreach ($my_lists as $list) { if ($i == count($my_lists)) { $OR = ""; } else { $OR = " OR "; } $data['query'] = $this->db->query("SELECT * FROM (`list`) WHERE {$condition} {$order} LIMIT {$offset},{$per_page}"); if ($data['query']->num_rows() != 0) { foreach ($data['query']->result() as $row) { if ($row->id == $list) { $constraint .= "`id`= '" . $list . "'" . $OR; } else { } } } $i++; } if ($constraint == '') { $data['query'] = $this->db->query("SELECT * FROM (`list`) where {$condition} AND id=0 {$order} LIMIT {$offset},{$per_page}"); $total_rows = 0; } else { $data['query'] = $this->db->query("SELECT * FROM (`list`) where {$condition} AND {$constraint} {$order} LIMIT {$offset},{$per_page}"); $total_rows = $this->db->query("SELECT * FROM (`list`) where {$condition} AND {$constraint}")->num_rows(); } } else { $data['query'] = $this->db->query("SELECT * FROM (`list`) WHERE {$condition} {$order} LIMIT {$offset},{$per_page}"); $this->session->unset_userdata('query'); $this->session->set_userdata('query', "SELECT * FROM (`list`) WHERE {$condition} ORDER BY id DESC"); $total_rows = $this->db->query("SELECT * FROM (`list`) WHERE {$condition}")->num_rows(); } //echo $this->db->last_query();exit; $config['base_url'] = site_url('search') . '?checkin=' . urlencode($checkin) . '&checkout=' . urlencode($checkout) . '&guests=' . $nof_guest . '&location=' . urlencode($location) . '&min_bathrooms=' . $min_bathrooms . '&min_bedrooms=' . $min_bedrooms . '&min_beds=' . $min_beds . '&min_bed_type=' . $min_bed_type . '&per_page=' . $per_page . '&search_view=1&sort=' . $sort . '&lat=' . $lat . '&lng=' . $lng; $config['per_page'] = $per_page; $config['cur_page'] = $start; $config['total_rows'] = $total_rows; $this->ajax_pagination->initialize($config); $pagination = $this->ajax_pagination->create_links(false); $tCount = $data['query']->num_rows(); $properties = ''; $sno = 1; foreach ($data['query']->result() as $row) { //main photo $url = getListImage($row->id); //for map slider full list images $images = $this->Gallery->get_imagesG($row->id); $picture_ids = ''; foreach ($images->result() as $image) { $picture_ids .= '"' . $image->list_id . '/' . $image->name . '",'; } $profile_pic = $this->Gallery->profilepic($row->user_id, 2); if ($tCount == $sno) { $comma = ''; } else { $comma = ','; } $neighbor = $row->neighbor; $final_price = get_currency_value1($row->id, $row->price); if ($final_price <= $max && $final_price >= $min) { } /*Offer price calculate*/ if ($checkin != '--' && $checkout != '--' && $checkin != "yy-mm-dd" && $checkout != "yy-mm-dd") { $daysdiff = (strtotime($checkout) - strtotime($checkin)) / (60 * 60 * 24); } //My shortlist $short_listed = 0; $cur_user_id = $this->dx_auth->get_user_id(); if ($cur_user_id) { $wishlist_result = $this->Common_model->getTableData('user_wishlist', array('user_id' => $cur_user_id)); if ($wishlist_result->num_rows() != 0) { foreach ($wishlist_result->result() as $wishlist) { if ($wishlist->list_id == $row->id) { $short_listed = 1; } } } } ///// review count $conditions_starrev = array('list_id' => $row->id, 'userto' => $row->user_id); $result_rev = $this->Trips_model->get_review($conditions_starrev); $overall_review_count = $result_rev->num_rows(); ////// star rating display $conditions_star = array('list_id' => $row->id, 'userto' => $row->user_id); $data['stars'] = $this->Trips_model->get_review_sum($conditions_star)->row(); if ($overall_review_count > 0) { $accuracy = $data['stars']->accuracy * 2 * 10 / $overall_review_count; $cleanliness = $data['stars']->cleanliness * 2 * 10 / $overall_review_count; $communication = $data['stars']->communication * 2 * 10 / $overall_review_count; $checkin = $data['stars']->checkin * 2 * 10 / $overall_review_count; $location = $data['stars']->location * 2 * 10 / $overall_review_count; $value = $data['stars']->value * 2 * 10 / $overall_review_count; $overall = ($accuracy + $cleanliness + $communication + $checkin + $location + $value) / 6; } else { $overall = 0; } /*$slider = '<ul class="rslides" id="slider'.$row->id.'">'; $conditions = array("list_id" =>$row->id); $image = $this->Gallery->get_imagesG(NULL, $conditions); $j = 0; if($image->num_rows() != 0) { foreach($image->result() as $image_list) { $j++; $image = base_url()."images/".$image_list->list_id."/".$image_list->name; $slider .='<li data="'.$j.'"> <img width="216" height="144" data="'.$j.'" alt="" src="'.$image.'" style="position: absolute; top: 0px; left: 0px; z-index: 2; opacity: 1;height:130px !important"> </li>'; } } $slider .= '</ul>';*/ /*end of offer calculate */ // Discount label 1 start //echo $instance_book; exit; $dis_price = $this->Common_model->getTableData('price', array('id' => $row->id))->row(); $d_price = $dis_price->previous_price; if ($dis_price->night < $d_price) { $discount_amt = ($d_price - $dis_price->night) / $d_price * 100; $discount = round($discount_amt) . '%'; } else { $discount = 0; } // Discount label 1 end $properties .= '{ "user_thumbnail_url":"' . $profile_pic . '", "user_is_superhost":false, "lat":' . $row->lat . ', "has_video":false, "room_type":"' . $row->room_type . '", "recommendation_count":0, "lng":' . $row->long . ', "user_id":' . $row->user_id . ', "user_name":"' . get_user_by_id($row->user_id)->username . '", "symbol":"' . get_currency_symbol($row->id) . '", "currency_code":"' . get_currency_code() . '", "review_count":' . $row->review . ', "address":"' . $row->address . '", ' . ' "discount":"' . $discount . '", ' . ' "state":"' . $row->state . '", "city":"' . $row->city . '", "instant_book":"' . $row->instance_book . '", "name":"' . $row->title . '", "picture_ids":[' . substr($picture_ids, 0, -1) . '], "hosting_thumbnail_url":"' . $url . '", "id":' . $row->id . ', "page_viewed":' . $row->page_viewed . ', "price":' . $final_price . ', ' . ' ' . ' "short_listed":' . $short_listed . ' }' . $comma; // Discount label 1 end (Replace) $sno++; } $startlist = 1 + $offset; $endlist = $offset + $per_page; if ($total_rows == 0) { $startlist = 0; } if ($endlist > $total_rows) { $endlist = $total_rows; } $ajax_result = '{ "results_count_html":"\\n<b>' . $startlist . ' – ' . $endlist . '</b> of <b>' . $total_rows . ' Rentals</b>", "results_count_top_html":" ' . $total_rows . ' ' . translate('Rentals') . ' - ' . $pieces[0] . '\\n", "view_type":' . $search_view . ', "results_pagination_html":"' . $pagination . '\\n", "present_standby_option":false, "lat":"' . $lat . '", "lng":"' . $lng . '", "properties":['; $ajax_result .= $properties; $ajax_result .= '], "banner_info":{} }'; echo $ajax_result; }
?> </div> <div class="line_reg" style="z-index:<?php echo $j; ?> ;" id="square_<?php echo $i; ?> "> <span class="startcap"></span> <span class="content"></span> <span class="endcap"><b><?php echo get_currency_symbol($list_id) . get_currency_value1($list_id, $price); ?> </b></span> </div> <!--Edit calender ---> <?php echo get_currency_symbol($list_id) . get_currency_value_lys($listcurrency, get_currency_code(), $price); ?> </b></span> </div> <!--edit calender --> </div> </div> <?php } ?> <?php $day_count++; $day_nextmonth++; $i++;
</span> </p> <div class="clear"></div> </div> <div id="payment_method_2c" class="payment_method_content<?php echo $show2C; ?> "> <h2><?php echo translate("Credit Card"); ?> </h2> <div class="currency_alert"><?php echo translate("This payment transacts in"); ?> <?php echo get_currency_symbol1() . get_currency_code(); ?> . <?php echo translate("Your total charge is"); ?> <?php echo get_currency_symbol1() . $amt; ?> .</div> <div class="two_c_explanation col-md-2 col-sm-5 col-xs-5"></div> <p class="payment_method_explanation col-md-10 col-sm-7 col-xs-7"> <span class="paypallogo"><?php echo translate("Instructions:"); ?> </span> <br> <?php echo translate("After clicking 'Book it' you will be redirected to Braintree to complete payment.");
public function modify_calendar() { if ($this->dx_auth->is_logged_in() || $this->facebook_lib->logged_in()) { /* $from = $this->input->post('from'); $to = $this->input->post('to'); $amount = $this->input->post('amount'); $min_currency= round(get_currency_value_lys($from,$to,$amount)); echo $min_currency; */ //Seasonal Price $availability = $this->input->post('availability'); $pricevalue = $this->input->post('seasonal_price'); $id = $this->input->post('hosting_id'); echo $id; $cur_code = $this->db->where('id', $id)->from('list')->get()->row()->currency; $cur_val = $this->db->where('currency_code', $cur_code)->from('currency_converter')->get()->row()->currency_value; $currency_value = round($cur_val * 10); $currency_maxvalue = $currency_value * 1000; echo $currency_maxvalue; if ($availability == "Available" && $pricevalue != "" && $pricevalue >= $currency_value && $pricevalue <= $currency_maxvalue) { $month = $this->input->get('month', TRUE); $year = $this->input->get('year', TRUE); $startdate = $this->input->post('starting_date'); $starttime = get_gmt_time(strtotime($startdate)); $enddate = $this->input->post('stopping_date'); $endtime = get_gmt_time(strtotime($enddate)); $pdata = array('list_id' => $this->input->post('hosting_id'), 'price' => $this->input->post('seasonal_price'), 'start_date' => $starttime, 'end_date' => $endtime, 'currency' => $cur_code); // print_r($pdata); // echo $pricevalue;echo $availability; $update = 0; $query = $this->Common_model->getTableData('seasonalprice', array('list_id' => $pdata['list_id'])); $res = $query->result_array(); $count = 1; foreach ($res as $row) { $from = $row['start_date']; $to = $row['end_date']; if ($starttime == $from && $endtime == $to) { $condition = array('list_id' => $pdata['list_id'], 'start_date' => $from, 'end_date' => $to); $updatedata = array('price' => $pdata['price']); $this->Common_model->updateTableData('seasonalprice', NULL, $condition, $updatedata); $update = 1; } else { if ($starttime == $from && $endtime == $from) { //update $starttime_update = get_gmt_time(strtotime('+1 day', $starttime)); $condition = array('list_id' => $pdata['list_id'], 'start_date' => $from, 'end_date' => $to); $updatedata = array('start_date' => $starttime_update); $this->Common_model->updateTableData('seasonalprice', NULL, $condition, $updatedata); //insert $insertdata1 = array('list_id' => $this->input->post('hosting_id'), 'price' => $this->input->post('seasonal_price'), 'start_date' => $starttime, 'end_date' => $endtime, 'currency' => get_currency_code()); $this->db->insert('seasonalprice', $insertdata1); $update = 1; } else { if ($starttime == $to && $endtime == $to) { //update $endtime_update = get_gmt_time(strtotime('-1 day', $endtime)); $condition = array('list_id' => $pdata['list_id'], 'start_date' => $from, 'end_date' => $to); $updatedata = array('end_date' => $endtime_update); $this->Common_model->updateTableData('seasonalprice', NULL, $condition, $updatedata); //insert $insertdata1 = array('list_id' => $this->input->post('hosting_id'), 'price' => $this->input->post('seasonal_price'), 'start_date' => $starttime, 'end_date' => $endtime, 'currency' => get_currency_code()); $this->db->insert('seasonalprice', $insertdata1); $update = 1; } else { if ($starttime > $from && $starttime < $to && ($endtime > $from && $endtime < $to)) { //update $endtime_update = get_gmt_time(strtotime('+1 day', $endtime)); $condition = array('list_id' => $pdata['list_id'], 'start_date' => $from, 'end_date' => $to); $updatedata = array('start_date' => $endtime_update); $this->Common_model->updateTableData('seasonalprice', NULL, $condition, $updatedata); //insert 1 $starttime_update = get_gmt_time(strtotime('-1 day', $starttime)); $insertdata1 = array('list_id' => $this->input->post('hosting_id'), 'price' => $row['price'], 'start_date' => $row['start_date'], 'end_date' => $starttime_update, 'currency' => get_currency_code()); $this->db->insert('seasonalprice', $insertdata1); //insert 2 $insertdata1 = array('list_id' => $this->input->post('hosting_id'), 'price' => $this->input->post('seasonal_price'), 'start_date' => $starttime, 'end_date' => $endtime, 'currency' => get_currency_code()); $this->db->insert('seasonalprice', $insertdata1); $update = 1; } else { if ($starttime <= $from && $starttime < $to && ($endtime > $from && $endtime < $to) || $starttime < $from && $starttime < $to && $endtime == $from) { //update $endtime_update = get_gmt_time(strtotime('+1 day', $endtime)); $condition = array('list_id' => $pdata['list_id'], 'start_date' => $from, 'end_date' => $to); $updatedata = array('start_date' => $endtime_update); $this->Common_model->updateTableData('seasonalprice', NULL, $condition, $updatedata); //insert 1 $insertdata1 = array('list_id' => $this->input->post('hosting_id'), 'price' => $this->input->post('seasonal_price'), 'start_date' => $starttime, 'end_date' => $endtime, 'currency' => get_currency_code()); $this->db->insert('seasonalprice', $insertdata1); $update = 1; } else { if ($starttime > $from && $starttime < $to && ($endtime > $from && $endtime >= $to) || $starttime == $to && ($endtime > $from && $endtime > $to)) { //update $starttime_update = get_gmt_time(strtotime('-1 day', $starttime)); $condition = array('list_id' => $pdata['list_id'], 'start_date' => $from, 'end_date' => $to); $updatedata = array('end_date' => $starttime_update); $this->Common_model->updateTableData('seasonalprice', NULL, $condition, $updatedata); //insert 1 $insertdata1 = array('list_id' => $this->input->post('hosting_id'), 'price' => $this->input->post('seasonal_price'), 'start_date' => $starttime, 'end_date' => $endtime, 'currency' => get_currency_code()); $this->db->insert('seasonalprice', $insertdata1); $update = 1; } else { if ($starttime < $from && $starttime < $to && ($endtime > $from && $endtime > $to) || $starttime == $from && $endtime > $to & $startime < $to || $starttime < $from && $starttime < $to && $endtime == $to) { //Delete $condition = array('list_id' => $pdata['list_id'], 'start_date' => $from, 'end_date' => $to); $this->Common_model->deleteTableData('seasonalprice', $condition); //insert 1 if ($count == 1) { $insertdata1 = array('list_id' => $this->input->post('hosting_id'), 'price' => $this->input->post('seasonal_price'), 'start_date' => $starttime, 'end_date' => $endtime, 'currency' => get_currency_code()); $this->db->insert('seasonalprice', $insertdata1); } $update = 1; } } } } } } } $count++; } if ($update == 0) { $this->db->insert('seasonalprice', $pdata); } } elseif ($availability == "Available" && $pricevalue < $currency_value) { exit; } elseif ($availability == "Available" && $pricevalue >= $currency_maxvalue) { exit; } elseif ($availability != "Available" && $this->input->post('notes') == 'Notes...') { exit; } $day = date("d"); $month = $this->input->get('month', TRUE); $year = $this->input->get('year', TRUE); $booked_from = $this->input->post('starting_date_original'); $booked_to = $this->input->post('stopping_date_original'); $list_id = $this->input->post('hosting_id'); $grouping_uid = $this->input->post('grouping_uid'); $insertData = array('list_id' => $this->input->post('hosting_id'), 'availability' => $this->input->post('availability'), 'value' => $this->input->post('value_native'), 'currency' => $this->input->post('currency'), 'notes' => rawurlencode($this->input->post('notes')), 'booked_using' => $this->input->post('booking_service')); if (!empty($grouping_uid)) { if ($insertData['availability'] == 'Available') { $conditions = array('group_id' => $grouping_uid); $this->Trips_model->delete_calendar(NULL, $conditions); } else { if ($insertData['availability'] == 'Booked') { $updateKey = array('group_id' => $grouping_uid); $updateData = $insertData; $this->Trips_model->update_calendar($updateKey, $updateData); } else { $updateKey = array('group_id' => $grouping_uid); $updateData = $insertData; $this->Trips_model->update_calendar($updateKey, $updateData); } } } else { if ($insertData['availability'] == 'Booked' || $insertData['availability'] == 'Not Available') { $this->db->select_max('group_id'); $group_id = $this->db->get('calendar')->row()->group_id; if (empty($group_id)) { echo $countJ = 0; } else { $countJ = $group_id; } $insertData['group_id'] = $countJ + 1; $days = getDaysInBetweenC($booked_from, $booked_to); $count = count($days); $i = 1; foreach ($days as $val) { if ($count == 1) { $insertData['style'] = 'single'; } else { if ($count > 1) { if ($i == 1) { $insertData['style'] = 'left'; } else { if ($count == $i) { $insertData['notes'] = ''; $insertData['style'] = 'right'; } else { $insertData['notes'] = ''; $insertData['style'] = 'both'; } } } } $insertData['booked_days'] = get_gmt_time(strtotime($val)); $insertData['created'] = local_to_gmt(); $this->Trips_model->insert_calendar($insertData); $i++; } } } $first_day = mktime(0, 0, 0, $month, 1, $year); $days_in_month = cal_days_in_month(0, $month, $year); $day_of_week = date('N', $first_day); $months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); $title = $months[$month - 1]; if ($day_of_week == 7) { $blank = 0; } else { $blank = $day_of_week; } if ($month - 1 == 0) { $prevmonth = 1; $prevyear = $year - 1; } else { $prevmonth = $month - 1; $prevyear = $year; } $day_prevmonth = cal_days_in_month(0, $prevmonth, $prevyear) - ($blank - 1); if ($month == 01) { $prev_month = 12; $prev_year = $year - 1; } else { $prev_month = $month - 1; $prev_year = $year; } if ($month == 12) { $next_month = 01; $next_year = $year + 1; } else { $next_month = $month + 1; $next_year = $year; } $day_num = 1; $day_count = 1; $datenow = time(); $monthnow = date('n', $datenow); $yearnow = date('Y', $datenow); $daynow = date('j', $datenow); $schedules = ''; $firstDay = $prev_year . '-' . $prev_month . '-' . $day_prevmonth; $conditions = array('list_id' => $list_id); $result = $this->Trips_model->get_calendar($conditions)->result(); //Previous Months Days while ($blank > 0) { $full_date = $prev_month . '/' . $day_prevmonth . '/' . $prev_year; $pre_schedules = '{cl: "av", sty: "both", isa: 1},'; foreach ($result as $row) { if (get_gmt_time(strtotime($full_date)) == $row->booked_days) { $pre_schedules = '{cl: "tp", sty: "' . $row->style . '", isa: 0, id: ' . $row->id . ', notes: "' . $row->notes . '", st: 4, sst: "' . $row->booked_using . '", gid: ' . $row->group_id . ', reservation_value: ' . $row->value . '},'; } } $schedules .= $pre_schedules; $blank = $blank - 1; $day_count++; $day_prevmonth++; } //Current Months Days while ($day_num <= $days_in_month) { $full_date = $month . '/' . $day_num . '/' . $year; $pre_schedules = '{cl: "av", sty: "both", isa: 1},'; foreach ($result as $row) { if (get_gmt_time(strtotime($full_date)) == $row->booked_days) { if ($row->value != '') { $value = ', reservation_value: ' . $row->value; } else { $value = ''; } if ($row->availability == 'Not Available') { $c1 = 'bs'; $st = 2; } else { $c1 = 'tp'; $st = 4; } $pre_schedules = '{cl: "' . $c1 . '", sty: "' . $row->style . '", isa: 0, id: ' . $row->id . ', notes: "' . $row->notes . '", st: ' . $st . ', sst: "' . $row->booked_using . '", gid: ' . $row->group_id . $value . '},'; } } $schedules .= $pre_schedules; $day_num++; $day_count++; if ($day_count > 7) { $day_count = 1; } } //Next Months Days $day_nextmonth = 1; while ($day_count > 1 && $day_count <= 7) { $full_date = $next_month . '/' . $day_nextmonth . '/' . $next_year; $pre_schedules = '{cl: "av", sty: "both", isa: 1},'; foreach ($result as $row) { if (get_gmt_time(strtotime($full_date)) == $row->booked_days) { if ($row->value != '') { $value = ', reservation_value: ' . $row->value; } else { $value = ''; } if ($row->availability == 'Not Available') { $c1 = 'bs'; $st = 2; } else { $c1 = 'tp'; $st = 4; } $pre_schedules = '{cl: "' . $tp . '", sty: "' . $row->style . '", isa: 0, id: ' . $row->id . ', notes: "' . $row->notes . '", st: ' . $st . ', sst: "' . $row->booked_using . '", gid: ' . $row->group_id . $value . '},'; } } $schedules .= $pre_schedules; $day_count++; $day_nextmonth++; } echo 'update_calendar_data(0, ' . $list_id . ', [[' . substr($schedules, 0, -1) . ']]); after_submit();'; } else { redirect('users/signin'); } }
public function braintree_success() { $result = Braintree_Transaction::sale(array('amount' => get_currency_value_lys(get_currency_code(), 'USD', $this->session->userdata('list_commission')), "paymentMethodNonce" => $_POST['payment_method_nonce'], 'options' => array('submitForSettlement' => true))); $transaction = $result->transaction; /* if($result->success == 1) { if($result->message == "Amount must be greater than zero.") { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error',$result->message)); redirect('rooms/'.$this->input->post('custom',true), "refresh"); } */ if (!$this->dx_auth->is_logged_in() || !$this->facebook_lib->logged_in()) { //$this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error',translate('Session expired, please try again.'))); //redirect('users/signin'); } if ($transaction->status == "authorized" || $transaction->status == "submitted_for_settlement") { $listId = $this->input->post('custom', true); $condition = array('id' => $listId); $data['status'] = 1; $data['list_pay'] = 1; $data['is_enable'] = 1; $data['payment'] = 1; $this->Common_model->updateTableData('list', NULL, $condition, $data); if (!$this->dx_auth->is_logged_in() || !$this->facebook_lib->logged_in()) { //$this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error',translate('Session expired, please try again.'))); //redirect('users/signin'); } $query_user = $this->Common_model->getTableData('users', array('id' => $this->dx_auth->get_user_id()))->row(); $username = $query_user->username; $insertData = array('list_id' => $listId, 'conversation_id' => $listId, 'userby' => $this->dx_auth->get_user_id(), 'userto' => 1, 'message' => "{$username} created a new list.", 'created' => time(), 'message_type ' => 10); $this->Message_model->sentMessage($insertData); $host_email = $query_user->email; $admin_email = $this->dx_auth->get_site_sadmin(); $admin_name = $this->dx_auth->get_site_title(); $admin_to_email = $this->Common_model->getTableData('users', array('id' => 1))->row()->email; $query_list = $this->Common_model->getTableData('list', array('id' => $listId))->row(); $currency = $query_list->currency; $price = $query_list->price; $title = $query_list->title; $link = base_url() . 'rooms/' . $listId; $email_name = 'list_create_host'; $splVars = array("{host_name}" => $username, "{price}" => $currency . $price, "{link}" => $link, "{list_title}" => $title, "{site_name}" => $this->dx_auth->get_site_title()); $this->Email_model->sendMail($host_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); $email_name = 'list_create_admin'; $splVars = array("{host_name}" => $username, "{price}" => $currency . $price, "{link}" => $link, "{list_title}" => $title, "{site_name}" => $this->dx_auth->get_site_title()); $this->Email_model->sendMail($admin_to_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); $data_listpay['list_id'] = $listId; $data_listpay['amount'] = $this->session->userdata('list_commission'); $data_listpay['currency'] = get_currency_code(); $data_listpay['created'] = time(); $this->db->insert('list_pay', $data_listpay); $data['title'] = "Payment Success !"; $data['message_element'] = "payments/paypal_success"; $this->load->view('template', $data); //redirect('rooms/edit/'.$listId, 'refresh'); //$this->session->set_flashdata('flash_message', $this->Common_model->flash_message('success',translate('Rooms added successfully.'))); //redirect('rooms/'.$listId, 'refresh'); } else { $data['title'] = "Payment Cancelled !"; $data['message_element'] = "payments/paypal_cancel"; $this->load->view('template', $data); } /* } else { $data['title']="Payment Cancelled !"; $data['message_element'] = "payments/paypal_cancel"; $this->load->view('template',$data); } */ }
function braintree_success() { $result = Braintree_Transaction::sale(array('amount' => get_currency_value_lys(get_currency_code(), 'USD', $this->session->userdata('subtotal')), "paymentMethodNonce" => $_POST['payment_method_nonce'], 'options' => array('submitForSettlement' => true))); $transaction = $result->transaction; if ($transaction->status == "authorized" || $transaction->status == "submitted_for_settlement") { $custom = $this->session->userdata('custom'); $data = array(); $list = array(); $data = explode('@', $custom); $contact_key = $data[9]; $list['list_id'] = $data[0]; $list['userby'] = $data[1]; $query1 = $this->Common_model->getTableData('list', array('id' => $list['list_id'])); $buyer_id = $query1->row()->user_id; $list['userto'] = $buyer_id; $list['checkin'] = $data[2]; $list['checkout'] = $data[3]; $list['no_quest'] = $data[4]; $date1 = new DateTime(date('Y-m-d H:i:s', $list['checkin'])); $date2 = new DateTime(date('Y-m-d H:i:s', $list['checkout'])); $interval = $date1->diff($date2); if ($interval->days >= 28) { $list['policy'] = 5; } else { $list['policy'] = $query1->row()->cancellation_policy; } $amt = $data[14]; $list['transaction_id'] = "{$transaction->id}"; $list['price'] = $this->session->userdata('subtotal'); $currency = $data[15]; $list['payment_id'] = 2; $list['credit_type'] = 1; $is_travelCretids = $data[5]; $user_travel_cretids = $data[6]; $list['currency'] = get_currency_code(); if ($currency != 'USD') { $list['admin_commission'] = $data[8]; $list['cleaning'] = $data[10]; $list['security'] = $data[11]; $list['topay'] = $amt - $data[8]; } else { $list['admin_commission'] = $data[8]; $list['cleaning'] = $data[10]; $list['security'] = $data[11]; $list['topay'] = $amt - $data[8]; } $list['guest_count'] = $data[13]; if ($list['no_quest'] > $list['guest_count']) { if ($currency != 'USD') { $list['extra_guest_price'] = $data[12]; } else { $list['extra_guest_price'] = $data[12]; } } if ($this->session->userdata('contact_key') != '') { $updateKey = array('contact_key' => $this->session->userdata('contact_key')); $updateData = array(); $list['contacts_offer'] = $this->session->userdata('contacts_offer'); $updateData['status'] = 10; $this->Contacts_model->update_contact($updateKey, $updateData); } if ($contact_key != "None") { $list['status'] = 1; $this->db->select_max('group_id'); $group_id = $this->db->get('calendar')->row()->group_id; if (empty($group_id)) { echo $countJ = 0; } else { $countJ = $group_id; } $insertData['list_id'] = $list['list_id']; $insertData['group_id'] = $countJ + 1; $insertData['availability'] = 'Booked'; $insertData['booked_using'] = 'Other'; $checkin = date('m/d/Y', $list['checkin']); $checkout = date('m/d/Y', $list['checkout']); $days = getDaysInBetween($checkin, $checkout); $count = count($days); $i = 1; foreach ($days as $val) { if ($count == 1) { $insertData['style'] = 'single'; } else { if ($count > 1) { if ($i == 1) { $insertData['style'] = 'left'; } else { if ($count == $i) { $insertData['notes'] = ''; $insertData['style'] = 'right'; } else { $insertData['notes'] = ''; $insertData['style'] = 'both'; } } } } $insertData['booked_days'] = $val; $this->Trips_model->insert_calendar($insertData); $i++; } } else { $listid1 = $list['list_id']; $instance_book = $this->db->where('id', $listid1)->get('list')->row()->instance_book; //echo $this->db->last_query(); if ($instance_book == 1) { $list['status'] = 3; } else { $list['status'] = 1; } } if ($list['price'] > $rent) { $user_id = $list['userby']; $details = $this->Referrals_model->get_details_by_Iid($user_id); $row = $details->row(); $count = $details->num_rows(); if ($count > 0) { $details1 = $this->Referrals_model->get_details_refamount($row->invite_from); $amt_check2 = $this->db->where('id', $row->invite_from)->get('users'); $user = $this->Users_model->get_user_by_id($this->dx_auth->get_user_id())->row(); $trip1 = $user->ref_trip; $rent1 = $user->ref_rent; if ($amt_check2->num_rows() == 0) { $insertData = array(); $insertData['user_id'] = $row->invite_from; $insertData['count_trip'] = 1; $insertData['amount'] = $trip1; $this->Referrals_model->insertReferralsAmount($insertData); } else { $count_trip = $amt_check2->row()->count_trip; $amount = $amt_check2->row()->amount; $updateKey = array('id' => $row->id); $updateData = array(); $updateData['count_trip'] = $count_trip + 1; $updateData['amount'] = $amount + $trip1; $this->Referrals_model->updateReferralsAmount($updateKey, $updateData); } } } $q = $query1->result(); $row_list = $query1->row(); $iUser_id = $q[0]->user_id; $details2 = $this->Referrals_model->get_details_by_Iid($iUser_id); $row = $details2->row(); $count = $details2->num_rows(); if ($count > 0) { $user = $this->Users_model->get_user_by_id($this->dx_auth->get_user_id())->row(); $trip1 = $user->ref_trip; $rent1 = $user->ref_rent; $details3 = $this->Referrals_model->get_details_refamount($row->invite_from); $amt_check3 = $this->db->where('id', $row->invite_from)->get('users'); if ($amt_check3->num_rows() == 0) { $insertData = array(); $insertData['user_id'] = $row->invite_from; $insertData['count_book'] = 1; $insertData['amount'] = $rent1; $this->Referrals_model->insertReferralsAmount($insertData); } else { $count_book = $amt_check3->row()->count_book; $amount = $amt_check3->row()->amount; $updateKey = array('id' => $row->id); $updateData = array(); $updateData['count_trip'] = $count_book + 1; $updateData['amount'] = $amount + $rent1; $this->Referrals_model->updateReferralsAmount($updateKey, $updateData); } } $admin_email = $this->dx_auth->get_site_sadmin(); $admin_name = $this->dx_auth->get_site_title(); $query3 = $this->Common_model->getTableData('users', array('id' => $list['userby'])); $rows = $query3->row(); $username = $rows->username; $user_id = $rows->id; $email_id = $rows->email; $query4 = $this->Users_model->get_user_by_id($buyer_id); $buyer_name = $query4->row()->username; $buyer_email = $query4->row()->email; //Check md5('No Travel Cretids') || md5('Yes Travel Cretids') if ($is_travelCretids == '7c4f08a53f4454ea2a9fdd94ad0c2eeb') { $query5 = $this->Referrals_model->get_details_refamount($user_id); $amount = $query5->row()->amount; $updateKey = array('user_id ' => $user_id); $updateData = array(); $updateData['amount'] = $amount - $user_travel_cretids; $this->Referrals_model->updateReferralsAmount($updateKey, $updateData); $list['credit_type'] = 2; $list['ref_amount'] = $user_travel_cretids; $row = $query4->row(); //sent mail to administrator $email_name = 'tc_book_to_admin'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $user_travel_cretids + $list['price'], "{payed_amount}" => $list['price'], "{travel_credits}" => $user_travel_cretids, "{host_name}" => ucfirst($buyer_name), "{host_email_id}" => $buyer_email); //Send Mail $this->Email_model->sendMail($admin_email, $email_id, ucfirst($username), $email_name, $splVars); //sent mail to buyer $email_name = 'tc_book_to_host'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{username}" => ucfirst($buyer_name), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $list['price']); //Send Mail if ($buyer_email != '0') { $this->Email_model->sendMail($buyer_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); } } $list['book_date'] = local_to_gmt(); if ($this->session->userdata('coupon_code_used') == 1) { $list['coupon'] = $this->session->userdata('coupon_code'); $this->db->where('couponcode', $list['coupon'])->update('coupon', array('status' => 1)); $this->db->where('used_coupon_code', $list['coupon'])->update('coupon_users', array('status' => 1)); $this->session->unset_userdata('coupon_code'); $this->session->unset_userdata('coupon_code_used'); } else { $list['coupon'] = 0; } //Actual insertion into the database $this->Common_model->insertData('reservation', $list); $reservation_id = $this->db->insert_id(); $reservation_result = $this->Common_model->getTableData('reservation', array('id' => $reservation_id))->row(); $currency_symbol = $this->Common_model->getTableData('currency', array('currency_code' => $reservation_result->currency))->row()->currency_symbol; $price = $reservation_result->currency . ' ' . $currency_symbol . $reservation_result->price; $host_price = $reservation_result->currency . ' ' . $currency_symbol . $reservation_result->topay; if ($interval->days >= 28) { $conversation = $this->db->where('userto', $list['userto'])->where('userby', $list['userby'])->order_by('id', 'desc')->get('messages'); $conversation1 = $this->db->where('userto', $list['userby'])->where('userby', $list['userto'])->order_by('id', 'desc')->get('messages'); if ($conversation->num_rows() != 0) { $conversation_id = $conversation->row()->id; } elseif ($conversation1->num_rows() != 0) { $conversation_id = $conversation1->row()->id; } else { $conversation_id = $reservation_id . '1'; } //Send Message Notification $insertData = array('list_id' => $list['list_id'], 'reservation_id' => $reservation_id, 'conversation_id' => $conversation_id, 'userby' => 1, 'userto' => $list['userby'], 'message' => "Your reservation is 28 days or more. So, Long Term cancellation policy applied for " . $row_list->title, 'created' => local_to_gmt(), 'message_type' => 3); $this->Message_model->sentMessage($insertData, $isCoversation = 0, ucfirst($buyer_name), ucfirst($username), $row_list->title, $reservation_id); //Send Message Notification $insertData = array('list_id' => $list['list_id'], 'reservation_id' => $reservation_id, 'conversation_id' => $conversation_id, 'userby' => 1, 'userto' => $list['userto'], 'message' => ucfirst($username) . " reservation is 28 days or more. So, Long Term cancellation policy applied for " . $row_list->title, 'created' => local_to_gmt(), 'message_type' => 3); $this->Message_model->sentMessage($insertData, ucfirst($buyer_name), ucfirst($username), $row_list->title, $reservation_id); } //Send Message Notification if ($instance_book == 1) { $insertData = array('list_id' => $list['list_id'], 'reservation_id' => $reservation_id, 'conversation_id' => $reservation_id, 'userby' => $list['userto'], 'userto' => $list['userby'], 'message' => 'Your reservation is successfully done ', 'created' => local_to_gmt(), 'message_type' => 3); $this->Message_model->sentMessage($insertData, $isCoversation = 0, ucfirst($username), ucfirst($buyer_name), $row_list->title, $reservation_id); $message_id = $this->db->insert_id(); $insertData = array('list_id' => $list['list_id'], 'reservation_id' => $reservation_id, 'conversation_id' => $reservation_id, 'userby' => $list['userby'], 'userto' => $list['userto'], 'message' => 'You have a new reservation from ' . ucfirst($username), 'created' => local_to_gmt(), 'message_type' => 1); } else { $insertData = array('list_id' => $list['list_id'], 'reservation_id' => $reservation_id, 'userby' => $list['userby'], 'userto' => $list['userto'], 'message' => 'You have a new reservation request from ' . ucfirst($username), 'created' => local_to_gmt(), 'message_type' => 1); } $this->Message_model->sentMessage($insertData, ucfirst($buyer_name), ucfirst($username), $row_list->title, $reservation_id); $message_id = $this->db->insert_id(); $actionurl = site_url('trips/request/' . $reservation_id); // date_default_timezone_set('Asia/Kolkata'); //Reservation Notification To Host $email_name = 'host_reservation_notification'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{username}" => ucfirst($buyer_name), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A', time()), "{traveler_email_id}" => $email_id, "{checkin}" => date('m/d/Y', $list['checkin']), "{checkout}" => date('m/d/Y', $list['checkout']), "{market_price}" => $host_price, "{action_url}" => $actionurl); //Send Mail // if ($buyer_email != '0') { $this->Email_model->sendMail($buyer_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); } //Reservation Notification To Traveller $email_name = 'traveller_reservation_notification'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username)); //Send Mail $this->Email_model->sendMail($email_id, $admin_email, ucfirst($admin_name), $email_name, $splVars); //Reservation Notification To Administrator $email_name = 'admin_reservation_notification'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A', time()), "{traveler_email_id}" => $email_id, "{checkin}" => date('m/d/Y', $list['checkin']), "{checkout}" => date('m/d/Y', $list['checkout']), "{market_price}" => $price, "{payed_amount}" => $list['price'], "{travel_credits}" => $user_travel_cretids, "{host_name}" => ucfirst($buyer_name), "{host_email_id}" => $buyer_email); //Send Mail $this->Email_model->sendMail($admin_email, $email_id, ucfirst($username), $email_name, $splVars); // if($is_block == 'on') // { $this->db->select_max('group_id'); $group_id = $this->db->get('calendar')->row()->group_id; if (empty($group_id)) { echo $countJ = 0; } else { $countJ = $group_id; } $insertData1['list_id'] = $list['list_id']; //$insertData['reservation_id'] = $reservation_id; $insertData1['group_id'] = $countJ + 1; $insertData1['availability'] = 'Not Available'; $insertData1['booked_using'] = 'Other'; $checkin = date('m/d/Y', $list['checkin']); $checkout = date('m/d/Y', $list['checkout']); $days = getDaysInBetween($checkin, $checkout); // print_r($days);exit; $count = count($days); $i = 1; foreach ($days as $val) { if ($count == 1) { $insertData1['style'] = 'single'; } else { if ($count > 1) { if ($i == 1) { $insertData1['style'] = 'left'; } else { if ($count == $i) { $insertData1['notes'] = ''; $insertData1['style'] = 'right'; } else { $insertData1['notes'] = ''; $insertData1['style'] = 'both'; } } } } $insertData1['booked_days'] = $val; $this->Trips_model->insert_calendar($insertData1); $i++; } $referral_amount = $this->db->where('id', $this->dx_auth->get_user_id())->get('users')->row()->referral_amount; if ($referral_amount > $ref_total) { $this->db->set('referral_amount', $referral_amount - $ref_total)->where('id', $this->dx_auth->get_user_id())->update('users'); } // else //{ // $this->db->set('referral_amount',0)->where('id',$this->dx_auth->get_user_id())->update('users'); //} $data['title'] = "Payment Success !"; $data['message_element'] = "payments/paypal_success"; $this->load->view('template', $data); } else { if ($this->session->userdata('call_back') == 'mobile') { $message_element = 'payments/paypal_cancel_mobile'; } else { $message_element = 'payments/paypal_cancel'; } $data['title'] = "Payment Cancelled !"; $data['message_element'] = $message_element; $this->load->view('template', $data); } }
public function list_success() { //echo $payment_status = $this->input->post('payment_status',true); //exit; $token = $_GET['token']; $payer_id = $_GET['PayerID']; // GetExpressCheckoutDetails $get_ec_return = $this->paypal_ec->get_ec($token); if (isset($get_ec_return['ec_status']) && $get_ec_return['ec_status'] === true) { // at this point, you have all of the data for the transaction. // you may want to save the data for future action. what's left to // do is to collect the money -- you do that by call DoExpressCheckoutPayment // via $this->paypal_ec->do_ec(); // // I suggest to save all of the details of the transaction. You get all that // in $get_ec_return array $ec_details = array('token' => $token, 'payer_id' => $payer_id, 'currency' => get_currency_code(), 'amount' => $get_ec_return['PAYMENTREQUEST_0_AMT'], 'IPN_URL' => site_url('payments/ipn'), 'type' => 'sale'); // DoExpressCheckoutPayment $do_ec_return = $this->paypal_ec->do_ec($ec_details); if (isset($do_ec_return['ec_status']) && $do_ec_return['ec_status'] === true) { // at this point, you have collected payment from your customer // you may want to process the order now. /* echo "<h1>Thank you. We will process your order now.</h1>"; echo "<pre>"; echo "\nGetExpressCheckoutDetails Data\n" . print_r($get_ec_return, true); echo "\n\nDoExpressCheckoutPayment Data\n" . print_r($do_ec_return, true); echo "</pre>";exit; */ if ($this->input->post('payment_status', true) == 'Completed') { $listId = $this->input->post('custom', true); $condition = array('id' => $listId); $data['status'] = 1; $data['list_pay'] = 1; $data['is_enable'] = 1; $this->Common_model->updateTableData('list', NULL, $condition, $data); //redirect('rooms/edit/'.$listId, 'refresh'); $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('success', translate('Rooms added successfully.'))); redirect('rooms/' . $listId, 'refresh'); } else { if ($this->input->post('payment_status', true) == '') { $listId = $this->uri->segment('3'); $condition = array('id' => $listId); $data['status'] = 1; $data['list_pay'] = 1; $data['is_enable'] = 1; $this->Common_model->updateTableData('list', NULL, $condition, $data); //redirect('rooms/edit/'.$listId, 'refresh'); $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('success', translate('Rooms added successfully.'))); redirect('rooms/' . $listId, 'refresh'); } else { //echo $this->input->post('payment_status',true); //exit; //redirect('home/addlist','refresh'); redirect('rooms/new', 'refresh'); } } } else { $this->_error($do_ec_return); } } else { $this->_error($do_ec_return); } }
</span></span> <span class="data col-md-8 col-sm-7 col-xs-12"><span class="inner"><?php echo get_currency_symbol($result->list_id) . get_currency_value_lys($result->currency, get_currency_code(), $subtotal); if ($result->contacts_offer == 1) { $special_offer = '(Special offer used.)'; } else { $special_offer = ''; } ?> <!--<li class="clearfix"> <span class="label"><span class="inner"><span class="checkout_icon" id="icon_cal"></span><?php echo translate("Total Payout"); ?> </span></span> <span class="data"><span class="inner"><?php echo get_currency_symbol($result->list_id) . get_currency_value_lys($result->currency, get_currency_code(), $subtotal) . $special_offer; ?> --> <?php if ($result->coupon == 1) { echo ' (Coupon code used)'; } ?> </span></span> </li> <li class="clearfix bottom"> <span class="label col-md-4 col-sm-5 col-xs-12" style="padding:10px 10px 0 10px;" ><span class="inner"><span class="checkout_icon" id="icon_cal"></span> <?php if ($result->status == 1) { ?>
function paypal_success() { $token = $_GET['token']; $payer_id = $_GET['PayerID']; // GetExpressCheckoutDetails $get_ec_return = $this->paypal_ec->get_ec($token); if (isset($get_ec_return['ec_status']) && $get_ec_return['ec_status'] === true) { // at this point, you have all of the data for the transaction. // you may want to save the data for future action. what's left to // do is to collect the money -- you do that by call DoExpressCheckoutPayment // via $this->paypal_ec->do_ec(); // // I suggest to save all of the details of the transaction. You get all that // in $get_ec_return array $ec_details = array('token' => $token, 'payer_id' => $payer_id, 'currency' => get_currency_code(), 'amount' => $get_ec_return['PAYMENTREQUEST_0_AMT'], 'IPN_URL' => site_url('payments/ipn'), 'type' => 'sale'); // DoExpressCheckoutPayment $do_ec_return = $this->paypal_ec->do_ec($ec_details); if (isset($do_ec_return['ec_status']) && $do_ec_return['ec_status'] === true) { // at this point, you have collected payment from your customer // you may want to process the order now. /* echo "<h1>Thank you. We will process your order now.</h1>"; echo "<pre>"; echo "\nGetExpressCheckoutDetails Data\n" . print_r($get_ec_return, true); echo "\n\nDoExpressCheckoutPayment Data\n" . print_r($do_ec_return, true); echo "</pre>";exit; */ if (isset($do_ec_return['L_SHORTMESSAGE0']) && $do_ec_return['L_SHORTMESSAGE0'] === 'Duplicate Request') { redirect('home'); } $custom = $this->session->userdata('custom'); $data = array(); $list = array(); $data = explode('@', $custom); $contact_key = $data[9]; $list['list_id'] = $data[0]; $list['userby'] = $data[1]; $query1 = $this->Common_model->getTableData('list', array('id' => $list['list_id'])); $buyer_id = $query1->row()->user_id; $list['userto'] = $buyer_id; $list['checkin'] = $data[2]; $list['checkout'] = $data[3]; $list['no_quest'] = $data[4]; $amt = $do_ec_return['PAYMENTINFO_0_AMT']; $list['price'] = $amt; $currency = $do_ec_return['PAYMENTINFO_0_CURRENCYCODE']; $list['payment_id'] = 2; $list['credit_type'] = 1; $list['transaction_id'] = 0; $is_travelCretids = $data[5]; $user_travel_cretids = $data[6]; $list['topay'] = $amt - $data[8]; $list['currency'] = $query1->row()->currency; $list['admin_commission'] = $data[8]; $list['cleaning'] = $data[10]; $list['security'] = $data[11]; $list['extra_guest_price'] = $data[12]; $list['guest_count'] = $data[13]; if ($contact_key != "None") { $list['status'] = 1; $this->db->select_max('group_id'); $group_id = $this->db->get('calendar')->row()->group_id; if (empty($group_id)) { echo $countJ = 0; } else { $countJ = $group_id; } $insertData['list_id'] = $list['list_id']; $insertData['group_id'] = $countJ + 1; $insertData['availability'] = 'Booked'; $insertData['booked_using'] = 'Other'; $checkin = date('m/d/Y', $list['checkin']); $checkout = date('m/d/Y', $list['checkout']); $days = getDaysInBetween($checkin, $checkout); $count = count($days); $i = 1; foreach ($days as $val) { if ($count == 1) { $insertData['style'] = 'single'; } else { if ($count > 1) { if ($i == 1) { $insertData['style'] = 'left'; } else { if ($count == $i) { $insertData['notes'] = ''; $insertData['style'] = 'right'; } else { $insertData['notes'] = ''; $insertData['style'] = 'both'; } } } } $insertData['booked_days'] = $val; $this->Trips_model->insert_calendar($insertData); $i++; } } else { $list['status'] = 1; } if ($list['price'] > 75) { $user_id = $list['userby']; $details = $this->Referrals_model->get_details_by_Iid($user_id); $row = $details->row(); $count = $details->num_rows(); if ($count > 0) { $details1 = $this->Referrals_model->get_details_refamount($row->invite_from); if ($details1->num_rows() == 0) { $insertData = array(); $insertData['user_id'] = $row->invite_from; $insertData['count_trip'] = 1; $insertData['amount'] = 25; $this->Referrals_model->insertReferralsAmount($insertData); } else { $count_trip = $details1->row()->count_trip; $amount = $details1->row()->amount; $updateKey = array('id' => $row->id); $updateData = array(); $updateData['count_trip'] = $count_trip + 1; $updateData['amount'] = $amount + 25; $this->Referrals_model->updateReferralsAmount($updateKey, $updateData); } } } $q = $query1->result(); $row_list = $query1->row(); $iUser_id = $q[0]->user_id; $details2 = $this->Referrals_model->get_details_by_Iid($iUser_id); $row = $details2->row(); $count = $details2->num_rows(); if ($count > 0) { $details3 = $this->Referrals_model->get_details_refamount($row->invite_from); if ($details3->num_rows() == 0) { $insertData = array(); $insertData['user_id'] = $row->invite_from; $insertData['count_book'] = 1; $insertData['amount'] = 75; $this->Referrals_model->insertReferralsAmount($insertData); } else { $count_book = $details3->row()->count_book; $amount = $details3->row()->amount; $updateKey = array('id' => $row->id); $updateData = array(); $updateData['count_trip'] = $count_book + 1; $updateData['amount'] = $amount + 75; $this->Referrals_model->updateReferralsAmount($updateKey, $updateData); } } $admin_email = $this->dx_auth->get_site_sadmin(); $admin_name = $this->dx_auth->get_site_title(); $query3 = $this->Common_model->getTableData('users', array('id' => $list['userby'])); $rows = $query3->row(); $username = $rows->username; $user_id = $rows->id; $email_id = $rows->email; $query4 = $this->Users_model->get_user_by_id($buyer_id); $buyer_name = $query4->row()->username; $buyer_email = $query4->row()->email; //Check md5('No Travel Cretids') || md5('Yes Travel Cretids') if ($is_travelCretids == '7c4f08a53f4454ea2a9fdd94ad0c2eeb') { $query5 = $this->Referrals_model->get_details_refamount($user_id); $amount = $query5->row()->amount; $updateKey = array('user_id ' => $user_id); $updateData = array(); $updateData['amount'] = $amount - $user_travel_cretids; $this->Referrals_model->updateReferralsAmount($updateKey, $updateData); $list['credit_type'] = 2; $list['ref_amount'] = $user_travel_cretids; $row = $query4->row(); //sent mail to administrator $email_name = 'tc_book_to_admin'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $user_travel_cretids + $list['price'], "{payed_amount}" => $list['price'], "{travel_credits}" => $user_travel_cretids, "{host_name}" => ucfirst($buyer_name), "{host_email_id}" => $buyer_email); //Send Mail $this->Email_model->sendMail($admin_email, $email_id, ucfirst($username), $email_name, $splVars); //sent mail to buyer $email_name = 'tc_book_to_host'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{username}" => ucfirst($buyer_name), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $list['price']); //Send Mail if ($buyer_email != '0') { $this->Email_model->sendMail($buyer_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); } } $list['book_date'] = local_to_gmt(); //Actual insertion into the database $this->Common_model->insertData('reservation', $list); $reservation_id = $this->db->insert_id(); $conversation_result = $this->db->select('conversation_id')->order_by('conversation_id', 'desc')->limit(1)->get('messages'); if ($conversation_result->num_rows() == 0) { $conversation_id = 1; } else { $conversation_id = $conversation_result->row()->conversation_id + 1; } //Send Message Notification $insertData = array('list_id' => $list['list_id'], 'reservation_id' => $reservation_id, 'conversation_id' => $conversation_id, 'userby' => $list['userby'], 'userto' => $list['userto'], 'message' => 'You have a new reservation request from ' . ucfirst($username), 'created' => local_to_gmt(), 'message_type' => 1); $this->Message_model->sentMessage($insertData, ucfirst($buyer_name), ucfirst($username), $row_list->title, $reservation_id); $message_id = $this->db->insert_id(); $actionurl = site_url('trips/request/' . $reservation_id); //Reservation Notification To Host $email_name = 'host_reservation_notification'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{username}" => ucfirst($buyer_name), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $list['price'], "{action_url}" => $actionurl); //Send Mail // if ($buyer_email != '0') { $this->Email_model->sendMail($buyer_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); } //Reservation Notification To Traveller $email_name = 'traveller_reservation_notification'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username)); //Send Mail $this->Email_model->sendMail($email_id, $admin_email, ucfirst($admin_name), $email_name, $splVars); //Reservation Notification To Administrator $email_name = 'admin_reservation_notification'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $user_travel_cretids + $list['price'], "{payed_amount}" => $list['price'], "{travel_credits}" => $user_travel_cretids, "{host_name}" => ucfirst($buyer_name), "{host_email_id}" => $buyer_email); //Send Mail $this->Email_model->sendMail($admin_email, $email_id, ucfirst($username), $email_name, $splVars); // if($is_block == 'on') // { $this->db->select_max('group_id'); $group_id = $this->db->get('calendar')->row()->group_id; if (empty($group_id)) { echo $countJ = 0; } else { $countJ = $group_id; } $insertData1['list_id'] = $list['list_id']; //$insertData['reservation_id'] = $reservation_id; $insertData1['group_id'] = $countJ + 1; $insertData1['availability'] = 'Not Available'; $insertData1['booked_using'] = 'Other'; $checkin = date('m/d/Y', $list['checkin']); $checkout = date('m/d/Y', $list['checkout']); $days = getDaysInBetween($checkin, $checkout); $count = count($days); $i = 1; foreach ($days as $val) { if ($count == 1) { $insertData1['style'] = 'single'; } else { if ($count > 1) { if ($i == 1) { $insertData1['style'] = 'left'; } else { if ($count == $i) { $insertData1['notes'] = ''; $insertData1['style'] = 'right'; } else { $insertData1['notes'] = ''; $insertData1['style'] = 'both'; } } } } $insertData1['booked_days'] = $val; $this->Trips_model->insert_calendar($insertData1); $i++; } $referral_amount = $this->db->where('id', $this->dx_auth->get_user_id())->get('users')->row()->referral_amount; if ($referral_amount > 100) { $this->db->set('referral_amount', $referral_amount - 100)->where('id', $this->dx_auth->get_user_id())->update('users'); } else { $this->db->set('referral_amount', 0)->where('id', $this->dx_auth->get_user_id())->update('users'); } $data['title'] = "Payment Success !"; $data['message_element'] = "payments/paypal_success"; $this->load->view('template', $data); } else { $this->_error($do_ec_return); } } else { $this->_error($get_ec_return); } }
?> " /> </p> <?php $currency_symbol = $this->Common_model->getTableData('currency', array('currency_code' => get_currency_code()))->row()->currency_symbol; ?> <p align="center"><b>Price <?php echo $currency_symbol; ?> :</b> <input type="text" id="price_special" name="price_special" value="<?php echo get_currency_value_lys($result->currency, get_currency_code(), $subtotal); ?> " /></p> <input type="hidden" id="price_original" name="price_original" value="<?php echo get_currency_value_lys($result->currency, get_currency_code(), $price_original); ?> " /></p> <p align="center">Enter the price for the reservation including all additional costs</p> <p></p> <p><?php echo translate("Optional message") . "..."; ?> </p> <p><textarea class="comment_contact" name="comment_special" id="comment_special"></textarea></p> <p> <input type="button" class="accept_button" name="offered" value="<?php echo "Send message"; ?> " onclick="javascript:req_action('special');" />
public function trips_success() { $reservation_id = $this->session->userdata('reservation_id'); $is_block = $this->session->userdata('is_block'); $comment = $this->session->userdata('comment'); $checkin = $this->session->userdata('checkin'); $checkout = $this->session->userdata('checkout'); $token = $_GET['token']; $payer_id = $_GET['PayerID']; // GetExpressCheckoutDetails $get_ec_return = $this->paypal_ec->get_ec($token); if (isset($get_ec_return['ec_status']) && $get_ec_return['ec_status'] === true) { // at this point, you have all of the data for the transaction. // you may want to save the data for future action. what's left to // do is to collect the money -- you do that by call DoExpressCheckoutPayment // via $this->paypal_ec->do_ec(); // // I suggest to save all of the details of the transaction. You get all that // in $get_ec_return array $ec_details = array('token' => $token, 'payer_id' => $payer_id, 'currency' => get_currency_code(), 'amount' => $get_ec_return['PAYMENTREQUEST_0_AMT'], 'IPN_URL' => site_url('payments/ipn'), 'type' => 'sale'); // DoExpressCheckoutPayment $do_ec_return = $this->paypal_ec->do_ec($ec_details); if (isset($do_ec_return['ec_status']) && $do_ec_return['ec_status'] === true) { // at this point, you have collected payment from your customer // you may want to process the order now. /* echo "<h1>Thank you. We will process your order now.</h1>"; echo "<pre>"; echo "\nGetExpressCheckoutDetails Data\n" . print_r($get_ec_return, true); echo "\n\nDoExpressCheckoutPayment Data\n" . print_r($do_ec_return, true); echo "</pre>";exit; */ if (isset($do_ec_return['L_SHORTMESSAGE0']) && $do_ec_return['L_SHORTMESSAGE0'] === 'Duplicate Request') { redirect('home'); } $admin_email = $this->dx_auth->get_site_sadmin(); $admin_name = $this->dx_auth->get_site_title(); $conditions = array('reservation.id' => $reservation_id); $row = $this->Trips_model->get_reservation($conditions)->row(); /* $query1 = $this->Users_model->get_user_by_id($row->userby); $traveler_name = $query1->row()->username; $traveler_email = $query1->row()->email; */ $query1 = $this->db->where('id', $row->userby)->get('users'); $traveler_name = $query1->row()->username; $traveler_email = $query1->row()->email; //$query2 = $this->Users_model->get_user_by_id($row->userto); $query2 = $this->db->where('id', $row->userto)->get('users'); $host_name = $query2->row()->username; $host_email = $query2->row()->email; $list_title = $this->Common_model->getTableData('list', array('id' => $row->list_id))->row()->title; $traveler = $this->Common_model->getTableData('profiles', array('id' => $row->userby))->row(); $host = $this->Common_model->getTableData('profiles', array('id' => $row->userto))->row(); //Traveller Info if (!empty($traveler)) { $FnameT = $traveler->Fname; $LnameT = $traveler->Lname; $liveT = $traveler->live; $phnumT = $traveler->phnum; } else { $FnameT = ''; $LnameT = ''; $liveT = ''; $phnumT = ''; } //Host Info if (!empty($host)) { $FnameH = $host->Fname; $LnameH = $host->Lname; $liveH = $host->live; $phnumH = $host->phnum; } else { $FnameH = ''; $LnameH = ''; $liveH = ''; $phnumH = ''; } //for calendar if ($is_block == 'on') { $this->db->select_max('group_id'); $group_id = $this->db->get('calendar')->row()->group_id; if (empty($group_id)) { echo $countJ = 0; } else { $countJ = $group_id; } $insertData['list_id'] = $row->list_id; $insertData['group_id'] = $countJ + 1; $insertData['availability'] = 'Booked'; $insertData['booked_using'] = 'Other'; $checkin = date('m/d/Y', $checkin); $checkout = date('m/d/Y', $checkout); $days = getDaysInBetween($checkin, $checkout); $count = count($days); $i = 1; foreach ($days as $val) { if ($count == 1) { $insertData['style'] = 'single'; } else { if ($count > 1) { if ($i == 1) { $insertData['style'] = 'left'; } else { if ($count == $i) { $insertData['notes'] = ''; $insertData['style'] = 'right'; } else { $insertData['notes'] = ''; $insertData['style'] = 'both'; } } } } $insertData['booked_days'] = $val; $this->Trips_model->insert_calendar($insertData); $i++; } } $list_data = $this->db->where('id', $row->list_id)->get('list')->row(); //Send Message Notification To Traveler $insertData = array('list_id' => $row->list_id, 'reservation_id' => $reservation_id, 'userby' => $row->userto, 'userto' => $row->userby, 'message' => "Congratulation, Your reservation request is granted by {$host_name} for {$list_title}.", 'created' => local_to_gmt(), 'message_type' => 3); $this->Message_model->sentMessage($insertData, 1); $referral_code_check1 = $this->db->where('id', $row->userto)->get('users'); if ($referral_code_check1->row()->list_referral_code) { $own_referral_code = $referral_code_check1->row()->list_referral_code; $referral_code_check2 = $this->db->where('referral_code', $own_referral_code)->get('users'); if ($referral_code_check2->num_rows() != 0) { $insertData = array('list_id' => $row->list_id, 'reservation_id' => $reservation_id, 'userby' => $row->userto, 'userto' => $referral_code_check2->row()->id, 'message' => "Congratulation, You have earned \$75 by {$host_name}.", 'created' => local_to_gmt(), 'message_type' => 9); $this->Message_model->sentMessage($insertData, 1); $this->db->set('list_referral_code', '')->where('id', $referral_code_check1->row()->id)->update('users'); // $this->db->set('cancel_list_referral_code',$own_referral_code)->where('id',$referral_code_check1->row()->id)->update('users'); $amt_check = $this->db->where('id', $referral_code_check2->row()->id)->get('users'); if ($amt_check->row()->referral_amount) { $amt = 75 + $amt_check->row()->referral_amount; } else { $amt = 75; } $this->db->set('referral_amount', $amt)->where('id', $referral_code_check2->row()->id)->update('users'); $email_name = 'referral_credit'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{friend_name}" => $host_name, "{user_name}" => $referral_code_check2->row()->username, '{amount}' => '$75'); $this->Email_model->sendMail($referral_code_check2->row()->email, $admin_email, ucfirst($admin_name), $email_name, $splVars); } } $referral_code_check3 = $this->db->where('id', $row->userby)->get('users'); if ($referral_code_check3->row()->trips_referral_code) { $own_referral_code = $referral_code_check3->row()->trips_referral_code; // echo $own_referral_code; // exit; $referral_code_check4 = $this->db->where('referral_code', $own_referral_code)->get('users'); if ($referral_code_check4->num_rows() != 0) { $insertData = array('list_id' => $row->list_id, 'reservation_id' => $reservation_id, 'userby' => $row->userby, 'userto' => $referral_code_check4->row()->id, 'message' => "Congratulation, You have earned \$25 by " . $referral_code_check3->row()->username, 'created' => local_to_gmt(), 'message_type' => 9); $this->Message_model->sentMessage($insertData, 1); $this->db->set('trips_referral_code', '')->where('id', $referral_code_check3->row()->id)->update('users'); // $this->db->set('cancel_trips_referral_code',$own_referral_code)->where('id',$referral_code_check3->row()->id)->update('users'); $amt_check1 = $this->db->where('id', $referral_code_check4->row()->id)->get('users'); if ($amt_check1->row()->referral_amount) { $amt1 = 25 + $amt_check1->row()->referral_amount; } else { $amt1 = 25; } $this->db->set('referral_amount', $amt1)->where('id', $referral_code_check4->row()->id)->update('users'); $email_name = 'referral_credit'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{friend_name}" => $referral_code_check3->row()->username, "{username}" => $referral_code_check4->row()->username, "{amount}" => '$25'); $this->Email_model->sendMail($referral_code_check4->row()->email, $admin_email, ucfirst($admin_name), $email_name, $splVars); } } $updateKey = array('id' => $reservation_id); $updateData = array(); $updateData['status '] = 3; $updateData['is_payed'] = 0; $this->Trips_model->update_reservation($updateKey, $updateData); if ($list_data->optional_address == '') { $optional_address = ' -'; } else { $optional_address = $list_data->optional_address; } if ($list_data->state == '') { $state = ' -'; } else { $state = $list_data->state; } //Send Mail To Traveller $email_name = 'traveler_reservation_granted'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($traveler_name), "{list_name}" => $list_title, "{host_name}" => ucfirst($host_name), "{Fname}" => $FnameH, "{Lname}" => $LnameH, "{livein}" => $liveH, "{phnum}" => $phnumH, "{comment}" => $comment, "{street_address}" => $list_data->street_address, "{optional_address}" => $optional_address, "{city}" => $list_data->city, "{state}" => $state, "{country}" => $list_data->country, "{zipcode}" => $list_data->zip_code); $this->Email_model->sendMail($traveler_email, $host_email, ucfirst($admin_name), $email_name, $splVars); //Send Mail To Host $email_name = 'host_reservation_granted'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($traveler_name), "{list_title}" => $list_title, "{host_name}" => ucfirst($host_name), "{Fname}" => $FnameT, "{Lname}" => $LnameT, "{livein}" => $liveT, "{phnum}" => $phnumT, "{comment}" => $comment); $this->Email_model->sendMail($host_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); //Send Mail To Administrator $email_name = 'admin_reservation_granted'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($traveler_name), "{list_title}" => $list_title, "{host_name}" => ucfirst($host_name)); $this->Email_model->sendMail($admin_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('success', translate('Your reservation request accept process successfully completed.'))); redirect('trips/request/' . $reservation_id); } else { $this->_error($do_ec_return); } } else { $this->_error($get_ec_return); } }
public function special() { $contact_id = $this->input->post('contact_id'); $message = $this->input->post('comment'); //Update the status,price $updateKey = array('id' => $contact_id); $updateData = array(); $updateData['status'] = 3; $updateData['offer'] = 1; $updateData['currency'] = get_currency_code(); $updateData['price'] = $this->input->post('price'); $updateData['original_price'] = $this->input->post('price_original'); if ($updateData['price'] <= get_currency_value_lys('USD', get_currency_code(), 10)) { $validation_amt = get_currency_value_lys('USD', get_currency_code(), 10); echo "Sorry! Your special offer amount should be greater than or equal to {$validation_amt}."; exit; } else { $this->Contacts_model->update_contact($updateKey, $updateData); } extract($this->input->post()); $currency_symbol = $this->Common_model->getTableData('currency', array('currency_code' => get_currency_code()))->row()->currency_symbol; $price = $currency_symbol . $this->input->post('price'); //Email the confirmation link to the traveller $result = $this->Common_model->getTableData('contacts', array('id' => $contact_id))->row(); $traveller_id = $result->userby; $key = $result->contact_key; $list_id = $result->list_id; $title = $this->Common_model->getTableData('list', array('id' => $list_id))->row()->title; $host_email = $this->Common_model->getTableData('users', array('id' => $this->dx_auth->get_user_id()))->row()->email; $traveller_email = $this->Common_model->getTableData('users', array('id' => $traveller_id))->row()->email; //send message to traveller $host_id = $result->userto; $travellername = $this->Common_model->getTableData('users', array('id' => $traveller_id))->row()->username; $hostname = $this->Common_model->getTableData('users', array('id' => $this->dx_auth->get_user_id()))->row()->username; $list_title = $this->Common_model->getTableData('list', array('id' => $list_id))->row()->title; $insertData = array('list_id' => $list_id, 'contact_id' => $contact_id, 'userby' => $host_id, 'userto' => $traveller_id, 'message' => '<b>Contact Request granted by ' . $hostname . '</b><br><br>' . $message, 'created' => local_to_gmt(), 'message_type' => 8); $this->Message_model->sentMessage($insertData, ucfirst($hostname), ucfirst($travellername), $list_title, $contact_id); $updateData1['is_respond'] = 1; $updateKey1['contact_id'] = $contact_id; $updateKey1['userto'] = $host_id; $this->Message_model->updateMessage($updateKey1, $updateData1); $admin_name = $this->dx_auth->get_site_title(); $admin_email = $this->dx_auth->get_site_sadmin(); $link = base_url() . 'payments/index/' . $list_id . '?contact=' . $key; $email_name = 'special_request_granted_to_host'; $splVars = array("{price}" => $price, "{traveller_username}" => $travellername, "{host_email}" => $host_email, "{guest_email}" => $traveller_email, "{checkin}" => $checkin, "{checkout}" => $checkout, "{message}" => $message, "{site_name}" => $this->dx_auth->get_site_title(), "{host_username}" => ucfirst($hostname), "{title}" => $list_title); $this->Email_model->sendMail($host_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); $email_name = 'special_request_granted_to_guest'; $splVars = array("{price}" => $price, "{link}" => $link, "{host_email}" => $host_email, "{guest_email}" => $traveller_email, "{traveller_username}" => $travellername, "{checkin}" => $checkin, "{checkout}" => $checkout, "{message}" => $message, "{site_name}" => $this->dx_auth->get_site_title(), "{host_username}" => ucfirst($hostname), "{title}" => $list_title); $this->Email_model->sendMail($traveller_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); if ($host_email != $admin_email && $traveller_email != $admin_email) { $email_name = 'special_request_granted_to_admin'; $splVars = array("{price}" => $price, "{traveller_username}" => $travellername, "{host_email}" => $host_email, "{guest_email}" => $traveller_email, "{checkin}" => $checkin, "{checkout}" => $checkout, "{guest}" => $data['guests'], "{message}" => $message, "{site_name}" => $this->dx_auth->get_site_title(), "{host_username}" => ucfirst($hostname), "{title}" => $list_title); $this->Email_model->sendMail($admin_email, $host_email, ucfirst($admin_name), $email_name, $splVars); } }
function form() { $id = $this->input->get('id'); $checkin = $this->input->get('checkin'); $checkout = $this->input->get('checkout'); $data['guests'] = $this->input->get('guest'); $param = $id; $data['checkin'] = $checkin; $data['checkout'] = $checkout; $ckin = explode('/', $checkin); $ckout = explode('/', $checkout); $pay = $this->Common_model->getTableData('paywhom', array('id' => 1)); $paywhom = $pay->result(); $paywhom = $paywhom[0]->whom; $id = $param; if ($ckin[0] == "mm") { //$this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error','Sorry! Access denied.')); redirect('rooms/' . $id, "refresh"); } if ($ckout[0] == "mm") { // $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error','Sorry! Access denied.')); redirect('rooms/' . $id, "refresh"); } $xprice = $this->Common_model->getTableData('price', array('id' => $param))->row(); /* if($this->input->get()) { $price = $this->input->get('subtotal'); } else { */ $price = $xprice->night; //} $placeid = $xprice->id; $guests = $xprice->guests; if (isset($xprice->cleaning)) { $cleaning = $xprice->cleaning; } else { $cleaning = 0; } if (isset($xprice->week)) { $Wprice = $xprice->week; } else { $Wprice = 0; } if (isset($xprice->month)) { $Mprice = $xprice->month; } else { $Mprice = 0; } if ($paywhom) { $query = $this->Common_model->getTableData('list', array('id' => $id))->row(); $email = $query->email; } else { $query = $this->Common_model->getTableData('users', array('role_id' => 2))->row(); $email = $query->email; } $query = $this->Common_model->getTableData('list', array('id' => $id)); $list = $query->row(); $data['address'] = $list->address; $data['room_type'] = $list->room_type; $data['total_guests'] = $list->capacity; $data['tit'] = $list->title; $data['manual'] = $list->manual; $diff = strtotime($ckout[2] . '-' . $ckout[0] . '-' . $ckout[1]) - strtotime($ckin[2] . '-' . $ckin[0] . '-' . $ckin[1]); $days = ceil($diff / (3600 * 24)); /* $amt = $price * $days * $data['guests']; */ if ($data['guests'] > $guests) { $diff_days = $data['guests'] - $guests; $amt = $price * $days + $days * $xprice->addguests * $diff_days; } else { $amt = $price * $days; } //Entering it into data variables $data['id'] = $id; $data['price'] = $xprice->night; $data['days'] = $days; $data['full_cretids'] = 'off'; $data['commission'] = 0; if ($days >= 7 && $days < 30) { if (!empty($Wprice)) { $finalAmount = $Wprice; $differNights = $days - 7; $perDay = $Wprice / 7; $per_night = $price = round($perDay, 2); if ($differNights > 0) { $addAmount = $differNights * $per_night; $finalAmount = $Wprice + $addAmount; } $amt = $finalAmount; } } if ($days >= 30) { if (!empty($Mprice)) { $finalAmount = $Mprice; $differNights = $days - 30; $perDay = $Mprice / 30; $per_night = $price = round($perDay, 2); if ($differNights > 0) { $addAmount = $differNights * $per_night; $finalAmount = $Mprice + $addAmount; } $amt = $finalAmount; } } //Update the daily price $data['price'] = $xprice->night; //Cleaning fee if ($cleaning != 0) { $amt = $amt + $cleaning; } else { $amt = $amt; } $session_coupon = $this->session->userdata("coupon"); if ($this->input->get('contact')) { $amt = $contact_result->price; $this->session->set_userdata("total_price_'" . $id . "'_'" . $this->dx_auth->get_user_id() . "'", $amt); } else { //$amt=$this->session->userdata("total_price_'".$id."'_'".$this->dx_auth->get_user_id()."'"); } //Coupon Starts if ($this->input->post('apply_coupon')) { $is_coupon = 0; //Get All coupons $query = $this->Common_model->get_coupon(); $row = $query->result_array(); $list_id = $this->input->post('hosting_id'); $coupon_code = $this->input->post('coupon_code'); $user_id = $this->dx_auth->get_user_id(); if ($coupon_code != "") { $is_list_already = $this->Common_model->getTableData('coupon_users', array('list_id' => $list_id, 'user_id' => $user_id)); $is_coupon_already = $this->Common_model->getTableData('coupon_users', array('used_coupon_code' => $coupon_code, 'user_id' => $user_id)); //Check the list is already access with the coupon by the host or not /* if($is_list_already->num_rows() != 0) { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error','Sorry! You cannot use coupons for this list')); redirect('rooms/'.$list_id, "refresh"); } //Check the host already used the coupon or not else */ if ($is_coupon_already->num_rows() != 0) { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('Sorry! Your coupon is invalid'))); redirect('rooms/' . $list_id, "refresh"); } else { //Coupon Discount calculation foreach ($row as $code) { if ($coupon_code == $code['couponcode']) { //Currecy coversion $is_coupon = 1; $current_currency = get_currency_code(); $coupon_currency = $code['currency']; if ($current_currency == $coupon_currency) { $Coupon_amt = $code['coupon_price']; } else { $Coupon_amt = get_currency_value_coupon($code['coupon_price'], $coupon_currency); } } } if ($is_coupon == 1) { if ($Coupon_amt >= get_currency_value1($list_id, $amt)) { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('Sorry! There is equal money or more money in your coupon to book this list.'))); redirect('rooms/' . $list_id, "refresh"); } else { //Get the result amount & store the coupon informations $amt = $amt - $Coupon_amt; $insertData = array('list_id' => $list_id, 'used_coupon_code' => $coupon_code, 'user_id' => $user_id, 'status' => 0); $this->Common_model->inserTableData('coupon_users', $insertData); $this->db->where('couponcode', $coupon_code)->update('coupon', array('status' => 1)); $this->session->set_userdata("total_price_'" . $list_id . "'_'" . $user_id . "'", $amt); } } else { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('Sorry! Your coupon does not match.'))); redirect('rooms/' . $list_id, "refresh"); } } } else { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('Sorry! Your coupon does not match.'))); redirect('rooms/' . $list_id, "refresh"); } } //Coupon Ends $data['subtotal'] = $amt; //if($this->session->userdata("total_price_'".$id."'_'".$this->dx_auth->get_user_id()."'") == "") //{ echo 'total';exit; //redirect('rooms/'.$param, "refresh"); // $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error','Please! Try Again')); //} //check admin premium condition and apply so for $query = $this->Common_model->getTableData('paymode', array('id' => 2)); $row = $query->row(); if ($row->is_premium == 1) { if ($row->is_fixed == 1) { $fix = $row->fixed_amount; $amt = $amt + $fix; $data['commission'] = $fix; } else { $per = $row->percentage_amount; $camt = floatval($amt * $per / 100); $amt = $amt + $camt; $data['commission'] = $camt; } } else { $amt = $amt; } // Coupon Code Starts //print_r($amt);exit; if ($amt > 110) { $da = array(); $this->db->select('*'); $this->db->where('id', $this->dx_auth->get_user_id()); $this->db->from('users'); $value = $this->db->get()->result(); foreach ($value as $val) { $da = $val->referral_amount; } if ($da != 0) { $data['amt'] = $amt; $data['referral_amount'] = $da; } else { $data['amt'] = $amt; } } else { $data['amt'] = $amt; } if ($amt < 0) { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('Sorry! Your payment should be greater than 0.'))); redirect('rooms/' . $id, "refresh"); } $dat['result'] = $this->Common_model->getTableData('payments')->result(); $array_items = array('list_id' => '', 'Lcheckin' => '', 'Lcheckout' => '', 'number_of_guests' => '', 'formCheckout' => ''); $this->session->unset_userdata($array_items); //$id = $list_id; $checkin_time = get_gmt_time(strtotime($checkin)); $checkout_time = get_gmt_time(strtotime($checkout)); $travel_dates = array(); $seasonal_prices = array(); $total_nights = 1; $total_price = 0; $is_seasonal = 0; $i = $checkin_time; while ($i < $checkout_time) { $checkin_date = date('m/d/Y', $i); $checkin_date = explode('/', $checkin_date); $travel_dates[$total_nights] = $checkin_date[1] . $checkin_date[0] . $checkin_date[2]; $i = get_gmt_time(strtotime('+1 day', $i)); $total_nights++; } for ($i = 1; $i < $total_nights; $i++) { $seasonal_prices[$travel_dates[$i]] = ""; } //Store seasonal price of a list in an array $seasonal_query = $this->Common_model->getTableData('seasonalprice', array('list_id' => $id)); $seasonal_result = $seasonal_query->result_array(); if ($seasonal_query->num_rows() > 0) { foreach ($seasonal_result as $time) { //Get Seasonal price $seasonalprice_query = $this->Common_model->getTableData('seasonalprice', array('list_id' => $id, 'start_date' => $time['start_date'], 'end_date' => $time['end_date'])); $seasonalprice = $seasonalprice_query->row()->price; //Days between start date and end date -> seasonal price $start_time = $time['start_date']; $end_time = $time['end_date']; $i = $start_time; while ($i <= $end_time) { $start_date = date('m/d/Y', $i); $s_date = explode('/', $start_date); $s_date = $s_date[1] . $s_date[0] . $s_date[2]; $seasonal_prices[$s_date] = $seasonalprice; $i = get_gmt_time(strtotime('+1 day', $i)); } } //Total Price for ($i = 1; $i < $total_nights; $i++) { if ($seasonal_prices[$travel_dates[$i]] == "") { $xprice = $this->Common_model->getTableData('price', array('id' => $id))->row(); $total_price = $total_price + $xprice->night; } else { $total_price = $total_price + $seasonal_prices[$travel_dates[$i]]; $is_seasonal = 1; } } //Additional Guests if ($data['guests'] > $guests) { $days = $total_nights - 1; $diff_guests = $data['guests'] - $guests; $total_price = $total_price + $days * $xprice->addguests * $diff_guests; } //Cleaning if ($cleaning != 0) { $total_price = $total_price + $cleaning; } //Admin Commission //$data['commission'] = 0; } if ($is_seasonal == 1) { //Total days $days = $total_nights; //Final price $data['subtotal'] = $total_price; $data['avg_price'] = $total_price / ($days - 1); //echo $data['avg_price'];exit; $amt = $data['subtotal']; $query = $this->Common_model->getTableData('paymode', array('id' => 2)); $row = $query->row(); if ($row->is_premium == 1) { if ($row->is_fixed == 1) { $fix = $row->fixed_amount; $amt = $amt + $fix; $data['commission'] = $fix; } else { $per = $row->percentage_amount; $camt = floatval($amt * $per / 100); $amt = $amt + $camt; $data['commission'] = $camt; } } else { $amt = $amt; } $data['amt'] = $amt; $this->session->set_userdata('topay', $amt); } $data['img'] = getListImage($id); $data['env'] = 'mobile'; $data['countries'] = $this->Common_model->getCountries()->result(); $data['title'] = get_meta_details('Confirm_your_booking', 'title'); $data["meta_keyword"] = 'mobile'; $data["meta_description"] = get_meta_details('Confirm_your_booking', 'meta_description'); $data['message_element'] = "payments/view_booking"; $this->load->view('template', $data); }
?> . <?php echo translate("Your total charge is"); ?> <?php echo get_currency_symbol($id) . ' ' . $final_amt; ?> .</div> <?php } else { ?> <div class="currency_alert"><?php echo translate("This payment transacts in"); ?> <?php echo get_currency_symbol($id) . get_currency_code(); ?> . <?php echo translate("Your total charge is"); ?> <?php echo get_currency_symbol($id) . $amt; ?> .</div> <?php } ?> <p class="payment_method_explanation two_c_explanation"> <span class="paypallogo"><?php echo translate("Instructions:"); ?>
<?php $paymentOpts = get_payment_optins($_REQUEST['paymentmethod']); $merchantid = $paymentOpts['merchantid']; $returnUrl = $paymentOpts['returnUrl']; $cancel_return = $paymentOpts['cancel_return']; $notify_url = $paymentOpts['notify_url']; $currency_code = get_currency_code(); global $payable_amount, $post_title, $last_postid; ?> <form name="frm_payment_method" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" value="<?php echo $payable_amount; ?> " name="amount"/> <input type="hidden" value="<?php echo $returnUrl; ?> &pid=<?php echo $last_postid; ?> " name="return"/> <input type="hidden" value="<?php echo $cancel_return; ?> &pid=<?php echo $last_postid; ?> " name="cancel_return"/> <input type="hidden" value="<?php echo $notify_url;
public function wishlists($param) { $this->session->set_userdata('wishlist_id', $param); $wishlists_data = $this->Common_model->getTableData('wishlists', array('id' => $param)); if ($this->dx_auth->get_user_id() == $wishlists_data->row()->user_id) { $data['check_user'] = 1; $query = $this->db->where('user_wishlist.wishlist_id', $param)->join('wishlists', 'wishlists.id = user_wishlist.wishlist_id')->join('list', 'list.id = user_wishlist.list_id')->join('property_type', 'property_type.id = list.property_id')->get('user_wishlist'); } else { $data['check_user'] = 0; $query = $this->db->where('user_wishlist.wishlist_id', $param)->where('wishlists.privacy', 0)->join('wishlists', 'wishlists.id = user_wishlist.wishlist_id')->join('list', 'list.id = user_wishlist.list_id')->join('property_type', 'property_type.id = list.property_id')->get('user_wishlist'); } $data['wishlists'] = $query; $location_og = ''; if ($query->num_rows() != 0) { $i = 1; foreach ($query->result() as $data_list) { $i++; if ($i == $query->num_rows() + 1 && $query->num_rows() != 1) { $location_og .= ' and '; } $location_og .= $data_list->state . ', ' . $data_list->country; if ($i != $query->num_rows() + 1 && $i != $query->num_rows()) { $location_og .= ' , '; } } } $data['wishlist_name'] = $wishlists_data->row()->name; $data['username'] = get_user_by_id($wishlists_data->row()->user_id)->username; $data['og_desc'] = $data['wishlist_name'] . ": " . $query->num_rows() . " unique accommodations in " . $location_og . ". An " . $this->dx_auth->get_site_title() . " Wish List by " . $data['username'] . "."; $locations = ''; if ($query->num_rows() != 0) { foreach ($query->result() as $row) { $conditions = array('list_id' => $row->list_id, "is_featured" => 1); $images = $this->Gallery->get_imagesG(NULL, $conditions); if ($images->num_rows() != 0) { $data['images'] = base_url() . 'images/' . $row->list_id . '/' . $images->row()->name; } else { $data['images'] = base_url() . 'images/' . $row->list_id . '/no_image.jpg'; } $address = $row->state . ', ' . $row->country; $wishlist_user_check = $this->Common_model->getTableData('user_wishlist', array('list_id' => $row->list_id, 'user_id' => $this->dx_auth->get_user_id())); if (!$this->dx_auth->is_logged_in()) { $wishlist_img = base_url() . 'images/search_heart_hover.png'; } else { if ($wishlist_user_check->num_rows() != 0) { $wishlist_img = base_url() . 'images/heart_rose.png'; } else { $wishlist_img = base_url() . 'images/search_heart_hover.png'; } } $locations .= '["' . $row->title . '",' . $row->lat . ',' . $row->long . ',"' . $address . '","' . $data['images'] . '","' . $row->list_id . '","' . get_currency_value1($row->list_id, $row->price) . '","' . get_currency_code() . '","' . $wishlist_img . '"],'; } } else { //redirect('info'); } //echo $locations;exit; $check = $this->Common_model->getTableData('wishlists', array('id' => $param)); if ($check->num_rows() == 0) { redirect('info'); } $locations = rtrim($locations, ","); $data['locations'] = $locations; $data['user_id'] = $wishlists_data->row()->user_id; $data['privacy'] = $wishlists_data->row()->privacy; if ($this->dx_auth->get_user_id() == 0 && $data['privacy'] == 1) { redirect('info'); } $data['wishlist_details'] = $this->Common_model->getTableData('wishlists', array('id' => $param))->row(); $data['title'] = get_meta_details('My Wishlist', 'title'); $data["meta_keyword"] = get_meta_details('My Wishlist', 'meta_keyword'); $data["meta_description"] = get_meta_details('My Wishlist', 'meta_description'); $data['message_element'] = "account/view_wishlist_inner"; $this->load->view('template', $data); }