PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.13
Yatra – Travel Booking & Tour Operator Software v3.0.13
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.13, at templates/partials/single-trip/quick-facts.php

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