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

180 lines 8.1 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 echo esc_html(sprintf(_n('%d landmark', '%d landmarks', $landmark_count, 'yatra'), $landmark_count));
65 ?>
66 </div>
67 </div>
68 </div>
69 <?php endif; ?>
70
71
72 <!-- Group Size -->
73 <div class="yatra-quick-fact">
74 <div class="yatra-quick-fact-icon">
75 <?php echo yatra_svg_icon('users', 'yatra-icon-lg'); ?>
76 </div>
77 <div class="yatra-quick-fact-content">
78 <div class="yatra-quick-fact-label"><?php echo esc_html__('Group Size', 'yatra'); ?></div>
79 <div class="yatra-quick-fact-value">
80 <?php
81 $min_travelers = $trip->getMinTravelers();
82 $max_travelers = $trip->getMaxTravelers();
83 echo esc_html(sprintf(__('%d-%d travelers', 'yatra'), $min_travelers, $max_travelers));
84 ?>
85 </div>
86 </div>
87 </div>
88
89 <!-- Price (aligned with booking sidebar — TripPricingService, not legacy trip-level sale/original only) -->
90 <?php
91 $dp = (isset($display_pricing) && is_array($display_pricing))
92 ? $display_pricing
93 : \Yatra\Services\TripPricingService::resolveDisplayPricing($trip);
94 $qf_current = (float) ($dp['effective_price_min'] ?? 0);
95 $qf_original = (float) ($dp['min_category_original_price'] ?? 0);
96 if ($qf_original <= 0 && $qf_current > 0) {
97 $qf_original = (float) ($trip->getOriginalPrice() ?? 0);
98 }
99 if ($qf_current > 0 || $qf_original > 0):
100 $yatra_qf_dp = function_exists('yatra_get_dynamic_pricing_display_flags') ? yatra_get_dynamic_pricing_display_flags() : [
101 'show_original_price' => true,
102 'show_urgency_messages' => false,
103 ];
104 $show_strike = !empty($yatra_qf_dp['show_original_price']) && $qf_original > 0 && $qf_current > 0 && $qf_current < $qf_original;
105 ?>
106 <div class="yatra-quick-fact">
107 <div class="yatra-quick-fact-icon">
108 <?php echo yatra_svg_icon('dollar-sign', 'yatra-icon-lg'); ?>
109 </div>
110 <div class="yatra-quick-fact-content">
111 <div class="yatra-quick-fact-label"><?php echo esc_html__('Price', 'yatra'); ?></div>
112 <div class="yatra-quick-fact-value">
113 <?php if ($qf_current > 0): ?>
114 <span class="yatra-price-current"><?php echo esc_html(yatra_format_price($qf_current)); ?></span>
115 <?php if ($show_strike): ?>
116 <span class="yatra-price-original"><?php echo esc_html(yatra_format_price($qf_original)); ?></span>
117 <?php endif; ?>
118 <?php
119 if (!empty($yatra_qf_dp['show_urgency_messages']) && function_exists('yatra_trip_card_dynamic_pricing_urgency_lines')) {
120 $yatra_qf_urg = yatra_trip_card_dynamic_pricing_urgency_lines((int) $trip->getId(), [
121 'base_sale_price' => $qf_current,
122 'base_original_price' => $qf_original,
123 'sale_price' => $qf_current,
124 'original_price' => $qf_original,
125 'departure_date' => null,
126 'spots_remaining' => null,
127 'availability_id' => null,
128 'surface' => 'quick_facts',
129 ]);
130 foreach ($yatra_qf_urg as $yatra_qf_line) {
131 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>';
132 }
133 }
134 ?>
135 <?php else: ?>
136 <span class="yatra-price-current"><?php echo esc_html(yatra_format_price($qf_original)); ?></span>
137 <?php endif; ?>
138 </div>
139 </div>
140 </div>
141 <?php endif; ?>
142
143 <!-- Rating -->
144 <?php
145 $avg_rating = $trip->average_rating ?? 0;
146 $review_count = $trip->review_count ?? 0;
147
148 if ($avg_rating > 0):
149 ?>
150 <div class="yatra-quick-fact">
151 <div class="yatra-quick-fact-icon">
152 <?php echo yatra_svg_icon('star', 'yatra-icon-lg'); ?>
153 </div>
154 <div class="yatra-quick-fact-content">
155 <div class="yatra-quick-fact-label"><?php echo esc_html__('Reviews', 'yatra'); ?></div>
156 <div class="yatra-quick-fact-value">
157 <div class="yatra-rating-display">
158 <span class="yatra-rating-number"><?php echo esc_html(number_format($avg_rating, 1)); ?></span>
159 <div class="yatra-rating-stars">
160 <?php
161 $rating = round($avg_rating);
162 for ($i = 1; $i <= 5; $i++) {
163 if ($i <= $rating) {
164 echo '<span class="star-filled">�
165 </span>';
166 } else {
167 echo '<span class="star-empty">☆</span>';
168 }
169 }
170 ?>
171 </div>
172 <span class="yatra-review-count">(<?php echo esc_html($review_count); ?> <?php echo esc_html(_n('review', 'reviews', $review_count, 'yatra')); ?>)</span>
173 </div>
174 </div>
175 </div>
176 </div>
177 <?php endif; ?>
178 </div>
179 </div>
180 </div>