You are here

Rooms module και επιλογη ημερολογιου

4 posts / 0 new
Τελευταία δημοσίευση
Rooms module και επιλογη ημερολογιου

Καλησπερα παιδια

Στηνω ενα site για ενοικιαζομενα δωματια και στην αρχικη σελιδα εχει ενα block για να επιλεξεις ημερομηνια απο εως για διαθεσιμοτητα δωματιων και τιμων. Οταν επιλεξεις στο απο ημερομηνια πχ στον Ιουνιο, στο εως δεν σου ξεκιναει να επιλεξεις απο τον Ιουνιο και μετα, παρα βαζει τον τρεχον μηνα δηλαδη Μαιο.
Γνωριζει κανεις πως θα το ρυθμισω οταν καποιος επιλεξει μια ημερομηνια εναρξης μετα να βγαλει στην επιλογη ληξης παντα μεταγενεστερη ημερομηνια απο αυτη της εναρξης;
Το site ειναι το http://www.psammos.gr

Αν μπορει καποιος να ριξει μια ματια μηπως με βοηθησει

Ευχαριστω

Drupal version: 
Edited by: nickla24 on 19 Μάιος 2017 - 9:56πμ

Καλησπέρα,
πως το έχεις κάνει αυτό το block ;
με custom form , με node type και fields date ;
Αν δεν είναι τίποτα από αυτά τα δύο κάντο με javascript τον έλεγχο.

Βασικά τώρα που το ξαναείδα μπορεί να γίνει αυτό με ένα ajax callback με hook form alter στο πεδίο departure date.

Ευχαριστώ Spyro
Απο οτι βρήκα είναι μια function μεσα στο template.php, δεν το έκανα εγω το είχε το theme

Μπορεις να με βοηθήσεις πως γίνεται με ajax callback γιατι δεν το γνωρίζω;

ειναι η παρακάτω

function md_hillter_form_rooms_booking_availability_search_form_block_alter(&$form, &$form_state) {
$form['rooms_date_range']['rooms_start_date']['#attributes']['class'][] = 'awe-calendar arrival-calendar';
$form['rooms_date_range']['rooms_end_date']['#attributes']['class'][] = 'awe-calendar departure-calendar';

$form['rooms_fieldset']['group_size_adults:1']['#attributes']['class'][] = 'awe-select';
$form['rooms_fieldset']['group_size_children:1']['#attributes']['class'][] = 'awe-select';

if(drupal_is_front_page()) {
$form['#prefix'] = '

';
$form['#suffix'] = '

';

$form['actions']['#prefix'] = '

';
$form['actions']['#suffix'] = '

';
$form['actions']['submit']['#attributes']['class'][] = 'awe-btn awe-btn-13';
$form['actions']['submit']['#value'] = t('check prices');
unset($form['rooms_fieldset']['table_header']);
unset($form['rooms_fieldset']['table_body']);
unset($form['rooms_fieldset']['rooms_label:1']);
unset($form['rooms_fieldset']['group_size_adults:1']['#prefix']);
unset($form['rooms_fieldset']['group_size_adults:1']['#suffix']);
unset($form['rooms_fieldset']['group_size_children:1']['#prefix']);
unset($form['rooms_fieldset']['group_size_children:1']['#suffix']);
unset($form['rooms_fieldset']['table_row:1']);
unset($form['rooms_fieldset']['table_end']);
unset($form['rooms_date_range']['rooms_start_date']['#title']);
unset($form['rooms_date_range']['rooms_end_date']['#title']);

$form['rooms_date_range']['rooms_start_date']['#suffix'] = '

' . t('Arrival Date') . '

';
$form['rooms_date_range']['rooms_end_date']['#suffix'] = '

' . t('Departure Date') . '

';
$form['rooms_fieldset']['group_size_adults:1']['#options'][0] = t('Adults');
$form['rooms_fieldset']['group_size_adults:1']['#default_value'] = 0;
$form['rooms_fieldset']['group_size_children:1']['#options'][0] = t('Children');
$form['rooms_fieldset']['group_size_children:1']['#default_value'] = 0;
} else {
$node = menu_get_object();
if (isset($node)) {
if($node->type == "unit_description") {
$rooms = _md_rooms_get_rooms_detail($node->nid);

$form['rooms_fieldset']['group_size_adults:1']['#title'] = t('Adults');
$form['rooms_fieldset']['group_size_children:1']['#title'] = t('Children');
$form['unit_type']['#default_value'] = $rooms['type'];
$form['actions']['submit']['#attributes']['class'][] = 'awe-btn awe-btn-13';
$form['actions']['submit']['#value'] = t('CHECK NOW');

unset($form['rooms_fieldset']['table_header']);
unset($form['rooms_fieldset']['table_body']);
unset($form['rooms_fieldset']['rooms_label:1']);
unset($form['rooms_fieldset']['group_size_adults:1']['#prefix']);
unset($form['rooms_fieldset']['group_size_adults:1']['#suffix']);
unset($form['rooms_fieldset']['group_size_children:1']['#prefix']);
unset($form['rooms_fieldset']['group_size_children:1']['#suffix']);
unset($form['rooms_fieldset']['table_row:1']);
unset($form['rooms_fieldset']['table_end']);

} else {
$form['rooms_date_range']['rooms_start_date']['#prefix'] = '

';
$form['rooms_date_range']['rooms_start_date']['#suffix'] = '

';
$form['rooms_date_range']['rooms_end_date']['#prefix'] = '

';
$form['rooms_date_range']['rooms_end_date']['#suffix'] = '

';

$form['conditions']['rooms']['#prefix'] = '

';
$form['conditions']['rooms']['#suffix'] = '

';
$form['conditions']['rooms']['#attributes']['class'][] = 'awe-select';
$form['conditions']['rooms']['#title'] = t('Rooms');

$form['unit_type']['#prefix'] = '

';
$form['unit_type']['#suffix'] = '

';
$form['unit_type']['#attributes']['class'][] = 'awe-select';

$total = $form['conditions']['rooms']['#default_value'];

for($i=1;$i <= $total; $i++) {
$form['rooms_fieldset']['rooms_label:' . $i]['#markup'] = t('Room ') . $i;
$form['rooms_fieldset']['group_size_adults:' . $i]['#attributes']['class'][] = 'awe-select';
$form['rooms_fieldset']['group_size_children:' . $i]['#attributes']['class'][] = 'awe-select';
}

$form['rooms_fieldset']['group_size_adults:1']['#title'] = t('Adult');
$form['rooms_fieldset']['group_size_children:1']['#title'] = t('Child');

$form['unit_type']['#attributes']['class'][] = 'awe-select';

$form['actions']['#prefix'] = '

';
$form['actions']['#suffix'] = '

';
$form['actions']['submit']['#attributes']['class'][] = 'awe-btn awe-btn-13';
}
} else {
$form['rooms_date_range']['rooms_start_date']['#prefix'] = '

';
$form['rooms_date_range']['rooms_start_date']['#suffix'] = '

';
$form['rooms_date_range']['rooms_end_date']['#prefix'] = '

';
$form['rooms_date_range']['rooms_end_date']['#suffix'] = '

';

$form['conditions']['rooms']['#prefix'] = '

';
$form['conditions']['rooms']['#suffix'] = '

';
$form['conditions']['rooms']['#attributes']['class'][] = 'awe-select';
$form['conditions']['rooms']['#title'] = t('Rooms');

$form['unit_type']['#prefix'] = '

';
$form['unit_type']['#suffix'] = '

';
$form['unit_type']['#attributes']['class'][] = 'awe-select';

$total = $form['conditions']['rooms']['#default_value'];

for($i=1;$i <= $total; $i++) {
$form['rooms_fieldset']['rooms_label:' . $i]['#markup'] = t('Room ') . $i;
$form['rooms_fieldset']['group_size_adults:' . $i]['#attributes']['class'][] = 'awe-select';
$form['rooms_fieldset']['group_size_children:' . $i]['#attributes']['class'][] = 'awe-select';
}

$form['rooms_fieldset']['group_size_adults:1']['#title'] = t('Adult');
$form['rooms_fieldset']['group_size_children:1']['#title'] = t('Child');

$form['unit_type']['#attributes']['class'][] = 'awe-select';

$form['actions']['#prefix'] = '

';
$form['actions']['#suffix'] = '

';
$form['actions']['submit']['#attributes']['class'][] = 'awe-btn awe-btn-13';
}
}
}

Θα κάνεις ένα custom module και θα βάλεις μέσα το hook_form_alter θα βρεις το id της φόρμας με dpm($form_id) (πρέπει να εγκαταστήσεις το devel) και μετά στο input του start date θα βάλεις ένα ajax callback δες εδώ . Θα σε βοηθήσει πολυ και το dpm($form)