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-activity.php +53 -11 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($activity->trips) && is_array($activity->trips)): ?>
144 + <?php
145 + $yatra_dp_flags_activity = 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 ($activity->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_activity['show_savings_badge'])): ?>
155 162 <div class="yatra-discount-badge">
156 163 <?php
157 164 printf(
158 165 /* translators: %s: discount percentage */
@@ -210,23 +217,58 @@
210 217 </div>
211 218
212 219 <div class="yatra-trip-footer">
213 220 <div class="yatra-trip-price">
214 - <?php if (!empty($trip->original_price) && !empty($trip->effective_price_min) && $trip->original_price > $trip->effective_price_min): ?>
215 - <div class="yatra-original-price"><?php echo esc_html(yatra_format_price($trip->original_price)); ?></div>
221 + <?php
222 + $raw_orig_act = (float) ($trip->original_price ?? 0);
223 + $raw_eff_act = (float) ($trip->effective_price_min ?? $trip->original_price ?? 0);
224 + $disp_orig_act = $raw_orig_act;
225 + $disp_eff_act = $raw_eff_act;
226 + if (apply_filters('yatra_dynamic_pricing_enabled', false)) {
227 + if ($disp_eff_act > 0) {
228 + $disp_eff_act = apply_filters('yatra_trip_display_price', $disp_eff_act, (int) ($trip->id ?? 0), [
229 + 'departure_date' => null,
230 + 'spots_remaining' => null,
231 + 'original_price' => $raw_orig_act > 0 ? $raw_orig_act : (float) $disp_eff_act,
232 + 'discounted_price' => $raw_eff_act > 0 ? $raw_eff_act : (float) $disp_eff_act,
233 + ]);
234 + }
235 + }
236 + $yatra_act_urgency = function_exists('yatra_trip_card_dynamic_pricing_urgency_lines')
237 + ? yatra_trip_card_dynamic_pricing_urgency_lines((int) ($trip->id ?? 0), [
238 + 'base_sale_price' => $raw_eff_act,
239 + 'base_original_price' => $raw_orig_act,
240 + 'sale_price' => (float) $disp_eff_act,
241 + 'original_price' => (float) $disp_orig_act,
242 + 'departure_date' => null,
243 + 'spots_remaining' => null,
244 + 'availability_id' => null,
245 + 'surface' => 'activity_card',
246 + ])
247 + : [];
248 + ?>
249 + <?php if (!empty($yatra_dp_flags_activity['show_original_price']) && $disp_orig_act > 0 && $disp_eff_act > 0 && $disp_orig_act > $disp_eff_act): ?>
250 + <div class="yatra-original-price"><?php echo esc_html(yatra_format_price($disp_orig_act)); ?></div>
216 251 <?php endif; ?>
217 252 <div class="yatra-current-price">
218 253 <?php
219 - if (!empty($trip->effective_price_min)) {
220 - echo esc_html(yatra_format_price($trip->effective_price_min));
221 - } elseif (!empty($trip->original_price)) {
222 - echo esc_html(yatra_format_price($trip->original_price));
254 + if ($disp_eff_act > 0) {
255 + echo esc_html(yatra_format_price($disp_eff_act));
256 + } elseif ($disp_orig_act > 0) {
257 + echo esc_html(yatra_format_price($disp_orig_act));
223 258 } else {
224 259 echo esc_html__('Price on request', 'yatra');
225 260 }
226 261 ?>
227 262 </div>
228 - <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_act_urgency)) : ?>
265 + <?php foreach ($yatra_act_urgency as $yatra_a_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_a_urg); ?>
268 + </div>
269 + <?php endforeach; ?>
270 + <?php endif; ?>
229 271 </div>
230 272 <a href="<?php echo esc_url($trip->permalink ?? ''); ?>" class="yatra-btn yatra-btn-primary yatra-archive-card-cta yatra-card-view-btn">
231 273 <?php echo yatra_svg_icon('file-text', 'yatra-btn-icon'); ?>
232 274 <span><?php esc_html_e('View Details', 'yatra'); ?></span>
@@ -240,9 +282,9 @@
240 282 <div style="text-align: center; padding: 40px; background: #f9fafb; border-radius: 12px; margin-bottom: 40px;">
241 283 <p style="color: #6b7280; margin: 0 0 16px 0;">
242 284 <?php esc_html_e('No trips are currently available with this activity.', 'yatra'); ?>
243 285 </p>
244 - <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() . '/')); ?>"
245 287 style="color: #2563eb; text-decoration: none; font-weight: 500;">
246 288 <?php esc_html_e('Browse all trips', 'yatra'); ?>
247 289 </a>
248 290 </div>
@@ -248,9 +290,9 @@
248 290 </div>
249 291 <?php endif; ?>
250 292
251 293 <div style="text-align: center;">
252 - <a href="<?php echo esc_url(add_query_arg(['activity' => urlencode($activity->slug)], home_url('/' . \Yatra\Services\SettingsService::getTripBase() . '/'))); ?>"
294 + <a href="<?php echo esc_url(add_query_arg(['activity' => urlencode($activity->slug)], function_exists('yatra_get_trip_listing_url') ? yatra_get_trip_listing_url() : home_url('/' . \Yatra\Services\SettingsService::getTripBase() . '/'))); ?>"
253 295 class="yatra-btn"
254 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;">
255 297 <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
256 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"/>
@@ -261,9 +303,9 @@
261 303 </div>
262 304
263 305 <!-- Back to Activities -->
264 306 <div style="text-align: center; margin-top: 60px; padding-top: 40px; border-top: 1px solid #e5e7eb;">
265 - <a href="<?php echo esc_url(home_url('/' . \Yatra\Services\SettingsService::getString('activity_base', 'activity') . '/')); ?>"
307 + <a href="<?php echo esc_url(function_exists('yatra_get_taxonomy_listing_url') ? yatra_get_taxonomy_listing_url('activity') : home_url('/' . \Yatra\Services\SettingsService::getActivityBase() . '/')); ?>"
266 308 style="color: #6b7280; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;">
267 309 <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
268 310 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"/>
269 311 </svg>