PluginProbe
Yatra – Travel Booking & Tour Operator Software / trunk
Yatra – Travel Booking & Tour Operator Software vtrunk
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 2.0.10 All 83 releases
← All changes | app/Controllers/SingleTripController.php +11 -4 3.0.14.2trunk View file →
@@ -396,11 +396,12 @@
396 396 {
397 397 // Use centralized AvailabilityResolutionService
398 398 $resolutionService = new \Yatra\Services\AvailabilityResolutionService();
399 399
400 - // Get dates for next 12 months
400 + // From today up to the configurable booking horizon (Settings → Booking;
401 + // 12 months unless changed — the previous hard-coded value).
401 402 $fromDate = date('Y-m-d');
402 - $toDate = date('Y-m-d', strtotime('+12 months'));
403 + $toDate = yatra_get_availability_horizon_date($fromDate);
403 404
404 405 $availability = $resolutionService->getAllAvailabilityDates($trip_id, $fromDate, $toDate, \Yatra\Services\SettingsService::isEnabled('show_sold_out'));
405 406
406 407 // Add calculated fields
@@ -1232,13 +1233,19 @@
1232 1233 */
1233 1234 private function getSimilarTrips(object $trip): array
1234 1235 {
1235 1236 $trip_id = (int) $trip->id;
1237 +
1238 + // Hour-based day tours (3.0.14+ column) — guarded so an install whose
1239 + // upgrade ALTER has not run yet keeps rendering similar trips.
1240 + $duration_hours_col = (new \Yatra\Repositories\TripRepository())->hasTripColumn('duration_hours')
1241 + ? ', duration_hours'
1242 + : '';
1236 1243
1237 1244 // Get similar trips based on category or difficulty
1238 1245 $similar = $this->wpdb->get_results(
1239 1246 $this->wpdb->prepare(
1240 - "SELECT id, title, slug, featured_image AS featured_image_id, '' AS featured_image_url, duration_days, duration_nights,
1247 + "SELECT id, title, slug, featured_image AS featured_image_id, '' AS featured_image_url, duration_days, duration_nights{$duration_hours_col},
1241 1248 original_price, sale_price, difficulty_level,
1242 1249 short_description
1243 1250 FROM {$this->table_trips} t
1244 1251 WHERE t.id != %d
@@ -1269,9 +1276,9 @@
1269 1276 // Fallback: Get any published trips if no similar found
1270 1277 if (empty($similar)) {
1271 1278 $similar = $this->wpdb->get_results(
1272 1279 $this->wpdb->prepare(
1273 - "SELECT id, title, slug, featured_image AS featured_image_id, '' AS featured_image_url, duration_days, duration_nights,
1280 + "SELECT id, title, slug, featured_image AS featured_image_id, '' AS featured_image_url, duration_days, duration_nights{$duration_hours_col},
1274 1281 original_price, sale_price, difficulty_level,
1275 1282 short_description
1276 1283 FROM {$this->table_trips}
1277 1284 WHERE id != %d