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 | app/Core/Handlers/ListingPageHandler.php +9 -20 3.0.3 → 3.0.16 View file →
@@ -4,9 +4,8 @@
4 4
5 5 namespace Yatra\Core\Handlers;
6 6
7 7 use Yatra\Core\Assets\ListingAssetManager;
8 -use Yatra\Core\Template\TemplateRenderer;
9 8
10 9 /**
11 10 * Listing Page Handler
12 11 *
@@ -39,18 +38,17 @@
39 38 return false;
40 39 }
41 40
42 41 $template = $template_map[$listing_type];
43 - $template_path = TemplateRenderer::getTemplatePath($template);
44 42
45 - if (!TemplateRenderer::templateExists($template)) {
46 - $this->logError("Listing template not found: {$template}");
47 - return false;
48 - }
43 + // Configure $wp_query + virtual WP_Post so FSE block themes resolve an archive
44 + // template (not 404.html) and render the site header normally.
45 + $this->setupPageEnvironment('archive', [
46 + 'title' => ucfirst($listing_type) . ' ' . __('Listing', 'yatra'),
47 + 'post_type' => 'page',
48 + 'post_name' => $base,
49 + ]);
49 50
50 - // Prevent 404 handling
51 - $this->prevent404();
52 -
53 51 // Set up query vars for backward compatibility
54 52 $this->setQueryVars([
55 53 'yatra_page' => $base,
56 54 ]);
@@ -74,8 +72,9 @@
74 72 'budget' => $_GET['budget'] ?? '',
75 73 'duration_min' => $_GET['duration_min'] ?? '',
76 74 'duration_max' => $_GET['duration_max'] ?? '',
77 75 'duration' => $_GET['duration'] ?? '',
76 + 'available_date' => $_GET['available_date'] ?? '',
78 77 'rating_min' => $_GET['rating_min'] ?? '',
79 78 'rating' => $_GET['rating'] ?? [],
80 79 'difficulty' => $_GET['difficulty'] ?? [],
81 80 'categories' => $_GET['categories'] ?? [],
@@ -104,18 +103,8 @@
104 103 }
105 104
106 105 // SEO meta, canonical, and JSON-LD are handled by {@see \Yatra\Managers\SEOManager} + {@see \Yatra\Services\SEOService}.
107 106
108 - // Create asset manager and render template
109 - $asset_manager = new ListingAssetManager($listing_type);
110 -
111 - if (!TemplateRenderer::render($template_path, [], $asset_manager)) {
112 - $this->logError("Failed to render listing template for type: {$listing_type}");
113 - return false;
114 - }
115 -
116 - $this->exit();
117 -
118 - return true;
107 + return $this->selectTemplate($template, new ListingAssetManager($listing_type), 'listing-' . $listing_type);
119 108 }
120 109
121 110 }