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 +63 -15 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($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">
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_activity['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->destinations) && is_array($trip->destinations)): ?>
@@ -204,23 +217,58 @@
204 217 </div>
205 218
206 219 <div class="yatra-trip-footer">
207 220 <div class="yatra-trip-price">
208 - <?php if (!empty($trip->original_price) && !empty($trip->effective_price_min) && $trip->original_price > $trip->effective_price_min): ?>
209 - <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>
210 251 <?php endif; ?>
211 252 <div class="yatra-current-price">
212 253 <?php
213 - if (!empty($trip->effective_price_min)) {
214 - echo esc_html(yatra_format_price($trip->effective_price_min));
215 - } elseif (!empty($trip->original_price)) {
216 - 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));
217 258 } else {
218 259 echo esc_html__('Price on request', 'yatra');
219 260 }
220 261 ?>
221 262 </div>
222 - <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; ?>
223 271 </div>
224 272 <a href="<?php echo esc_url($trip->permalink ?? ''); ?>" class="yatra-btn yatra-btn-primary yatra-archive-card-cta yatra-card-view-btn">
225 273 <?php echo yatra_svg_icon('file-text', 'yatra-btn-icon'); ?>
226 274 <span><?php esc_html_e('View Details', 'yatra'); ?></span>
@@ -234,9 +282,9 @@
234 282 <div style="text-align: center; padding: 40px; background: #f9fafb; border-radius: 12px; margin-bottom: 40px;">
235 283 <p style="color: #6b7280; margin: 0 0 16px 0;">
236 284 <?php esc_html_e('No trips are currently available with this activity.', 'yatra'); ?>
237 285 </p>
238 - <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() . '/')); ?>"
239 287 style="color: #2563eb; text-decoration: none; font-weight: 500;">
240 288 <?php esc_html_e('Browse all trips', 'yatra'); ?>
241 289 </a>
242 290 </div>
@@ -242,9 +290,9 @@
242 290 </div>
243 291 <?php endif; ?>
244 292
245 293 <div style="text-align: center;">
246 - <a href="<?php echo esc_url(home_url('/trip/?activity=' . urlencode($activity->slug))); ?>"
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() . '/'))); ?>"
247 295 class="yatra-btn"
248 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;">
249 297 <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
250 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"/>
@@ -255,9 +303,9 @@
255 303 </div>
256 304
257 305 <!-- Back to Activities -->
258 306 <div style="text-align: center; margin-top: 60px; padding-top: 40px; border-top: 1px solid #e5e7eb;">
259 - <a href="<?php echo esc_url(home_url('/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() . '/')); ?>"
260 308 style="color: #6b7280; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;">
261 309 <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
262 310 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"/>
263 311 </svg>