PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
yatra / templates / partials / single-trip / quick-facts.php

quick-facts.php in Yatra – Travel Booking & Tour Operator Software 3.0.16, at templates/partials/single-trip/quick-facts.php

184 lines 8.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) {
3 exit;
4 }
5
6 // Quick Facts Section for Single Trip Page
7 // Expected variables: $trip
8 ?>
9 <div class="yatra-trip-quick-facts-section">
10 <div class="yatra-spec-sheet yatra-spec-sheet--quick-facts">
11 <div class="yatra-trip-quick-facts">
12 <!-- Duration -->
13 <div class="yatra-quick-fact">
14 <div class="yatra-quick-fact-icon">
15 <?php echo yatra_svg_icon('calendar', 'yatra-icon-lg'); ?>
16 </div>
17 <div class="yatra-quick-fact-content">
18 <div class="yatra-quick-fact-label"><?php echo esc_html__('Duration', 'yatra'); ?></div>
19 <div class="yatra-quick-fact-value">
20 <?php
21 if ($trip->isHoursBased()) {
22 echo esc_html(yatra_format_duration(0, null, $trip->getDurationHours()));
23 } elseif ($trip->getTripType() === 'single_day') {
24 echo esc_html__('Day Trip', 'yatra');
25 } else {
26 echo esc_html(yatra_format_duration($trip->getDurationDays(), $trip->getDurationNights()));
27 }
28 ?>
29 </div>
30 </div>
31 </div>
32
33 <!-- Difficulty (use resolved name from classifications, not raw difficulty_level ID) -->
34 <?php
35 $difficulty = $trip->getDifficulty();
36 if (!empty($difficulty['has_difficulty']) && !empty($difficulty['level'])) :
37 ?>
38 <div class="yatra-quick-fact">
39 <div class="yatra-quick-fact-icon">
40 <?php
41 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
42 echo yatra_stored_picker_icon_markup($difficulty['icon_picker'] ?? null, 'mountain', 'yatra-icon-lg');
43 ?>
44 </div>
45 <div class="yatra-quick-fact-content">
46 <div class="yatra-quick-fact-label"><?php echo esc_html__('Difficulty', 'yatra'); ?></div>
47 <div class="yatra-quick-fact-value"><?php echo esc_html($difficulty['level']); ?></div>
48 </div>
49 </div>
50 <?php endif; ?>
51
52 <!-- Landmarks -->
53 <?php
54 $landmarks = $trip->getLandmarks();
55 if (!empty($landmarks)):
56 ?>
57 <div class="yatra-quick-fact">
58 <div class="yatra-quick-fact-icon">
59 <?php echo yatra_svg_icon('map-pin', 'yatra-icon-lg'); ?>
60 </div>
61 <div class="yatra-quick-fact-content">
62 <div class="yatra-quick-fact-label"><?php echo esc_html__('Landmarks', 'yatra'); ?></div>
63 <div class="yatra-quick-fact-value">
64 <?php
65 $landmark_count = count($landmarks);
66 /* translators: %d: number of landmarks. */
67 echo esc_html(sprintf(_n('%d landmark', '%d landmarks', $landmark_count, 'yatra'), $landmark_count));
68 ?>
69 </div>
70 </div>
71 </div>
72 <?php endif; ?>
73
74
75 <!-- Group Size -->
76 <div class="yatra-quick-fact">
77 <div class="yatra-quick-fact-icon">
78 <?php echo yatra_svg_icon('users', 'yatra-icon-lg'); ?>
79 </div>
80 <div class="yatra-quick-fact-content">
81 <div class="yatra-quick-fact-label"><?php echo esc_html__('Group Size', 'yatra'); ?></div>
82 <div class="yatra-quick-fact-value">
83 <?php
84 $min_travelers = $trip->getMinTravelers();
85 $max_travelers = $trip->getMaxTravelers();
86 /* translators: 1: minimum travelers, 2: maximum travelers. */
87 echo esc_html(sprintf(__('%1$d-%2$d travelers', 'yatra'), $min_travelers, $max_travelers));
88 ?>
89 </div>
90 </div>
91 </div>
92
93 <!-- Price (aligned with booking sidebar — TripPricingService, not legacy trip-level sale/original only) -->
94 <?php
95 $dp = (isset($display_pricing) && is_array($display_pricing))
96 ? $display_pricing
97 : \Yatra\Services\TripPricingService::resolveDisplayPricing($trip);
98 $qf_current = (float) ($dp['effective_price_min'] ?? 0);
99 $qf_original = (float) ($dp['min_category_original_price'] ?? 0);
100 if ($qf_original <= 0 && $qf_current > 0) {
101 $qf_original = (float) ($trip->getOriginalPrice() ?? 0);
102 }
103 if ($qf_current > 0 || $qf_original > 0):
104 $yatra_qf_dp = function_exists('yatra_get_dynamic_pricing_display_flags') ? yatra_get_dynamic_pricing_display_flags() : [
105 'show_original_price' => true,
106 'show_urgency_messages' => false,
107 ];
108 $show_strike = !empty($yatra_qf_dp['show_original_price']) && $qf_original > 0 && $qf_current > 0 && $qf_current < $qf_original;
109 ?>
110 <div class="yatra-quick-fact">
111 <div class="yatra-quick-fact-icon">
112 <?php echo yatra_svg_icon('dollar-sign', 'yatra-icon-lg'); ?>
113 </div>
114 <div class="yatra-quick-fact-content">
115 <div class="yatra-quick-fact-label"><?php echo esc_html__('Price', 'yatra'); ?></div>
116 <div class="yatra-quick-fact-value">
117 <?php if ($qf_current > 0): ?>
118 <span class="yatra-price-current"><?php echo esc_html(yatra_format_price($qf_current)); ?></span>
119 <?php if ($show_strike): ?>
120 <span class="yatra-price-original"><?php echo esc_html(yatra_format_price($qf_original)); ?></span>
121 <?php endif; ?>
122 <?php
123 if (!empty($yatra_qf_dp['show_urgency_messages']) && function_exists('yatra_trip_card_dynamic_pricing_urgency_lines')) {
124 $yatra_qf_urg = yatra_trip_card_dynamic_pricing_urgency_lines((int) $trip->getId(), [
125 'base_sale_price' => $qf_current,
126 'base_original_price' => $qf_original,
127 'sale_price' => $qf_current,
128 'original_price' => $qf_original,
129 'departure_date' => null,
130 'spots_remaining' => null,
131 'availability_id' => null,
132 'surface' => 'quick_facts',
133 ]);
134 foreach ($yatra_qf_urg as $yatra_qf_line) {
135 echo '<div class="yatra-quick-fact-dp-urgency" style="margin-top:6px;font-size:11px;line-height:1.35;color:#92400e;background:#fef3c7;padding:4px 6px;border-radius:4px;">' . esc_html($yatra_qf_line) . '</div>';
136 }
137 }
138 ?>
139 <?php else: ?>
140 <span class="yatra-price-current"><?php echo esc_html(yatra_format_price($qf_original)); ?></span>
141 <?php endif; ?>
142 </div>
143 </div>
144 </div>
145 <?php endif; ?>
146
147 <!-- Rating -->
148 <?php
149 $avg_rating = $trip->average_rating ?? 0;
150 $review_count = $trip->review_count ?? 0;
151
152 if ($avg_rating > 0):
153 ?>
154 <div class="yatra-quick-fact">
155 <div class="yatra-quick-fact-icon">
156 <?php echo yatra_svg_icon('star', 'yatra-icon-lg'); ?>
157 </div>
158 <div class="yatra-quick-fact-content">
159 <div class="yatra-quick-fact-label"><?php echo esc_html__('Reviews', 'yatra'); ?></div>
160 <div class="yatra-quick-fact-value">
161 <div class="yatra-rating-display">
162 <span class="yatra-rating-number"><?php echo esc_html(number_format($avg_rating, 1)); ?></span>
163 <div class="yatra-rating-stars">
164 <?php
165 $rating = round($avg_rating);
166 for ($i = 1; $i <= 5; $i++) {
167 if ($i <= $rating) {
168 echo '<span class="star-filled">�
169 </span>';
170 } else {
171 echo '<span class="star-empty">☆</span>';
172 }
173 }
174 ?>
175 </div>
176 <span class="yatra-review-count">(<?php echo esc_html($review_count); ?> <?php echo esc_html(_n('review', 'reviews', $review_count, 'yatra')); ?>)</span>
177 </div>
178 </div>
179 </div>
180 </div>
181 <?php endif; ?>
182 </div>
183 </div>
184 </div>