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
← All changes | templates/single-destination.php +38 -14 3.0.2.9 → 3.0.16 View file →
@@ -140,8 +140,15 @@
140 140 <?php esc_html_e('Available Trips', 'yatra'); ?>
141 141 </h2>
142 142
143 143 <?php if (!empty($destination->trips) && is_array($destination->trips)): ?>
144 + <?php
145 + $yatra_dp_flags_destination = function_exists('yatra_get_dynamic_pricing_display_flags') ? yatra_get_dynamic_pricing_display_flags() : [
146 + 'show_original_price' => true,
147 + 'show_savings_badge' => true,
148 + 'show_urgency_messages' => false,
149 + ];
150 + ?>
144 151 <div class="yatra-trip-grid">
145 152 <?php foreach ($destination->trips as $trip): ?>
146 153 <div class="yatra-trip-card">
147 154 <div class="yatra-trip-image">
@@ -150,9 +157,9 @@
150 157 <?php else: ?>
151 158 <img src="<?php echo esc_url(plugins_url('assets/images/trip-placeholder.svg', YATRA_PLUGIN_FILE)); ?>" alt="<?php echo esc_attr($trip->title ?? $trip->name ?? __('Trip', 'yatra')); ?>">
152 159 <?php endif; ?>
153 160
154 - <?php if (!empty($trip->discount_percentage) && $trip->discount_percentage > 0): ?>
161 + <?php if (!empty($trip->discount_percentage) && $trip->discount_percentage > 0 && !empty($yatra_dp_flags_destination['show_savings_badge'])): ?>
155 162 <div class="yatra-discount-badge">
156 163 <?php
157 164 printf(
158 165 /* translators: %s: discount percentage */
@@ -212,27 +219,37 @@
212 219 <div class="yatra-trip-footer">
213 220 <div class="yatra-trip-price">
214 221 <?php
215 222 // Apply dynamic pricing if module is enabled
216 - $display_original_price = $trip->original_price ?? 0;
217 - $display_effective_price = $trip->effective_price_min ?? $trip->original_price ?? 0;
223 + $raw_orig_dest = (float) ($trip->original_price ?? 0);
224 + $raw_eff_dest = (float) ($trip->effective_price_min ?? $trip->original_price ?? 0);
225 + $display_original_price = $raw_orig_dest;
226 + $display_effective_price = $raw_eff_dest;
218 227
219 228 if (apply_filters('yatra_dynamic_pricing_enabled', false)) {
220 - if (!empty($display_original_price)) {
221 - $display_original_price = apply_filters('yatra_trip_display_price', $display_original_price, $trip->id ?? 0, [
222 - 'departure_date' => null,
223 - 'spots_remaining' => null,
224 - ]);
225 - }
226 229 if (!empty($display_effective_price)) {
227 230 $display_effective_price = apply_filters('yatra_trip_display_price', $display_effective_price, $trip->id ?? 0, [
228 231 'departure_date' => null,
229 232 'spots_remaining' => null,
233 + 'original_price' => $raw_orig_dest > 0 ? $raw_orig_dest : (float) $display_effective_price,
234 + 'discounted_price' => $raw_eff_dest > 0 ? $raw_eff_dest : (float) $display_effective_price,
230 235 ]);
231 236 }
232 237 }
238 + $yatra_dest_urgency = function_exists('yatra_trip_card_dynamic_pricing_urgency_lines')
239 + ? yatra_trip_card_dynamic_pricing_urgency_lines((int) ($trip->id ?? 0), [
240 + 'base_sale_price' => $raw_eff_dest,
241 + 'base_original_price' => $raw_orig_dest,
242 + 'sale_price' => (float) $display_effective_price,
243 + 'original_price' => (float) $display_original_price,
244 + 'departure_date' => null,
245 + 'spots_remaining' => null,
246 + 'availability_id' => null,
247 + 'surface' => 'destination_card',
248 + ])
249 + : [];
233 250 ?>
234 - <?php if (!empty($display_original_price) && !empty($display_effective_price) && $display_original_price > $display_effective_price): ?>
251 + <?php if (!empty($yatra_dp_flags_destination['show_original_price']) && !empty($display_original_price) && !empty($display_effective_price) && $display_original_price > $display_effective_price): ?>
235 252 <div class="yatra-original-price"><?php echo esc_html(yatra_format_price($display_original_price)); ?></div>
236 253 <?php endif; ?>
237 254 <div class="yatra-current-price">
238 255 <?php
@@ -242,9 +259,16 @@
242 259 echo esc_html__('Price on request', 'yatra');
243 260 }
244 261 ?>
245 262 </div>
246 - <div class="yatra-price-note"><?php esc_html_e('per person', 'yatra'); ?></div>
263 + <div class="yatra-price-note"><?php echo esc_html(\Yatra\Services\TripPricingService::resolveDisplayPricing($trip)['price_unit_label'] ?? __('per person', 'yatra')); ?></div>
264 + <?php if (!empty($yatra_dest_urgency)) : ?>
265 + <?php foreach ($yatra_dest_urgency as $yatra_d_urg) : ?>
266 + <div style="margin-top:6px;font-size:11px;line-height:1.35;color:#92400e;background:#fef3c7;padding:4px 6px;border-radius:4px;">
267 + <?php echo esc_html((string) $yatra_d_urg); ?>
268 + </div>
269 + <?php endforeach; ?>
270 + <?php endif; ?>
247 271 </div>
248 272 <a href="<?php echo esc_url($trip->permalink ?? ''); ?>" class="yatra-btn yatra-btn-primary yatra-archive-card-cta yatra-card-view-btn">
249 273 <?php echo yatra_svg_icon('file-text', 'yatra-btn-icon'); ?>
250 274 <span><?php esc_html_e('View Details', 'yatra'); ?></span>
@@ -258,9 +282,9 @@
258 282 <div style="text-align: center; padding: 40px; background: #f9fafb; border-radius: 12px; margin-bottom: 40px;">
259 283 <p style="color: #6b7280; margin: 0 0 16px 0;">
260 284 <?php esc_html_e('No trips are currently available for this destination.', 'yatra'); ?>
261 285 </p>
262 - <a href="<?php echo esc_url(home_url('/' . \Yatra\Services\SettingsService::getTripBase() . '/')); ?>"
286 + <a href="<?php echo esc_url(function_exists('yatra_get_trip_listing_url') ? yatra_get_trip_listing_url() : home_url('/' . \Yatra\Services\SettingsService::getTripBase() . '/')); ?>"
263 287 style="color: #2563eb; text-decoration: none; font-weight: 500;">
264 288 <?php esc_html_e('Browse all trips', 'yatra'); ?>
265 289 </a>
266 290 </div>
@@ -266,9 +290,9 @@
266 290 </div>
267 291 <?php endif; ?>
268 292
269 293 <div style="text-align: center;">
270 - <a href="<?php echo esc_url(add_query_arg(['destination' => urlencode($destination->slug)], home_url('/' . \Yatra\Services\SettingsService::getTripBase() . '/'))); ?>"
294 + <a href="<?php echo esc_url(add_query_arg(['destination' => urlencode($destination->slug)], function_exists('yatra_get_trip_listing_url') ? yatra_get_trip_listing_url() : home_url('/' . \Yatra\Services\SettingsService::getTripBase() . '/'))); ?>"
271 295 class="yatra-btn"
272 296 style="display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; background: #059669; color: white; text-decoration: none; border-radius: 6px; font-weight: 600; transition: background-color 0.2s;">
273 297 <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
274 298 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
@@ -279,9 +303,9 @@
279 303 </div>
280 304
281 305 <!-- Back to Destinations -->
282 306 <div style="text-align: center; margin-top: 60px; padding-top: 40px; border-top: 1px solid #e5e7eb;">
283 - <a href="<?php echo esc_url(home_url('/' . \Yatra\Services\SettingsService::getString('destination_base', 'destination') . '/')); ?>"
307 + <a href="<?php echo esc_url(function_exists('yatra_get_taxonomy_listing_url') ? yatra_get_taxonomy_listing_url('destination') : home_url('/' . \Yatra\Services\SettingsService::getDestinationBase() . '/')); ?>"
284 308 style="color: #6b7280; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;">
285 309 <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
286 310 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"/>
287 311 </svg>