| @@ -330,12 +330,15 @@ | ||
| 330 | 330 | $pricing_mode = (!empty($pt->pricing_mode) && $pt->pricing_mode === 'per_group') ? 'per_group' : 'per_person'; |
| 331 | 331 | $age_info = ''; |
| 332 | 332 | if (isset($pt->age_min) || isset($pt->age_max)) { |
| 333 | 333 | if (isset($pt->age_min) && isset($pt->age_max)) { |
| 334 | - $age_info = sprintf(__('(Age %d-%d)', 'yatra'), $pt->age_min, $pt->age_max); | |
| 334 | + /* translators: 1: minimum age, 2: maximum age. */ | |
| 335 | + $age_info = sprintf(__('(Age %1$d-%2$d)', 'yatra'), $pt->age_min, $pt->age_max); | |
| 335 | 336 | } elseif (isset($pt->age_min)) { |
| 337 | + /* translators: %d: minimum age. */ | |
| 336 | 338 | $age_info = sprintf(__('(Age %d+)', 'yatra'), $pt->age_min); |
| 337 | 339 | } else { |
| 340 | + /* translators: %d: maximum age. */ | |
| 338 | 341 | $age_info = sprintf(__('(Up to age %d)', 'yatra'), $pt->age_max); |
| 339 | 342 | } |
| 340 | 343 | } |
| 341 | 344 | $input_id = 'traveler_' . $category_id; |
| @@ -346,17 +349,21 @@ | ||
| 346 | 349 | 'row_attrs' => [ |
| 347 | 350 | 'data-category-id' => $category_id, |
| 348 | 351 | 'data-price' => $category_price, |
| 349 | 352 | 'data-pricing-mode' => $pricing_mode, |
| 353 | + 'data-group-overflow' => $pt->group_overflow ?? 'block', | |
| 354 | + 'data-max-pax' => $pt->max_pax ?? '', | |
| 350 | 355 | ], |
| 351 | 356 | 'minus_disabled' => ($index !== 0 && $count <= 0), |
| 352 | 357 | 'plus_disabled' => false, |
| 353 | 358 | 'minus_attrs' => [ |
| 354 | 359 | 'data-target' => $input_id, |
| 360 | + /* translators: %s: traveler category label (e.g. "Adult", "Child"). */ | |
| 355 | 361 | 'aria-label' => sprintf(__('Decrease %s', 'yatra'), $category_label), |
| 356 | 362 | ], |
| 357 | 363 | 'plus_attrs' => [ |
| 358 | 364 | 'data-target' => $input_id, |
| 365 | + /* translators: %s: traveler category label (e.g. "Adult", "Child"). */ | |
| 359 | 366 | 'aria-label' => sprintf(__('Increase %s', 'yatra'), $category_label), |
| 360 | 367 | ], |
| 361 | 368 | 'input_attrs' => [ |
| 362 | 369 | 'id' => $input_id, |
| @@ -366,8 +373,10 @@ | ||
| 366 | 373 | 'max' => $trip->max_travelers ?: 20, |
| 367 | 374 | 'data-category-label' => $category_label, |
| 368 | 375 | 'data-price' => $category_price, |
| 369 | 376 | 'data-pricing-mode' => $pricing_mode, |
| 377 | + 'data-group-overflow' => $pt->group_overflow ?? 'block', | |
| 378 | + 'data-max-pax' => $pt->max_pax ?? '', | |
| 370 | 379 | ], |
| 371 | 380 | ]; |
| 372 | 381 | } |
| 373 | 382 | $traveler_display_text = !empty($traveler_rows) ? ($traveler_rows[0]['label'] . ' x ' . max(1, (int) $traveler_rows[0]['input_attrs']['value'])) : __('Traveler x 1', 'yatra'); |
| @@ -418,10 +427,13 @@ | ||
| 418 | 427 | <div class="yatra-summary-meta"> |
| 419 | 428 | <?php |
| 420 | 429 | $duration_days = (int) ($trip->duration_days ?? 0); |
| 421 | 430 | $duration_nights = isset($trip->duration_nights) ? (int) $trip->duration_nights : null; |
| 431 | + $duration_hours = (int) ($trip->duration_hours ?? 0); | |
| 422 | 432 | ?> |
| 423 | - <?php if ($duration_days > 0) : ?> | |
| 433 | + <?php if ($duration_hours > 0) : ?> | |
| 434 | + <span><?php echo esc_html(yatra_format_duration(0, null, $duration_hours)); ?></span> | |
| 435 | + <?php elseif ($duration_days > 0) : ?> | |
| 424 | 436 | <?php if ($duration_days <= 1) : ?> |
| 425 | 437 | <span><?php esc_html_e('Day Trip', 'yatra'); ?></span> |
| 426 | 438 | <?php else : ?> |
| 427 | 439 | <span><?php echo esc_html(yatra_format_duration($duration_days, $duration_nights)); ?></span> |
| @@ -433,9 +445,9 @@ | ||
| 433 | 445 | // classification FK id (e.g. 32), and that's |
| 434 | 446 | // what we'd otherwise render — "32" on the |
| 435 | 447 | // sidebar. Prefer the joined `difficulty_name` |
| 436 | 448 | // when present; fall back to a one-row lookup |
| 437 | - // in wp_yatra_new_classifications when only the | |
| 449 | + // in wp_yatra_classifications when only the | |
| 438 | 450 | // id arrived; finally fall back to the raw |
| 439 | 451 | // string (legacy trips that stored |
| 440 | 452 | // 'easy'/'moderate' before the FK migration). |
| 441 | 453 | $difficulty_label = ''; |
| @@ -655,19 +667,31 @@ | ||
| 655 | 667 | $service_name = $service['name']; |
| 656 | 668 | $service_description = (string) ($service['description'] ?? ''); |
| 657 | 669 | $service_price = (float) $service['price']; |
| 658 | 670 | $service_price_per = $service['price_per'] ?? 'person'; |
| 671 | + $service_price_type = $service['price_type'] ?? 'fixed'; | |
| 659 | 672 | $is_required = isset($service['is_required']) && ($service['is_required'] === true || $service['is_required'] === 1 || $service['is_required'] === '1'); |
| 660 | 673 | $is_included = isset($service['is_included']) && ($service['is_included'] === true || $service['is_included'] === 1 || $service['is_included'] === '1'); |
| 661 | 674 | $is_selected = in_array($service_id, $selected_service_ids, false); |
| 662 | 675 | |
| 663 | - $price_label = yatra_format_price($service_price); | |
| 664 | - if ($service_price_per === 'person') { | |
| 665 | - $price_label .= ' ' . __('per person', 'yatra'); | |
| 666 | - } elseif ($service_price_per === 'day') { | |
| 667 | - $price_label .= ' ' . __('per day', 'yatra'); | |
| 676 | + // Percentage services show "X% of trip price" (the actual | |
| 677 | + // dollar amount is rendered in the price-breakdown summary). | |
| 678 | + // Price Per does NOT apply to percentage (it's a % of the | |
| 679 | + // whole trip), so no per-person/day/booking suffix is added. | |
| 680 | + // Fixed services show the formatted amount plus the suffix. | |
| 681 | + if ($service_price_type === 'percentage') { | |
| 682 | + $pct_display = rtrim(rtrim(number_format($service_price, 2), '0'), '.'); | |
| 683 | + /* translators: %s: percentage value, e.g. "17" */ | |
| 684 | + $price_label = sprintf(__('%s%% of trip price', 'yatra'), $pct_display); | |
| 668 | 685 | } else { |
| 669 | - $price_label .= ' ' . __('per booking', 'yatra'); | |
| 686 | + $price_label = yatra_format_price($service_price); | |
| 687 | + if ($service_price_per === 'person') { | |
| 688 | + $price_label .= ' ' . __('per person', 'yatra'); | |
| 689 | + } elseif ($service_price_per === 'day') { | |
| 690 | + $price_label .= ' ' . __('per day', 'yatra'); | |
| 691 | + } else { | |
| 692 | + $price_label .= ' ' . __('per booking', 'yatra'); | |
| 693 | + } | |
| 670 | 694 | } |
| 671 | 695 | if ($is_included) { |
| 672 | 696 | $price_label = __('Included', 'yatra'); |
| 673 | 697 | } |