| @@ -427,10 +427,13 @@ | ||
| 427 | 427 | <div class="yatra-summary-meta"> |
| 428 | 428 | <?php |
| 429 | 429 | $duration_days = (int) ($trip->duration_days ?? 0); |
| 430 | 430 | $duration_nights = isset($trip->duration_nights) ? (int) $trip->duration_nights : null; |
| 431 | + $duration_hours = (int) ($trip->duration_hours ?? 0); | |
| 431 | 432 | ?> |
| 432 | - <?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) : ?> | |
| 433 | 436 | <?php if ($duration_days <= 1) : ?> |
| 434 | 437 | <span><?php esc_html_e('Day Trip', 'yatra'); ?></span> |
| 435 | 438 | <?php else : ?> |
| 436 | 439 | <span><?php echo esc_html(yatra_format_duration($duration_days, $duration_nights)); ?></span> |
| @@ -664,19 +667,31 @@ | ||
| 664 | 667 | $service_name = $service['name']; |
| 665 | 668 | $service_description = (string) ($service['description'] ?? ''); |
| 666 | 669 | $service_price = (float) $service['price']; |
| 667 | 670 | $service_price_per = $service['price_per'] ?? 'person'; |
| 671 | + $service_price_type = $service['price_type'] ?? 'fixed'; | |
| 668 | 672 | $is_required = isset($service['is_required']) && ($service['is_required'] === true || $service['is_required'] === 1 || $service['is_required'] === '1'); |
| 669 | 673 | $is_included = isset($service['is_included']) && ($service['is_included'] === true || $service['is_included'] === 1 || $service['is_included'] === '1'); |
| 670 | 674 | $is_selected = in_array($service_id, $selected_service_ids, false); |
| 671 | 675 | |
| 672 | - $price_label = yatra_format_price($service_price); | |
| 673 | - if ($service_price_per === 'person') { | |
| 674 | - $price_label .= ' ' . __('per person', 'yatra'); | |
| 675 | - } elseif ($service_price_per === 'day') { | |
| 676 | - $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); | |
| 677 | 685 | } else { |
| 678 | - $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 | + } | |
| 679 | 694 | } |
| 680 | 695 | if ($is_included) { |
| 681 | 696 | $price_label = __('Included', 'yatra'); |
| 682 | 697 | } |