← All changes
|
templates/partials/single-trip/content-sidebar.php
+32
-7
3.0.4
→
3.0.16
View file →
| @@ -31,14 +31,21 @@ | ||
| 31 | 31 | 'has_discount' => $displayPricing['has_discount'], |
| 32 | 32 | 'raw_current_price' => $displayPricing['effective_price_min'], |
| 33 | 33 | 'raw_original_price' => $displayPricing['min_category_original_price'], |
| 34 | 34 | 'is_traveler_based' => $displayPricing['has_traveler_pricing'], |
| 35 | + // "per person" / "per group (1-2 pax)" — follows the category the shown price comes from | |
| 36 | + 'price_unit' => $displayPricing['price_unit'] ?? 'per_person', | |
| 37 | + 'price_unit_label' => $displayPricing['price_unit_label'] ?? __('per person', 'yatra'), | |
| 35 | 38 | ]; |
| 36 | 39 | |
| 37 | 40 | $discount = [ |
| 38 | 41 | 'has_discount' => $displayPricing['has_discount'] && $displayPricing['max_discount_percentage'] > 0, |
| 39 | 42 | 'discount_text' => $displayPricing['max_discount_percentage'] > 0 |
| 40 | - ? sprintf(__('Save up to %d%%', 'yatra'), $displayPricing['max_discount_percentage']) : '', | |
| 43 | + ? sprintf( | |
| 44 | + /* translators: %d: maximum discount percentage. */ | |
| 45 | + __('Save up to %d%%', 'yatra'), | |
| 46 | + $displayPricing['max_discount_percentage'] | |
| 47 | + ) : '', | |
| 41 | 48 | 'discount_percentage' => $displayPricing['max_discount_percentage'], |
| 42 | 49 | ]; |
| 43 | 50 | |
| 44 | 51 | $dp_display_sidebar = apply_filters('yatra_get_dynamic_pricing_display_settings', [ |
| @@ -76,9 +83,9 @@ | ||
| 76 | 83 | <?php if ($pricing['has_discount'] && !empty($pricing['original_price']) && $show_strike_original_sidebar): ?> |
| 77 | 84 | <span class="yatra-booking-price-original"><?php echo esc_html($pricing['original_price']); ?></span> |
| 78 | 85 | <?php endif; ?> |
| 79 | 86 | <span class="yatra-booking-price-amount" id="display-price"><?php echo esc_html($pricing['current_price']); ?></span> |
| 80 | - <span class="yatra-booking-price-label"><?php echo esc_html__('per person', 'yatra'); ?></span> | |
| 87 | + <span class="yatra-booking-price-label" data-price-unit="<?php echo esc_attr($pricing['price_unit']); ?>"><?php echo esc_html($pricing['price_unit_label']); ?></span> | |
| 81 | 88 | <?php if (!empty($yatra_sidebar_urgency)) : ?> |
| 82 | 89 | <?php foreach ($yatra_sidebar_urgency as $yatra_sb_urg) : ?> |
| 83 | 90 | <div class="yatra-booking-dp-urgency" style="background-color:#fef3c7;color:#92400e;padding:6px 8px;border-radius:6px;margin-top:8px;font-size:12px;line-height:1.35;"> |
| 84 | 91 | <?php echo esc_html((string) $yatra_sb_urg); ?> |
| @@ -105,8 +112,14 @@ | ||
| 105 | 112 | <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"/> |
| 106 | 113 | </svg> |
| 107 | 114 | <?php echo esc_html__('Send Enquiry', 'yatra'); ?> |
| 108 | 115 | </button> |
| 116 | + <?php | |
| 117 | + // AI: Chat-with-AI widget. The partial gates itself on the | |
| 118 | + // operator's enable flag + module-active state so it's a no-op | |
| 119 | + // when the feature is off. | |
| 120 | + yatra_get_template('partials/single-trip/ai-chat-widget', ['trip' => $trip]); | |
| 121 | + ?> | |
| 109 | 122 | </div> |
| 110 | 123 | <?php else: ?> |
| 111 | 124 | <div class="yatra-booking-card"> |
| 112 | 125 | |
| @@ -134,9 +147,9 @@ | ||
| 134 | 147 | <?php if ($pricing['has_discount'] && !empty($pricing['original_price']) && $show_strike_original_sidebar): ?> |
| 135 | 148 | <span class="yatra-booking-price-original"><?php echo esc_html($pricing['original_price']); ?></span> |
| 136 | 149 | <?php endif; ?> |
| 137 | 150 | <span class="yatra-booking-price-amount" id="display-price"><?php echo esc_html($pricing['current_price']); ?></span> |
| 138 | - <span class="yatra-booking-price-label"><?php echo esc_html__('per person', 'yatra'); ?></span> | |
| 151 | + <span class="yatra-booking-price-label" data-price-unit="<?php echo esc_attr($pricing['price_unit']); ?>"><?php echo esc_html($pricing['price_unit_label']); ?></span> | |
| 139 | 152 | <?php if (!empty($yatra_sidebar_urgency)) : ?> |
| 140 | 153 | <?php foreach ($yatra_sidebar_urgency as $yatra_sb_urg) : ?> |
| 141 | 154 | <div class="yatra-booking-dp-urgency" style="background-color:#fef3c7;color:#92400e;padding:6px 8px;border-radius:6px;margin-top:8px;font-size:12px;line-height:1.35;"> |
| 142 | 155 | <?php echo esc_html((string) $yatra_sb_urg); ?> |
| @@ -240,8 +253,9 @@ | ||
| 240 | 253 | $yatra_use_date_dropdown = (bool) apply_filters('yatra_use_date_dropdown', false, $trip) |
| 241 | 254 | && !empty($dropdown_options); |
| 242 | 255 | |
| 243 | 256 | echo esc_html(sprintf( |
| 257 | + /* translators: %d: number of departures available. */ | |
| 244 | 258 | _n('%d departure available', '%d departures available', $countAvailable, 'yatra'), |
| 245 | 259 | $countAvailable |
| 246 | 260 | )); |
| 247 | 261 | ?> |
| @@ -334,18 +348,24 @@ | ||
| 334 | 348 | <?php if (!empty($trip->getAvailableFrom()) || !empty($trip->getAvailableTo())): ?> |
| 335 | 349 | <span class="yatra-availability-note"> |
| 336 | 350 | <?php |
| 337 | 351 | if (!empty($trip->getAvailableFrom()) && !empty($trip->getAvailableTo())) { |
| 338 | - echo esc_html(sprintf(__('Available: %s - %s', 'yatra'), | |
| 352 | + echo esc_html(sprintf( | |
| 353 | + /* translators: 1: available-from date, 2: available-to date. */ | |
| 354 | + __('Available: %1$s - %2$s', 'yatra'), | |
| 339 | 355 | date_i18n(get_option('date_format'), strtotime($trip->getAvailableFrom())), |
| 340 | 356 | date_i18n(get_option('date_format'), strtotime($trip->getAvailableTo())) |
| 341 | 357 | )); |
| 342 | 358 | } elseif (!empty($trip->getAvailableFrom())) { |
| 343 | - echo esc_html(sprintf(__('Available from: %s', 'yatra'), | |
| 359 | + echo esc_html(sprintf( | |
| 360 | + /* translators: %s: available-from date. */ | |
| 361 | + __('Available from: %s', 'yatra'), | |
| 344 | 362 | date_i18n(get_option('date_format'), strtotime($trip->getAvailableFrom())) |
| 345 | 363 | )); |
| 346 | 364 | } else { |
| 347 | - echo esc_html(sprintf(__('Available until: %s', 'yatra'), | |
| 365 | + echo esc_html(sprintf( | |
| 366 | + /* translators: %s: available-until date. */ | |
| 367 | + __('Available until: %s', 'yatra'), | |
| 348 | 368 | date_i18n(get_option('date_format'), strtotime($trip->getAvailableTo())) |
| 349 | 369 | )); |
| 350 | 370 | } |
| 351 | 371 | ?> |
| @@ -455,8 +475,12 @@ | ||
| 455 | 475 | <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"/> |
| 456 | 476 | </svg> |
| 457 | 477 | <?php echo esc_html__('Make Enquiry', 'yatra'); ?> |
| 458 | 478 | </button> |
| 479 | + <?php | |
| 480 | + // AI: Chat-with-AI widget — bookable-trip branch. | |
| 481 | + yatra_get_template('partials/single-trip/ai-chat-widget', ['trip' => $trip]); | |
| 482 | + ?> | |
| 459 | 483 | |
| 460 | 484 | <!-- Cancellation Policy Trust Signal --> |
| 461 | 485 | <?php |
| 462 | 486 | $cancellation_policy = ''; |
| @@ -474,9 +498,10 @@ | ||
| 474 | 498 | if (preg_match('/(\d+)\s*(hour|day|week)s?\s*before/i', $cancellation_policy, $matches)) { |
| 475 | 499 | $time_value = $matches[1]; |
| 476 | 500 | $time_unit = $matches[2]; |
| 477 | 501 | $cancellation_text = sprintf( |
| 478 | - __('Free cancellation up to %d %s%s before', 'yatra'), | |
| 502 | + /* translators: 1: numeric time value, 2: time unit (hour/day/week), 3: plural suffix ("s" or empty). */ | |
| 503 | + __('Free cancellation up to %1$d %2$s%3$s before', 'yatra'), | |
| 479 | 504 | $time_value, |
| 480 | 505 | $time_unit, |
| 481 | 506 | $time_value > 1 ? 's' : '' |
| 482 | 507 | ); |