PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.17
Yatra – Travel Booking & Tour Operator Software v3.0.17
3.0.17 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 All 85 releases
← All changes | templates/partials/single-trip/quick-facts.php +59 -33 3.0.2.9 → 3.0.17 View file →
@@ -17,9 +17,11 @@
17 17 <div class="yatra-quick-fact-content">
18 18 <div class="yatra-quick-fact-label"><?php echo esc_html__('Duration', 'yatra'); ?></div>
19 19 <div class="yatra-quick-fact-value">
20 20 <?php
21 - if ($trip->getTripType() === 'single_day') {
21 + if ($trip->isHoursBased()) {
22 + echo esc_html(yatra_format_duration(0, null, $trip->getDurationHours()));
23 + } elseif ($trip->getTripType() === 'single_day') {
22 24 echo esc_html__('Day Trip', 'yatra');
23 25 } else {
24 26 echo esc_html(yatra_format_duration($trip->getDurationDays(), $trip->getDurationNights()));
25 27 }
@@ -27,29 +29,23 @@
27 29 </div>
28 30 </div>
29 31 </div>
30 32
31 - <!-- Difficulty -->
32 - <?php
33 - $difficulty_level = $trip->getDifficultyLevel();
34 - if (!empty($difficulty_level)):
35 - ?>
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 + ?>
36 38 <div class="yatra-quick-fact">
37 39 <div class="yatra-quick-fact-icon">
38 - <?php
39 - $difficulty_icons = [
40 - 'easy' => 'heart',
41 - 'moderate' => 'activity',
42 - 'challenging' => 'zap',
43 - 'difficult' => 'flame',
44 - ];
45 - $icon = $difficulty_icons[$difficulty_level] ?? 'mountain';
46 - echo yatra_svg_icon($icon, 'yatra-icon-lg');
40 + <?php
41 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
42 + echo yatra_stored_picker_icon_markup($difficulty['icon_picker'] ?? null, 'mountain', 'yatra-icon-lg');
47 43 ?>
48 44 </div>
49 45 <div class="yatra-quick-fact-content">
50 46 <div class="yatra-quick-fact-label"><?php echo esc_html__('Difficulty', 'yatra'); ?></div>
51 - <div class="yatra-quick-fact-value"><?php echo esc_html(ucfirst($difficulty_level)); ?></div>
47 + <div class="yatra-quick-fact-value"><?php echo esc_html($difficulty['level']); ?></div>
52 48 </div>
53 49 </div>
54 50 <?php endif; ?>
55 51
@@ -64,11 +60,12 @@
64 60 </div>
65 61 <div class="yatra-quick-fact-content">
66 62 <div class="yatra-quick-fact-label"><?php echo esc_html__('Landmarks', 'yatra'); ?></div>
67 63 <div class="yatra-quick-fact-value">
68 - <?php
64 + <?php
69 65 $landmark_count = count($landmarks);
70 - echo esc_html(sprintf(_n('%d landmark', '%d landmarks', $landmark_count, 'yatra'), $landmark_count));
66 + /* translators: %d: number of landmarks. */
67 + echo esc_html(sprintf(_n('%d landmark', '%d landmarks', $landmark_count, 'yatra'), $landmark_count));
71 68 ?>
72 69 </div>
73 70 </div>
74 71 </div>
@@ -82,21 +79,34 @@
82 79 </div>
83 80 <div class="yatra-quick-fact-content">
84 81 <div class="yatra-quick-fact-label"><?php echo esc_html__('Group Size', 'yatra'); ?></div>
85 82 <div class="yatra-quick-fact-value">
86 - <?php
83 + <?php
87 84 $min_travelers = $trip->getMinTravelers();
88 85 $max_travelers = $trip->getMaxTravelers();
89 - echo esc_html(sprintf(__('%d-%d travelers', 'yatra'), $min_travelers, $max_travelers));
86 + /* translators: 1: minimum travelers, 2: maximum travelers. */
87 + echo esc_html(sprintf(__('%1$d-%2$d travelers', 'yatra'), $min_travelers, $max_travelers));
90 88 ?>
91 89 </div>
92 90 </div>
93 91 </div>
94 92
95 - <!-- Price -->
96 - <?php
97 - $original_price = $trip->getOriginalPrice();
98 - if ($original_price > 0):
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;
99 109 ?>
100 110 <div class="yatra-quick-fact">
101 111 <div class="yatra-quick-fact-icon">
102 112 <?php echo yatra_svg_icon('dollar-sign', 'yatra-icon-lg'); ?>
@@ -103,17 +113,33 @@
103 113 </div>
104 114 <div class="yatra-quick-fact-content">
105 115 <div class="yatra-quick-fact-label"><?php echo esc_html__('Price', 'yatra'); ?></div>
106 116 <div class="yatra-quick-fact-value">
107 - <?php
108 - $sale_price = $trip->getSalePrice();
109 - if ($sale_price > 0 && $sale_price < $original_price) {
110 - echo '<span class="yatra-price-current">' . yatra_format_price($sale_price) . '</span>';
111 - echo ' <span class="yatra-price-original">' . yatra_format_price($original_price) . '</span>';
112 - } else {
113 - echo '<span class="yatra-price-current">' . yatra_format_price($original_price) . '</span>';
114 - }
115 - ?>
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; ?>
116 142 </div>
117 143 </div>
118 144 </div>
119 145 <?php endif; ?>