| @@ -45,8 +45,10 @@ | ||
| 45 | 45 | /** Primary brand color (hex) for trip/booking/listing frontend — see FrontendThemeCss */ |
| 46 | 46 | 'frontend_primary_color' => '#3b82f6', |
| 47 | 47 | /** Max width for Yatra trip/booking/listing containers (CSS length). Empty = theme.json / content width / filter. */ |
| 48 | 48 | 'frontend_container_max_width' => '', |
| 49 | + /** Trip listing card density: 'standard' | 'compact_mobile' | 'compact_all'. */ | |
| 50 | + 'frontend_listing_card_layout' => 'standard', | |
| 49 | 51 | |
| 50 | 52 | // Booking |
| 51 | 53 | 'booking_base' => 'book', |
| 52 | 54 | 'use_booking_page' => false, |
| @@ -55,8 +57,13 @@ | ||
| 55 | 57 | 'privacy_policy_page_id' => 0, |
| 56 | 58 | 'enable_guest_booking' => true, |
| 57 | 59 | 'booking_confirmation' => true, |
| 58 | 60 | 'auto_confirm_bookings' => false, |
| 61 | + // Auto-confirm mode: none | online | all. Default 'online' (successful | |
| 62 | + // online payment => confirmed). Behaviour is resolved via | |
| 63 | + // yatra_get_auto_confirm_mode(), which uses the stored mode when set and | |
| 64 | + // otherwise derives from the legacy auto_confirm_bookings boolean. | |
| 65 | + 'auto_confirm_mode' => 'online', | |
| 59 | 66 | 'require_login' => false, |
| 60 | 67 | 'allow_guest_checkout' => true, |
| 61 | 68 | // Hold guest bookings in `pending_verification` status until |
| 62 | 69 | // the customer clicks a magic link sent to the email they |
| @@ -74,8 +81,12 @@ | ||
| 74 | 81 | // gracefully by skipping the cancellation paragraph or |
| 75 | 82 | // falling back to the per-trip cancellation_policy. |
| 76 | 83 | 'booking_expiry_hours' => 24, |
| 77 | 84 | 'booking_reminder_days' => 3, |
| 85 | + // Storefront booking horizon in months. 12 is the value that was | |
| 86 | + // hard-coded before it became configurable, so a site that never | |
| 87 | + // touches it behaves exactly as before. See yatra_get_availability_horizon_months(). | |
| 88 | + 'availability_horizon_months' => 12, | |
| 78 | 89 | 'allow_waitlist' => true, |
| 79 | 90 | 'waitlist_auto_confirm' => false, |
| 80 | 91 | // Pro: when enabled, the single-trip date_specific mode renders a |
| 81 | 92 | // <select> of available departure dates instead of the flatpickr |
| @@ -187,8 +198,12 @@ | ||
| 187 | 198 | 'search_show_destination' => true, |
| 188 | 199 | 'search_show_activities' => true, |
| 189 | 200 | 'search_show_duration' => true, |
| 190 | 201 | 'search_show_budget' => true, |
| 202 | + // Opt-in (default false): show a date field that filters trips to those | |
| 203 | + // with a departure on the selected date. Off by default so existing | |
| 204 | + // search bars are unchanged on update. | |
| 205 | + 'search_show_date' => false, | |
| 191 | 206 | // Collapse the listing filter sidebar sections on mobile. Default false |
| 192 | 207 | // = today's behaviour (all sections expanded on every viewport), so an |
| 193 | 208 | // existing site sees no change on update until the owner opts in. |
| 194 | 209 | 'collapse_filters_on_mobile' => false, |
| @@ -229,8 +244,15 @@ | ||
| 229 | 244 | 'trip_category_base' => 'trip-category', |
| 230 | 245 | |
| 231 | 246 | // SEO |
| 232 | 247 | 'enable_sitemap' => true, |
| 248 | + // Which Yatra content types appear in /yatra-sitemap.xml. Defaults to | |
| 249 | + // every type, so a site that never touches this keeps today's sitemap. | |
| 250 | + 'sitemap_types' => ['archive', 'trip', 'destination', 'activity', 'category'], | |
| 251 | + // Opt-in, and deliberately separate from the list above: dropping a type | |
| 252 | + // from the sitemap is housekeeping, while noindex de-indexes pages that | |
| 253 | + // may currently rank. That should never happen as a side effect. | |
| 254 | + 'sitemap_noindex_excluded' => false, | |
| 233 | 255 | |
| 234 | 256 | // Advanced |
| 235 | 257 | 'enable_debug_mode' => false, |
| 236 | 258 | 'delete_data_on_uninstall' => false, |
| @@ -314,12 +336,17 @@ | ||
| 314 | 336 | } |
| 315 | 337 | |
| 316 | 338 | /** |
| 317 | 339 | * Get booking form configuration (merged with defaults) |
| 318 | - * | |
| 340 | + * | |
| 341 | + * @param int|null $tripId Trip being booked. When given, Pro's Dynamic Form | |
| 342 | + * Field module resolves each section's per-trip | |
| 343 | + * conditions for that trip (title, description and | |
| 344 | + * field list); without it the full config is | |
| 345 | + * returned, conditions included (the Settings editor). | |
| 319 | 346 | * @return array |
| 320 | 347 | */ |
| 321 | - public static function getBookingFormConfig(): array | |
| 348 | + public static function getBookingFormConfig(?int $tripId = null): array | |
| 322 | 349 | { |
| 323 | 350 | $saved_config = self::get('booking_form_config', []); |
| 324 | 351 | $default_config = self::getDefaultBookingFormConfig(); |
| 325 | 352 | |
| @@ -324,9 +351,9 @@ | ||
| 324 | 351 | $default_config = self::getDefaultBookingFormConfig(); |
| 325 | 352 | |
| 326 | 353 | // If no saved config, return defaults (Pro may filter) |
| 327 | 354 | if (empty($saved_config)) { |
| 328 | - return apply_filters('yatra_booking_form_config', $default_config); | |
| 355 | + return apply_filters('yatra_booking_form_config', $default_config, $tripId); | |
| 329 | 356 | } |
| 330 | 357 | |
| 331 | 358 | // Merge saved over defaults. IMPORTANT: `fields` is a positional list, |
| 332 | 359 | // so a naive array_replace_recursive() merges field-by-INDEX — which |
| @@ -416,9 +443,9 @@ | ||
| 416 | 443 | $merged[$form_type] = $saved_section; |
| 417 | 444 | } |
| 418 | 445 | } |
| 419 | 446 | |
| 420 | - return apply_filters('yatra_booking_form_config', $merged); | |
| 447 | + return apply_filters('yatra_booking_form_config', $merged, $tripId); | |
| 421 | 448 | } |
| 422 | 449 | |
| 423 | 450 | private static function isEmailIdentityKey(string $key): bool |
| 424 | 451 | { |
| @@ -1053,8 +1080,16 @@ | ||
| 1053 | 1080 | 'scheduled_payment_days' => 15, |
| 1054 | 1081 | 'scheduled_payment_installments' => 1, |
| 1055 | 1082 | 'scheduled_payment_interval' => 30, |
| 1056 | 1083 | 'scheduled_payment_reminder_days' => 3, |
| 1084 | + // Anchor for the remaining-balance schedule: | |
| 1085 | + // 'booking' (default, backward-compatible) → balance charged | |
| 1086 | + // scheduled_payment_days after the deposit. | |
| 1087 | + // 'tour' → balance charged/collected balance_due_days BEFORE the | |
| 1088 | + // tour start date, and bookings made within that window | |
| 1089 | + // must pay in full up front. | |
| 1090 | + 'balance_anchor' => 'booking', | |
| 1091 | + 'balance_due_days' => 14, | |
| 1057 | 1092 | ]; |
| 1058 | 1093 | } |
| 1059 | 1094 | |
| 1060 | 1095 | private static function isScheduledPaymentSetting(string $key): bool |