static function getRentalInfo()
 {
     $rental_id = intval(STInput::request('rental_id', ''));
     $data = array('price' => '', 'extras' => 'None', 'adult_html' => '', 'child_html' => '');
     if ($rental_id <= 0 || get_post_type($rental_id) != 'st_rental') {
         echo json_encode($data);
     } else {
         $adult_number = intval(get_post_meta($rental_id, 'rental_max_adult', true));
         if ($adult_number <= 0) {
             $adult_number = 1;
         }
         $adult_html = '<select name="adult_number" class="form-control" style="width: 100px;">';
         for ($i = 1; $i <= $adult_number; $i++) {
             $adult_html .= '<option value="' . $i . '">' . $i . '</option>';
         }
         $adult_html .= '</select>';
         $child_number = intval(get_post_meta($rental_id, 'rental_max_children', true));
         if ($child_number <= 0) {
             $child_number = 0;
         }
         $child_html = '<select name="child_number" class="form-control" style="width: 100px;">';
         for ($i = 0; $i <= $child_number; $i++) {
             $child_html .= '<option value="' . $i . '">' . $i . '</option>';
         }
         $child_html .= '</select>';
         $html = '';
         $price = floatval(get_post_meta($rental_id, 'price', true));
         $extras = get_post_meta($rental_id, 'extra_price', true);
         if (is_array($extras) && count($extras)) {
             $html = '<table class="table">';
             foreach ($extras as $key => $val) {
                 $html .= '
             <tr>
                 <td width="80%">
                     <label for="' . $val['extra_name'] . '" class="ml20">' . $val['title'] . ' (' . TravelHelper::format_money($val['extra_price']) . ')' . '</label>
                     <input type="hidden" name="extra_price[price][' . $val['extra_name'] . ']" value="' . $val['extra_price'] . '">
                     <input type="hidden" name="extra_price[title][' . $val['extra_name'] . ']" value="' . $val['title'] . '">
                 </td>
                 <td width="20%">
                     <select style="width: 100px" class="form-control" name="extra_price[value][' . $val['extra_name'] . ']" id="">';
                 $max_item = intval($val['extra_max_number']);
                 if ($max_item <= 0) {
                     $max_item = 1;
                 }
                 for ($i = 0; $i <= $max_item; $i++) {
                     $html .= '<option value="' . $i . '">' . $i . '</option>';
                 }
                 $html .= '
                     </select>
                 </td>
             </tr>';
             }
             $html .= '</table>';
         }
         $data['price'] = TravelHelper::format_money_from_db($price, false);
         $data['extras'] = $html;
         $data['adult_html'] = $adult_html;
         $data['child_html'] = $child_html;
         echo json_encode($data);
     }
     die;
 }
示例#2
0
         if ($diff > 1) {
             $duration .= esc_attr($diff) . " " . __("days", ST_TEXTDOMAIN);
         } else {
             $duration .= esc_attr($diff) . " " . __("day", ST_TEXTDOMAIN);
         }
     }
     echo __("Duration", ST_TEXTDOMAIN) . ": " . $duration;
 }
 ?>
                     </td>
                     <td class="post-title page-title column-title">
                        <?php 
 $price = get_post_meta($post_id, 'total_price', true);
 $currency = get_post_meta($post_id, 'currency', true);
 $rate = floatval(get_post_meta($post_id, 'currency_rate', true));
 echo TravelHelper::format_money_from_db($price, $currency, $rate);
 ?>
                     </td>
                     <td class="post-title page-title column-title">
                         <?php 
 echo date(TravelHelper::getDateFormat(), strtotime($value->post_date));
 ?>
                     </td>
                     <td class="post-title page-title column-title">
                         <?php 
 echo get_post_meta($order_id, 'status', true);
 ?>
                     </td>
                     <td class="post-title page-title column-title">
                         <?php 
 echo STPaymentGateways::get_gatewayname(get_post_meta($order_id, 'payment_method', true));