示例#1
0
 function do_add_to_cart($array = array())
 {
     $default = array('item_id' => '', 'number_room' => 1, 'price' => '', 'check_in' => '', 'check_out' => '', 'adult' => 1, 'children' => 0);
     extract(wp_parse_args($array, $default));
     $data = array('check_in' => $check_in, 'check_out' => $check_out, 'currency' => TravelHelper::get_default_currency('symbol'), 'adult' => $adult, 'children' => $children);
     STCart::add_cart($item_id, $number_room, $price, $data);
 }
示例#2
0
 /**
  *
  *
  * @since 1.1.1
  * */
 function init_metabox()
 {
     //Room
     $this->metabox[] = array('id' => 'room_metabox', 'title' => __('Room Setting', ST_TEXTDOMAIN), 'desc' => '', 'pages' => array('hotel_room'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => __('General', ST_TEXTDOMAIN), 'id' => 'room_reneral_tab', 'type' => 'tab'), array('label' => __('Hotel', ST_TEXTDOMAIN), 'id' => 'room_parent', 'type' => 'post_select_ajax', 'desc' => __('Choose the hotel that the room belongs to', ST_TEXTDOMAIN), 'post_type' => 'st_hotel', 'placeholder' => __('Search for a Hotel', ST_TEXTDOMAIN)), array('label' => __('Number of Rooms', ST_TEXTDOMAIN), 'id' => 'number_room', 'type' => 'text', 'desc' => __('Number of rooms available for booking', ST_TEXTDOMAIN), 'std' => 1), array('label' => __('Gallery', ST_TEXTDOMAIN), 'id' => 'gallery', 'type' => 'gallery'), array('label' => __('Hotel Room Layout', ST_TEXTDOMAIN), 'id' => 'st_custom_layout', 'post_type' => 'st_layouts', 'desc' => __('Hotel Room Layout', ST_TEXTDOMAIN), 'type' => 'select', 'choices' => st_get_layout('hotel_room')), array('label' => __('Room Price', ST_TEXTDOMAIN), 'id' => 'room_price_tab', 'type' => 'tab'), array('label' => sprintf(__('Price (%s)', ST_TEXTDOMAIN), TravelHelper::get_default_currency('symbol')), 'id' => 'price', 'type' => 'text', 'desc' => __('Per night', ST_TEXTDOMAIN)), array('label' => __('Extra Price', ST_TEXTDOMAIN), 'id' => 'extra_price', 'type' => 'list-item', 'settings' => array(array('id' => 'extra_name', 'type' => 'text', 'std' => 'extra_', 'label' => __('Name of Item', ST_TEXTDOMAIN)), array('id' => 'extra_max_number', 'type' => 'text', 'std' => '', 'label' => __('Max of Number', ST_TEXTDOMAIN)), array('id' => 'extra_price', 'type' => 'text', 'std' => '', 'label' => __('Price', ST_TEXTDOMAIN), 'desc' => __('per 1 Item', ST_TEXTDOMAIN)))), array('label' => __('Discount Rate', ST_TEXTDOMAIN), 'id' => 'discount_rate', 'type' => 'text', 'desc' => __('Discount by %', ST_TEXTDOMAIN)), array('label' => __('Sale Schedule', ST_TEXTDOMAIN), 'id' => 'is_sale_schedule', 'type' => 'on-off', 'std' => 'off'), array('label' => __('Sale Price Date From', ST_TEXTDOMAIN), 'desc' => __('Sale Price Date From', ST_TEXTDOMAIN), 'id' => 'sale_price_from', 'type' => 'date-picker', 'condition' => 'is_sale_schedule:is(on)'), array('label' => __('Sale Price Date To', ST_TEXTDOMAIN), 'desc' => __('Sale Price Date To', ST_TEXTDOMAIN), 'id' => 'sale_price_to', 'type' => 'date-picker', 'condition' => 'is_sale_schedule:is(on)'), array('id' => 'deposit_payment_status', 'label' => __("Deposit payment options", ST_TEXTDOMAIN), 'desc' => __('You can select <code>Disallow Deposit</code>, <code>Deposit by percent</code>, <code>Deposit by amount</code>'), 'type' => 'select', 'choices' => array(array('value' => '', 'label' => __('Disallow Deposit', ST_TEXTDOMAIN)), array('value' => 'percent', 'label' => __('Deposit by percent', ST_TEXTDOMAIN)), array('value' => 'amount', 'label' => __('Deposit by amount', ST_TEXTDOMAIN)))), array('label' => __('Deposit payment amount', ST_TEXTDOMAIN), 'desc' => __('Leave empty for disallow deposit payment', ST_TEXTDOMAIN), 'id' => 'deposit_payment_amount', 'type' => 'text', 'condition' => 'deposit_payment_status:not()'), array('label' => __('Room Facility', ST_TEXTDOMAIN), 'id' => 'room_detail_tab', 'type' => 'tab'), array('label' => __('No. adults', ST_TEXTDOMAIN), 'id' => 'adult_number', 'type' => 'text', 'desc' => __('Number of Adults in room', ST_TEXTDOMAIN), 'std' => 1), array('label' => __('No. children', ST_TEXTDOMAIN), 'id' => 'children_number', 'type' => 'text', 'desc' => __('Number of Children in room', ST_TEXTDOMAIN), 'std' => 0), array('label' => __('No. beds', ST_TEXTDOMAIN), 'id' => 'bed_number', 'type' => 'text', 'desc' => __('Number of Beds in room', ST_TEXTDOMAIN), 'std' => 0), array('label' => __('Room footage (square feet)', ST_TEXTDOMAIN), 'desc' => __('Room footage (square feet)', ST_TEXTDOMAIN), 'id' => 'room_footage', 'type' => 'text'), array('label' => __('Room external booking', ST_TEXTDOMAIN), 'id' => 'st_room_external_booking', 'type' => 'on-off', 'std' => "off"), array('label' => __('Room external booking', ST_TEXTDOMAIN), 'id' => 'st_room_external_booking_link', 'type' => 'text', 'std' => "", 'condition' => 'st_room_external_booking:is(on)', 'desc' => "<em>" . __('Notice: Must be http://...', ST_TEXTDOMAIN) . "</em>"), array('label' => __('Other facility', ST_TEXTDOMAIN), 'id' => 'other_facility', 'type' => 'tab'), array('label' => __('Add a facility', ST_TEXTDOMAIN), 'id' => 'add_new_facility', 'type' => 'list-item', 'settings' => array(array('id' => 'facility_value', 'type' => 'text', 'std' => '', 'label' => __('Value', ST_TEXTDOMAIN)), array('id' => 'facility_icon', 'type' => 'text', 'std' => '', 'label' => __('Icon', ST_TEXTDOMAIN), 'desc' => __('Support: fonticon <code>(eg: fa-facebook)</code>', ST_TEXTDOMAIN)))), array('label' => __('Description', ST_TEXTDOMAIN), 'id' => 'room_description', 'type' => 'textarea', 'std' => ''), array('label' => __('Availability', ST_TEXTDOMAIN), 'id' => 'availability_tab', 'type' => 'tab'), array('label' => __("Default State", ST_TEXTDOMAIN), 'id' => 'default_state', 'type' => 'select', 'choices' => array(array('value' => "available", 'label' => __("Available", ST_TEXTDOMAIN)), array('value' => "not_available", 'label' => __("Not Available", ST_TEXTDOMAIN)))), array('label' => __('Hotel Calendar', ST_TEXTDOMAIN), 'id' => 'st_hotel_calendar', 'type' => 'st_hotel_calendar')));
     $data_paypment = STPaymentGateways::get_payment_gateways();
     if (!empty($data_paypment) and is_array($data_paypment)) {
         $this->metabox[0]['fields'][] = array('label' => __('Payment', ST_TEXTDOMAIN), 'id' => 'payment_detail_tab', 'type' => 'tab');
         foreach ($data_paypment as $k => $v) {
             $this->metabox[0]['fields'][] = array('label' => $v->get_name(), 'id' => 'is_meta_payment_gateway_' . $k, 'type' => 'on-off', 'desc' => $v->get_name(), 'std' => 'on');
         }
     }
     parent::register_metabox($this->metabox);
 }
 /**
  *
  * @since 1.0.9
  * */
 function _add_metabox()
 {
     $this->metabox[] = array('id' => 'st_location', 'title' => __('Rental Details', ST_TEXTDOMAIN), 'desc' => '', 'pages' => array('st_rental'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => __('Location', ST_TEXTDOMAIN), 'id' => 'location_tab', 'type' => 'tab'), array('label' => __('Location', ST_TEXTDOMAIN), 'id' => 'multi_location', 'type' => 'list_item_post_type', 'desc' => __('Rental Location', ST_TEXTDOMAIN), 'post_type' => 'location'), array('label' => __('Address', ST_TEXTDOMAIN), 'id' => 'address', 'type' => 'text', 'desc' => __('Rental Address ', ST_TEXTDOMAIN)), array('label' => __('Maps', ST_TEXTDOMAIN), 'id' => 'st_google_map', 'type' => 'bt_gmap', 'desc' => __('Maps', ST_TEXTDOMAIN), 'std' => 'off'), array('label' => __('Rental Information', ST_TEXTDOMAIN), 'id' => 'detail_tab', 'type' => 'tab'), array('label' => __('Set as Featured', ST_TEXTDOMAIN), 'id' => 'is_featured', 'type' => 'on-off', 'desc' => __('Set this location is featured', ST_TEXTDOMAIN), 'std' => 'off'), array('id' => 'rental_number', 'label' => __('Numbers', ST_TEXTDOMAIN), 'desc' => __('Number of rental available for booking', ST_TEXTDOMAIN), 'type' => 'text', 'std' => '1'), array('id' => 'rental_max_adult', 'label' => __('Max Adults', ST_TEXTDOMAIN), 'desc' => __('Max Adults', ST_TEXTDOMAIN), 'type' => 'numeric-slider', 'min_max_step' => '0,100,1', 'std' => 1), array('id' => 'rental_max_children', 'label' => __('Max Children', ST_TEXTDOMAIN), 'desc' => __('Max Children', ST_TEXTDOMAIN), 'type' => 'numeric-slider', 'min_max_step' => '0,100,1', 'std' => 1), array('label' => __('Custom Layout', ST_TEXTDOMAIN), 'id' => 'custom_layout', 'post_type' => 'st_layouts', 'type' => 'select', 'choices' => st_get_layout('st_rental')), array('label' => __('Gallery', ST_TEXTDOMAIN), 'id' => 'gallery', 'type' => 'gallery', 'desc' => __('Rental Gallery', ST_TEXTDOMAIN)), array('label' => __('Video', ST_TEXTDOMAIN), 'id' => 'video', 'type' => 'text', 'desc' => __('Youtube or Video url', ST_TEXTDOMAIN)), array('label' => __('Agent Information', ST_TEXTDOMAIN), 'id' => 'agent_tab', 'type' => 'tab'), array('label' => __('Agent Email', ST_TEXTDOMAIN), 'id' => 'agent_email', 'type' => 'text', 'desc' => __('Agent Email. This email will receive emails notifying new booking', ST_TEXTDOMAIN)), array('label' => __('Agent Website', ST_TEXTDOMAIN), 'id' => 'agent_website', 'type' => 'text', 'desc' => __('Agent Website', ST_TEXTDOMAIN)), array('label' => __('Agent Phone', ST_TEXTDOMAIN), 'id' => 'agent_phone', 'type' => 'text', 'desc' => __('Agent Phone', ST_TEXTDOMAIN)), array('label' => __('Rental Price', ST_TEXTDOMAIN), 'id' => 'price_tab', 'type' => 'tab'), array('label' => sprintf(__('Price (%s)', ST_TEXTDOMAIN), TravelHelper::get_default_currency('symbol')), 'id' => 'price', 'type' => 'text', 'desc' => __('Regular Price', ST_TEXTDOMAIN)), array('label' => __('Extra Price', ST_TEXTDOMAIN), 'id' => 'extra_price', 'type' => 'list-item', 'settings' => array(array('id' => 'extra_name', 'type' => 'text', 'std' => 'extra_', 'label' => __('Name of Item', ST_TEXTDOMAIN)), array('id' => 'extra_max_number', 'type' => 'text', 'std' => '', 'label' => __('Max of Number', ST_TEXTDOMAIN)), array('id' => 'extra_price', 'type' => 'text', 'std' => '', 'label' => __('Price', ST_TEXTDOMAIN), 'desc' => __('per 1 Item', ST_TEXTDOMAIN)))), array('label' => __('Discount Rate', ST_TEXTDOMAIN), 'id' => 'discount_rate', 'type' => 'text', 'desc' => __('Discount Rate By %', ST_TEXTDOMAIN)), array('label' => __('Sale Schedule', ST_TEXTDOMAIN), 'id' => 'is_sale_schedule', 'type' => 'on-off', 'std' => 'off'), array('label' => __('Sale Price Date From', ST_TEXTDOMAIN), 'desc' => __('Sale Price Date From', ST_TEXTDOMAIN), 'id' => 'sale_price_from', 'type' => 'date-picker', 'condition' => 'is_sale_schedule:is(on)'), array('label' => __('Sale Price Date To', ST_TEXTDOMAIN), 'desc' => __('Sale Price Date To', ST_TEXTDOMAIN), 'id' => 'sale_price_to', 'type' => 'date-picker', 'condition' => 'is_sale_schedule:is(on)'), array('id' => 'deposit_payment_status', 'label' => __("Deposit payment options", ST_TEXTDOMAIN), 'desc' => __('You can select <code>Disallow Deposit</code>, <code>Deposit by percent</code>, <code>Deposit by amount</code>'), 'type' => 'select', 'choices' => array(array('value' => '', 'label' => __('Disallow Deposit', ST_TEXTDOMAIN)), array('value' => 'percent', 'label' => __('Deposit by percent', ST_TEXTDOMAIN)), array('value' => 'amount', 'label' => __('Deposit by amount', ST_TEXTDOMAIN)))), array('label' => __('Deposit payment amount', ST_TEXTDOMAIN), 'desc' => __('Leave empty for disallow deposit payment', ST_TEXTDOMAIN), 'id' => 'deposit_payment_amount', 'type' => 'text', 'condition' => 'deposit_payment_status:not()'), array('label' => __('Availability', ST_TEXTDOMAIN), 'id' => 'availability_tab', 'type' => 'tab'), array('label' => __('Rental Calendar', ST_TEXTDOMAIN), 'id' => 'st_rental_calendar', 'type' => 'st_rental_calendar'), array('label' => __('Rental Option', ST_TEXTDOMAIN), 'id' => 'rental_options', 'type' => 'tab'), array('label' => __('Minimum days to book before arrival', ST_TEXTDOMAIN), 'id' => 'rentals_booking_period', 'type' => 'numeric-slider', 'min_max_step' => '0,30,1', 'std' => 0, 'desc' => __('The time period allowed booking.', ST_TEXTDOMAIN)), array('label' => __('Rental external booking', ST_TEXTDOMAIN), 'id' => 'st_rental_external_booking', 'type' => 'on-off', 'std' => "off"), array('label' => __('Rental external booking link', ST_TEXTDOMAIN), 'id' => 'st_rental_external_booking_link', 'type' => 'text', 'std' => "", 'condition' => 'st_rental_external_booking:is(on)', 'desc' => "<em>" . __('Notice: Must be http://...', ST_TEXTDOMAIN) . "</em>")));
     $data_paypment = STPaymentGateways::get_payment_gateways();
     if (!empty($data_paypment) and is_array($data_paypment)) {
         $this->metabox[0]['fields'][] = array('label' => __('Payment', ST_TEXTDOMAIN), 'id' => 'payment_detail_tab', 'type' => 'tab');
         foreach ($data_paypment as $k => $v) {
             $this->metabox[0]['fields'][] = array('label' => $v->get_name(), 'id' => 'is_meta_payment_gateway_' . $k, 'type' => 'on-off', 'desc' => $v->get_name(), 'std' => 'on');
         }
     }
     $custom_field = self::get_custom_fields();
     if (!empty($custom_field) and is_array($custom_field)) {
         $this->metabox[0]['fields'][] = array('label' => __('Custom fields', ST_TEXTDOMAIN), 'id' => 'custom_field_tab', 'type' => 'tab');
         foreach ($custom_field as $k => $v) {
             $key = str_ireplace('-', '_', 'st_custom_' . sanitize_title($v['title']));
             $this->metabox[0]['fields'][] = array('label' => $v['title'], 'id' => $key, 'type' => $v['type_field'], 'desc' => '<input value=\'[st_custom_meta key="' . $key . '"]\' type=text readonly />', 'std' => $v['default_field']);
         }
     }
     parent::register_metabox($this->metabox);
 }
 /**
  *
  *
  * @since 1.1.1
  * */
 function init_metabox()
 {
     //Room
     $this->metabox[] = array('id' => 'room_metabox', 'title' => __('Activity Setting', ST_TEXTDOMAIN), 'pages' => array('st_activity'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => __('General', ST_TEXTDOMAIN), 'id' => 'room_reneral_tab', 'type' => 'tab'), array('label' => __('Set as Featured', ST_TEXTDOMAIN), 'id' => 'is_featured', 'type' => 'on-off', 'desc' => __('Set this location is featured', ST_TEXTDOMAIN), 'std' => 'off'), array('label' => __('Custom Layout', ST_TEXTDOMAIN), 'id' => 'st_custom_layout', 'post_type' => 'st_layouts', 'desc' => __('Detail Tour Layout', ST_TEXTDOMAIN), 'type' => 'select', 'choices' => st_get_layout('st_activity')), array('label' => __('Gallery', ST_TEXTDOMAIN), 'id' => 'gallery', 'type' => 'gallery'), array('label' => __('Gallery style', ST_TEXTDOMAIN), 'id' => 'gallery_style', 'type' => 'select', 'choices' => array(array('value' => 'grid', 'label' => __('Grid', ST_TEXTDOMAIN)), array('value' => 'slider', 'label' => __('Slider', ST_TEXTDOMAIN)))), array('label' => __('Contact email addresses', ST_TEXTDOMAIN), 'id' => 'contact_email', 'type' => 'text', 'desc' => __('Contact email addresses', ST_TEXTDOMAIN)), array('label' => __('Website', ST_TEXTDOMAIN), 'id' => 'contact_web', 'type' => 'text', 'desc' => __('Website', ST_TEXTDOMAIN)), array('label' => __('Phone', ST_TEXTDOMAIN), 'id' => 'contact_phone', 'type' => 'text', 'desc' => __('Phone', ST_TEXTDOMAIN)), array('label' => __('Video', ST_TEXTDOMAIN), 'id' => 'video', 'type' => 'text', 'desc' => __('Please use youtube or vimeo video', ST_TEXTDOMAIN)), array('label' => __('Location', ST_TEXTDOMAIN), 'id' => 'location_reneral_tab', 'type' => 'tab'), array('label' => __('Location', ST_TEXTDOMAIN), 'id' => 'id_location', 'type' => 'post_select_ajax', 'post_type' => 'location'), array('label' => __('Address', ST_TEXTDOMAIN), 'id' => 'address', 'type' => 'text'), array('label' => __('Latitude', ST_TEXTDOMAIN), 'id' => 'map_lat', 'type' => 'text', 'desc' => __('Latitude <a href="http://www.latlong.net/" target="_blank">Get here</a>', ST_TEXTDOMAIN)), array('label' => __('Longitude', ST_TEXTDOMAIN), 'id' => 'map_lng', 'type' => 'text', 'desc' => __('Longitude', ST_TEXTDOMAIN)), array('label' => __('Map Zoom', ST_TEXTDOMAIN), 'id' => 'map_zoom', 'type' => 'text', 'desc' => __('Map Zoom', ST_TEXTDOMAIN), 'std' => 13), array('label' => __('Info setting', ST_TEXTDOMAIN), 'id' => 'activity_time_number_tab', 'type' => 'tab'), array('label' => __('Check In', ST_TEXTDOMAIN), 'id' => 'check_in', 'type' => 'date_picker'), array('label' => __('Check Out', ST_TEXTDOMAIN), 'id' => 'check_out', 'type' => 'date_picker'), array('label' => __('Activity Time', ST_TEXTDOMAIN), 'id' => 'activity-time', 'type' => 'text', 'desc' => __('The departure time of an activity', ST_TEXTDOMAIN)), array('label' => __('Duration', ST_TEXTDOMAIN), 'id' => 'duration', 'type' => 'text', 'desc' => __('The total time to take each activity package', ST_TEXTDOMAIN)), array('label' => __('Venue Facilities', ST_TEXTDOMAIN), 'id' => 'venue-facilities', 'type' => 'text', 'desc' => __('The facilities that customer may experience during activities', ST_TEXTDOMAIN)), array('label' => __('Price setting', ST_TEXTDOMAIN), 'id' => 'price_number_tab', 'type' => 'tab'), array('label' => __('Type Price', ST_TEXTDOMAIN), 'id' => 'type_price', 'type' => 'select', 'desc' => __('Type Price', ST_TEXTDOMAIN), 'choices' => array(array('value' => 'activity_price', 'label' => __('Price / Activity', ST_TEXTDOMAIN)), array('value' => 'people_price', 'label' => __('Price / Person', ST_TEXTDOMAIN)))), array('label' => sprintf(__('Price (%s)', ST_TEXTDOMAIN), TravelHelper::get_default_currency('symbol')), 'id' => 'price', 'type' => 'text', 'desc' => __('Price of this Activity', ST_TEXTDOMAIN), 'std' => 0, 'condition' => 'type_price:is(activity_price)'), array('label' => __('Adult Price', ST_TEXTDOMAIN), 'id' => 'adult_price', 'type' => 'text', 'desc' => __('Price per Adult', ST_TEXTDOMAIN), 'std' => 0, 'condition' => 'type_price:is(people_price)'), array('label' => __('Child Price', ST_TEXTDOMAIN), 'id' => 'child_price', 'type' => 'text', 'desc' => __('Price per Child', ST_TEXTDOMAIN), 'std' => 0, 'condition' => 'type_price:is(people_price)'), array('label' => __('Discount', ST_TEXTDOMAIN), 'desc' => __('Discount', ST_TEXTDOMAIN), 'id' => 'discount', 'type' => 'text', 'std' => 0), array('label' => __('Sale Schedule', ST_TEXTDOMAIN), 'id' => 'is_sale_schedule', 'type' => 'on-off', 'std' => 'off'), array('label' => __('Sale Price Date From', ST_TEXTDOMAIN), 'desc' => __('Sale Price Date From', ST_TEXTDOMAIN), 'id' => 'sale_price_from', 'type' => 'date-picker', 'condition' => 'is_sale_schedule:is(on)'), array('label' => __('Sale Price Date To', ST_TEXTDOMAIN), 'desc' => __('Sale Price Date To', ST_TEXTDOMAIN), 'id' => 'sale_price_to', 'type' => 'date-picker', 'condition' => 'is_sale_schedule:is(on)'), array('label' => __('Best Price Guarantee', ST_TEXTDOMAIN), 'id' => 'best-price-guarantee', 'type' => 'on-off', 'std' => 'off'), array('label' => __('Best Price Guarantee Text', ST_TEXTDOMAIN), 'id' => 'best-price-guarantee-text', 'type' => 'textarea', 'rows' => '2', 'condition' => 'best-price-guarantee:is(on)'), array('label' => __('Activity external booking', ST_TEXTDOMAIN), 'id' => 'st_activity_external_booking', 'type' => 'on-off', 'std' => "off"), array('label' => __('Activity external booking', ST_TEXTDOMAIN), 'id' => 'st_activity_external_booking_link', 'type' => 'text', 'std' => "", 'condition' => 'st_activity_external_booking:is(on)', 'desc' => "<em>" . __('Notice: Must be http://...', ST_TEXTDOMAIN) . "</em>"), array('id' => 'deposit_payment_status', 'label' => __("Deposit payment options", ST_TEXTDOMAIN), 'desc' => __('You can select <code>Disallow Deposit</code>, <code>Deposit by percent</code>, <code>Deposit by amount</code>'), 'type' => 'select', 'choices' => array(array('value' => '', 'label' => __('Disallow Deposit', ST_TEXTDOMAIN)), array('value' => 'percent', 'label' => __('Deposit by percent', ST_TEXTDOMAIN)), array('value' => 'amount', 'label' => __('Deposit by amount', ST_TEXTDOMAIN)))), array('label' => __('Deposit payment amount', ST_TEXTDOMAIN), 'desc' => __('Leave empty for disallow deposit payment', ST_TEXTDOMAIN), 'id' => 'deposit_payment_amount', 'type' => 'text', 'condition' => 'deposit_payment_status:not()')));
     $data_paypment = STPaymentGateways::$_payment_gateways;
     if (!empty($data_paypment) and is_array($data_paypment)) {
         $this->metabox[0]['fields'][] = array('label' => __('Payment', ST_TEXTDOMAIN), 'id' => 'payment_detail_tab', 'type' => 'tab');
         foreach ($data_paypment as $k => $v) {
             $this->metabox[0]['fields'][] = array('label' => $v->get_name(), 'id' => 'is_meta_payment_gateway_' . $k, 'type' => 'on-off', 'desc' => $v->get_name(), 'std' => 'on');
         }
     }
     $custom_field = st()->get_option('st_activity_unlimited_custom_field');
     if (!empty($custom_field) and is_array($custom_field)) {
         $this->metabox[0]['fields'][] = array('label' => __('Custom fields', ST_TEXTDOMAIN), 'id' => 'custom_field_tab', 'type' => 'tab');
         foreach ($custom_field as $k => $v) {
             $key = str_ireplace('-', '_', 'st_custom_' . sanitize_title($v['title']));
             $this->metabox[0]['fields'][] = array('label' => $v['title'], 'id' => $key, 'type' => $v['type_field'], 'desc' => '<input value=\'[st_custom_meta key="' . $key . '"]\' type=text readonly />', 'std' => $v['default_field']);
         }
     }
     parent::register_metabox($this->metabox);
 }
示例#5
0
                foreach ($value as $key2 => $value2) {
                    echo "<input  type='hidden' name='{$key}[{$key2}]' value='{$value2}' >";
                }
            }
        } else {
            if ($key != "price_range") {
                echo "<input type='hidden' name='{$key}' value='{$value}' >";
            }
        }
    }
}
$data_min_max = TravelerObject::get_min_max_price('st_hotel');
$max = $data_min_max['price_max'];
$min = $data_min_max['price_min'];
if (TravelHelper::get_default_currency('rate') != 0 and TravelHelper::get_default_currency('rate')) {
    $rate_change = TravelHelper::get_current_currency('rate') / TravelHelper::get_default_currency('rate');
    $max = round($rate_change * $max);
    $min = round($rate_change * $min);
}
/*$min = number_format($min , TravelHelper::get_current_currency('booking_currency_precision')) ;
  $max = number_format($max , TravelHelper::get_current_currency('booking_currency_precision')) ;*/
$value_show = $min . ";" . $max;
// default if error
if ($rate_change) {
    if (STInput::request('price_range')) {
        $price_range = explode(';', STInput::request('price_range'));
        $value_show = $price_range[0] . ";" . $price_range[1];
    } else {
        $value_show = $min . ";" . $max;
    }
}
示例#6
0
 function do_add_to_cart($array = array())
 {
     $form_validate = true;
     if (empty($array)) {
         $array = STInput::post();
     }
     $default = array('item_id' => '', 'number_room' => 1, 'price' => '', 'start' => '', 'end' => '', 'adult' => 1, 'children' => 0);
     $array = wp_parse_args($array, $default);
     extract($array);
     $data = array('check_in' => $start, 'check_out' => $end, 'currency' => TravelHelper::get_default_currency('symbol'), 'adult' => $adult, 'children' => $children);
     //Validate available number
     $form_validate = $this->_add_cart_check_available($item_id, $data);
     if ($form_validate) {
         $form_validate = apply_filters('st_rental_add_cart_validate', $form_validate);
     }
     if ($form_validate) {
         STCart::add_cart($item_id, $number_room, $price, $data);
     }
     return $form_validate;
 }
示例#7
0
$time = STCars::get_date_diff($start, $end);
///// get Price
$info_price = STCars::get_info_price(get_the_ID(), $start, $end);
$cars_price = $info_price['price'];
$count_sale = $info_price['discount'];
$price_origin = $info_price['price_origin'];
$list_price = $info_price['list_price'];
$data_price_tmp = STPrice::getSaleCarPrice(get_the_ID(), $price_origin, $start, $end);
?>
<form  id="form-booking-inpage" method="post" class="car_booking_form"  >
<div class="booking-item-price-calc">
    <div class="row row-wrap">
        <?php 
$current_rate = 1;
$current = TravelHelper::get_current_currency('name');
$default = TravelHelper::get_default_currency('name');
if ($current != $default) {
    $current_rate = TravelHelper::get_current_currency('rate');
}
?>
        <input type="hidden" name="price_rate" value="<?php 
echo esc_html($current_rate);
?>
">
        <div class="col-md-<?php 
echo esc_attr($col);
?>
 singe_cars" data-car-id="<?php 
the_ID();
?>
">
示例#8
0
 /**
  *
  *
  * @since 1.1.1
  * */
 function init_metabox()
 {
     $this->metabox[] = array('id' => 'cars_metabox', 'title' => __('Cars Setting', ST_TEXTDOMAIN), 'desc' => '', 'pages' => array('st_cars'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => __('Location', ST_TEXTDOMAIN), 'id' => 'location_tab', 'type' => 'tab'), array('label' => __('Location', ST_TEXTDOMAIN), 'id' => 'multi_location', 'type' => 'list_item_post_type', 'desc' => __('Car Location', ST_TEXTDOMAIN), 'post_type' => 'location'), array('label' => __('Address', ST_TEXTDOMAIN), 'id' => 'cars_address', 'type' => 'text', 'desc' => __('Address', ST_TEXTDOMAIN)), array('label' => __('Maps', ST_TEXTDOMAIN), 'id' => 'st_google_map', 'type' => 'bt_gmap', 'desc' => __('Maps', ST_TEXTDOMAIN), 'std' => 'off'), array('label' => __('Car Details', ST_TEXTDOMAIN), 'id' => 'room_car_tab', 'type' => 'tab'), array('label' => __('Set as Featured', ST_TEXTDOMAIN), 'id' => 'is_featured', 'type' => 'on-off', 'desc' => __('This is set as featured', ST_TEXTDOMAIN), 'std' => 'off'), array('label' => __('Detail Car Layout', ST_TEXTDOMAIN), 'id' => 'st_custom_layout', 'post_type' => 'st_layouts', 'desc' => __('Detail Car Layout', ST_TEXTDOMAIN), 'type' => 'select', 'choices' => st_get_layout('st_cars')), array('label' => __('Gallery', ST_TEXTDOMAIN), 'id' => 'gallery', 'type' => 'gallery'), array('label' => __('Equipment Price List', ST_TEXTDOMAIN), 'desc' => __('Equipment Price List', ST_TEXTDOMAIN), 'id' => 'cars_equipment_list', 'type' => 'list-item', 'settings' => array(array('id' => 'cars_equipment_list_price', 'label' => __('Price', ST_TEXTDOMAIN), 'type' => 'text'), array('id' => 'price_unit', 'label' => __('Price Unit', ST_TEXTDOMAIN), 'desc' => __('You can choose <code>Fixed Price</code>, <code>Price per Hour</code>, <code>Price per Day</code>', ST_TEXTDOMAIN), 'type' => 'select', 'choices' => array(array('value' => '', 'label' => __('Fixed Price', ST_TEXTDOMAIN)), array('value' => 'per_hour', 'label' => __('Price per Hour', ST_TEXTDOMAIN)), array('value' => 'per_day', 'label' => __('Price per Day', ST_TEXTDOMAIN)))), array('id' => 'cars_equipment_list_price_max', 'label' => __('Price Max', ST_TEXTDOMAIN), 'type' => 'text', 'condition' => 'price_unit:not()'))), array('label' => __('Features', ST_TEXTDOMAIN), 'desc' => __('Features', ST_TEXTDOMAIN), 'id' => 'cars_equipment_info', 'type' => 'list-item', 'settings' => array(array('id' => 'cars_equipment_taxonomy_id', 'label' => __('Taxonomy', ST_TEXTDOMAIN), 'type' => 'select', 'operator' => 'and', 'choices' => self::$data_term), array('id' => 'cars_equipment_taxonomy_info', 'label' => __('Taxonomy Info', ST_TEXTDOMAIN), 'type' => 'text'))), array('label' => __('Video', ST_TEXTDOMAIN), 'id' => 'video', 'type' => 'text', 'desc' => __('Please use youtube or vimeo video', ST_TEXTDOMAIN)), array('label' => __('Contact Details', ST_TEXTDOMAIN), 'id' => 'room_contact_tab', 'type' => 'tab'), array('label' => __('Logo', ST_TEXTDOMAIN), 'id' => 'cars_logo', 'type' => 'upload', 'desc' => __('Logo', ST_TEXTDOMAIN)), array('label' => __('Car manufacturer name', ST_TEXTDOMAIN), 'id' => 'cars_name', 'type' => 'text', 'desc' => __('Car manufacturer name', ST_TEXTDOMAIN)), array('label' => __('Email', ST_TEXTDOMAIN), 'id' => 'cars_email', 'type' => 'text', 'desc' => __('E-mail Car Agent, this address will received email when have new booking', ST_TEXTDOMAIN)), array('label' => __('Phone', ST_TEXTDOMAIN), 'id' => 'cars_phone', 'type' => 'text', 'desc' => __('Phone', ST_TEXTDOMAIN)), array('label' => __('About', ST_TEXTDOMAIN), 'desc' => __('About', ST_TEXTDOMAIN), 'id' => 'cars_about', 'type' => 'textarea'), array('label' => __('Price setting', ST_TEXTDOMAIN), 'id' => '_price_car_tab', 'type' => 'tab'), array('label' => sprintf(__('Price (%s)', ST_TEXTDOMAIN), TravelHelper::get_default_currency('symbol')), 'id' => 'cars_price', 'type' => 'text', 'desc' => __('Price', ST_TEXTDOMAIN)), array('label' => __('Custom Price', ST_TEXTDOMAIN), 'id' => 'is_custom_price', 'std' => 'off', 'type' => 'select', 'choices' => array(array('value' => 'price_by_number', 'label' => __('Price by number of day|hour', ST_TEXTDOMAIN)), array('value' => 'price_by_date', 'label' => __('Price by Date', ST_TEXTDOMAIN)))), array('label' => __("Price by Date", ST_TEXTDOMAIN), 'id' => 'st_custom_price_by_date', 'type' => 'st_custom_price', 'desc' => __('Price by Date', ST_TEXTDOMAIN), 'condition' => 'is_custom_price:is(price_by_date)'), array('label' => __("Price by number of day/hour", ST_TEXTDOMAIN), 'id' => 'price_by_number_of_day_hour', 'desc' => __('Price by number of day/hour', ST_TEXTDOMAIN), 'type' => 'list-item', 'condition' => 'is_custom_price:is(price_by_number)', 'settings' => array(array('id' => 'number_start', 'label' => __('Number Start', ST_TEXTDOMAIN), 'type' => 'text', 'operator' => 'and'), array('id' => 'number_end', 'label' => __('Number End', ST_TEXTDOMAIN), 'type' => 'text'), array('id' => 'price', 'label' => sprintf(__('Price (%s)', ST_TEXTDOMAIN), TravelHelper::get_default_currency('symbol')), 'type' => 'text'))), array('label' => __('Discount', ST_TEXTDOMAIN), 'id' => 'discount', 'type' => 'text', 'desc' => __('%', ST_TEXTDOMAIN), 'std' => 0), array('label' => __('Sale Schedule', ST_TEXTDOMAIN), 'id' => 'is_sale_schedule', 'type' => 'on-off', 'std' => 'off'), array('label' => __('Sale Price Date From', ST_TEXTDOMAIN), 'desc' => __('Sale Price Date From', ST_TEXTDOMAIN), 'id' => 'sale_price_from', 'type' => 'date-picker', 'condition' => 'is_sale_schedule:is(on)'), array('label' => __('Sale Price Date To', ST_TEXTDOMAIN), 'desc' => __('Sale Price Date To', ST_TEXTDOMAIN), 'id' => 'sale_price_to', 'type' => 'date-picker', 'condition' => 'is_sale_schedule:is(on)'), array('label' => __('Number of car for Rent', ST_TEXTDOMAIN), 'desc' => __('Number of car for Rent', ST_TEXTDOMAIN), 'id' => 'number_car', 'type' => 'text', 'std' => 1), array('id' => 'deposit_payment_status', 'label' => __("Deposit payment options", ST_TEXTDOMAIN), 'desc' => __('You can select <code>Disallow Deposit</code>, <code>Deposit by percent</code>, <code>Deposit by amount</code>'), 'type' => 'select', 'choices' => array(array('value' => '', 'label' => __('Disallow Deposit', ST_TEXTDOMAIN)), array('value' => 'percent', 'label' => __('Deposit by percent', ST_TEXTDOMAIN)), array('value' => 'amount', 'label' => __('Deposit by amount', ST_TEXTDOMAIN)))), array('label' => __('Deposit payment amount', ST_TEXTDOMAIN), 'desc' => __('Leave empty for disallow deposit payment', ST_TEXTDOMAIN), 'id' => 'deposit_payment_amount', 'type' => 'text', 'condition' => 'deposit_payment_status:not()'), array('label' => __('Car Options', ST_TEXTDOMAIN), 'id' => 'cars_options', 'type' => 'tab'), array('label' => __('Minimum days to book before rental', ST_TEXTDOMAIN), 'id' => 'cars_booking_period', 'type' => 'numeric-slider', 'min_max_step' => '0,30,1', 'std' => 0, 'desc' => __('The time period allowed booking.', ST_TEXTDOMAIN)), st()->get_option('cars_price_unit', 'day') == 'day' ? array('label' => __('Minimum days to book', ST_TEXTDOMAIN), 'id' => 'cars_booking_min_day', 'type' => 'numeric-slider', 'min_max_step' => '0,7,1', 'std' => 0, 'desc' => __('Minimum days to book', ST_TEXTDOMAIN)) : array('label' => __('Minimum hours to book', ST_TEXTDOMAIN), 'id' => 'cars_booking_min_hour', 'type' => 'numeric-slider', 'min_max_step' => '0,168,1', 'std' => 0, 'desc' => __('Minimum hours to book', ST_TEXTDOMAIN)), array('label' => __('Car external booking', ST_TEXTDOMAIN), 'id' => 'st_car_external_booking', 'type' => 'on-off', 'std' => "off"), array('label' => __('Car external booking link', ST_TEXTDOMAIN), 'id' => 'st_car_external_booking_link', 'type' => 'text', 'std' => "", 'condition' => 'st_car_external_booking:is(on)', 'desc' => "<i>" . __("Must be http://") . "</i>")));
     $data_paypment = STPaymentGateways::get_payment_gateways();
     if (!empty($data_paypment) and is_array($data_paypment)) {
         $this->metabox[0]['fields'][] = array('label' => __('Payment', ST_TEXTDOMAIN), 'id' => 'payment_detail_tab', 'type' => 'tab');
         foreach ($data_paypment as $k => $v) {
             $this->metabox[0]['fields'][] = array('label' => $v->get_name(), 'id' => 'is_meta_payment_gateway_' . $k, 'type' => 'on-off', 'desc' => $v->get_name(), 'std' => 'on');
         }
     }
     $custom_field = st()->get_option('st_cars_unlimited_custom_field');
     if (!empty($custom_field) and is_array($custom_field)) {
         $this->metabox[0]['fields'][] = array('label' => __('Custom fields', ST_TEXTDOMAIN), 'id' => 'custom_field_tab', 'type' => 'tab');
         foreach ($custom_field as $k => $v) {
             $key = str_ireplace('-', '_', 'st_custom_' . sanitize_title($v['title']));
             $this->metabox[0]['fields'][] = array('label' => $v['title'], 'id' => $key, 'type' => $v['type_field'], 'desc' => '<input value=\'[st_custom_meta key="' . $key . '"]\' type=text readonly />', 'std' => $v['default_field']);
         }
     }
     parent::register_metabox($this->metabox);
 }
示例#9
0
 function do_add_to_cart($array = array())
 {
     $pass_validate = TRUE;
     $default = array('item_id' => '', 'number_room' => 1, 'price' => '', 'data_price' => '', 'check_in' => '', 'check_out' => '', 'room_num_search' => '', 'room_id' => '', 'adult_num' => 1, 'child_num' => 0);
     $array = wp_parse_args($array, $default);
     extract($array);
     $data = array('check_in' => $check_in, 'check_out' => $check_out, 'data_price' => $data_price, 'currency' => TravelHelper::get_default_currency('symbol'), 'room_num_search' => $room_num_search, 'room_id' => $room_id, 'room_data' => array(), 'adult_num' => $adult_num, 'child_num' => $child_num);
     if (empty($check_in)) {
         STTemplate::set_message(__('Date is invalid', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
     }
     if (empty($check_out)) {
         STTemplate::set_message(__('Date is invalid', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
     }
     $num_room = intval(get_post_meta($room_id, 'number_room', true));
     $adult = intval(get_post_meta($room_id, 'adult_number', true));
     $children = intval(get_post_meta($room_id, 'children_number', true));
     if ($room_num_search > $num_room) {
         STTemplate::set_message(__('Max of rooms are incorrect.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
     }
     if ($adult_num > $adult) {
         STTemplate::set_message(__('Number of adults in the room are incorrect.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
     }
     if ($child_num > $children) {
         STTemplate::set_message(__('Number of children in the room are incorrect.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
     }
     if (!$this->_is_slot_available($room_id, $check_in, $check_out)) {
         STTemplate::set_message(__('Sorry! This Room is not available.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
     }
     $today = date('m/d/Y');
     $booking_period = $this->is_booking_period($item_id, $today, $check_in);
     if ($booking_period) {
         STTemplate::set_message(sprintf(__('Booking is only accepted %d day(s) before today.', ST_TEXTDOMAIN), $booking_period), 'danger');
         $pass_validate = FALSE;
     }
     if ($pass_validate) {
         $pass_validate = apply_filters('st_hotel_add_cart_validate', $pass_validate, $array);
     }
     if ($pass_validate) {
         STCart::add_cart($item_id, $number_room, $price, $data);
     }
     return $pass_validate;
 }