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 +48 -18 3.0.2.7 → 3.0.16 View file →
@@ -140,21 +140,34 @@
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">
148 155 <?php if (!empty($trip->featured_image_url)): ?>
149 - <img src="<?php echo esc_url($trip->featured_image_url); ?>" alt="<?php echo esc_attr($trip->title ?? $trip->name ?? 'Trip'); ?>">
156 + <img src="<?php echo esc_url($trip->featured_image_url); ?>" alt="<?php echo esc_attr($trip->title ?? $trip->name ?? __('Trip', 'yatra')); ?>">
150 157 <?php else: ?>
151 - <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'); ?>">
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 - <?php echo esc_html($trip->discount_percentage); ?>% OFF
163 + <?php
164 + printf(
165 + /* translators: %s: discount percentage */
166 + esc_html__('%s%% OFF', 'yatra'),
167 + esc_html($trip->discount_percentage)
168 + );
169 + ?>
157 170 </div>
158 171 <?php endif; ?>
159 172
160 173 <?php if (function_exists('yatra_wishlist_enabled') && yatra_wishlist_enabled() && !empty($trip->id)) : ?>
@@ -180,9 +193,9 @@
180 193 </div>
181 194
182 195 <h3 class="yatra-trip-title">
183 196 <a href="<?php echo esc_url($trip->permalink ?? ''); ?>">
184 - <?php echo esc_html($trip->title ?? $trip->name ?? 'Untitled Trip'); ?>
197 + <?php echo esc_html($trip->title ?? $trip->name ?? __('Untitled Trip', 'yatra')); ?>
185 198 </a>
186 199 </h3>
187 200
188 201 <?php if (!empty($trip->activities) && is_array($trip->activities)): ?>
@@ -206,27 +219,37 @@
206 219 <div class="yatra-trip-footer">
207 220 <div class="yatra-trip-price">
208 221 <?php
209 222 // Apply dynamic pricing if module is enabled
210 - $display_original_price = $trip->original_price ?? 0;
211 - $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;
212 227
213 228 if (apply_filters('yatra_dynamic_pricing_enabled', false)) {
214 - if (!empty($display_original_price)) {
215 - $display_original_price = apply_filters('yatra_trip_display_price', $display_original_price, $trip->id ?? 0, [
216 - 'departure_date' => null,
217 - 'spots_remaining' => null,
218 - ]);
219 - }
220 229 if (!empty($display_effective_price)) {
221 230 $display_effective_price = apply_filters('yatra_trip_display_price', $display_effective_price, $trip->id ?? 0, [
222 231 'departure_date' => null,
223 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,
224 235 ]);
225 236 }
226 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 + : [];
227 250 ?>
228 - <?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): ?>
229 252 <div class="yatra-original-price"><?php echo esc_html(yatra_format_price($display_original_price)); ?></div>
230 253 <?php endif; ?>
231 254 <div class="yatra-current-price">
232 255 <?php
@@ -236,9 +259,16 @@
236 259 echo esc_html__('Price on request', 'yatra');
237 260 }
238 261 ?>
239 262 </div>
240 - <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; ?>
241 271 </div>
242 272 <a href="<?php echo esc_url($trip->permalink ?? ''); ?>" class="yatra-btn yatra-btn-primary yatra-archive-card-cta yatra-card-view-btn">
243 273 <?php echo yatra_svg_icon('file-text', 'yatra-btn-icon'); ?>
244 274 <span><?php esc_html_e('View Details', 'yatra'); ?></span>
@@ -252,9 +282,9 @@
252 282 <div style="text-align: center; padding: 40px; background: #f9fafb; border-radius: 12px; margin-bottom: 40px;">
253 283 <p style="color: #6b7280; margin: 0 0 16px 0;">
254 284 <?php esc_html_e('No trips are currently available for this destination.', 'yatra'); ?>
255 285 </p>
256 - <a href="<?php echo esc_url(home_url('/trip/')); ?>"
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() . '/')); ?>"
257 287 style="color: #2563eb; text-decoration: none; font-weight: 500;">
258 288 <?php esc_html_e('Browse all trips', 'yatra'); ?>
259 289 </a>
260 290 </div>
@@ -260,9 +290,9 @@
260 290 </div>
261 291 <?php endif; ?>
262 292
263 293 <div style="text-align: center;">
264 - <a href="<?php echo esc_url(home_url('/trip/?destination=' . urlencode($destination->slug))); ?>"
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() . '/'))); ?>"
265 295 class="yatra-btn"
266 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;">
267 297 <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
268 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"/>
@@ -273,9 +303,9 @@
273 303 </div>
274 304
275 305 <!-- Back to Destinations -->
276 306 <div style="text-align: center; margin-top: 60px; padding-top: 40px; border-top: 1px solid #e5e7eb;">
277 - <a href="<?php echo esc_url(home_url('/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() . '/')); ?>"
278 308 style="color: #6b7280; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;">
279 309 <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
280 310 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"/>
281 311 </svg>