| @@ -56,12 +56,41 @@ | ||
| 56 | 56 | data-name="<?php echo esc_attr($current_filter_name); ?>" |
| 57 | 57 | style="display:none;"></div> |
| 58 | 58 | <?php endif; ?> |
| 59 | 59 | |
| 60 | -<div class="yatra-listing-page yatra-trip-listing" id="yatra-trip-listing-root"> | |
| 60 | +<?php | |
| 61 | +// Trip-listing card layout (Settings → Design). The archive follows the | |
| 62 | +// site-wide setting; the class is placed on this container so the listing CSS | |
| 63 | +// can key off it (see assets/css/listing.css "Compact card layout"). | |
| 64 | +$yatra_listing_layout_class = \Yatra\Providers\FrontendAssetsProvider::listingLayoutClasses( | |
| 65 | + \Yatra\Providers\FrontendAssetsProvider::resolveListingLayout() | |
| 66 | +); | |
| 67 | +?> | |
| 68 | +<div class="yatra-listing-page yatra-trip-listing<?php echo $yatra_listing_layout_class ? ' ' . esc_attr($yatra_listing_layout_class) : ''; ?>" id="yatra-trip-listing-root"> | |
| 61 | 69 | <!-- Trip Search Shortcode - replaces hardcoded search UI --> |
| 62 | 70 | <div class="yatra-trip-listing-search-wrap"> |
| 63 | - <?php echo do_shortcode('[yatra_search]'); ?> | |
| 71 | + <?php | |
| 72 | + // Build the [yatra_search] arguments from the Search & Listing toggles so | |
| 73 | + // the listing bar reflects the operator's settings explicitly at the call | |
| 74 | + // site. Each field becomes a yes/no argument the shortcode honours, so | |
| 75 | + // turning a field off in Settings → Search & Listing hides it here. | |
| 76 | + $yatra_search_field_settings = [ | |
| 77 | + 'keyword' => 'search_show_keyword', | |
| 78 | + 'destination' => 'search_show_destination', | |
| 79 | + 'activities' => 'search_show_activities', | |
| 80 | + 'duration' => 'search_show_duration', | |
| 81 | + 'budget' => 'search_show_budget', | |
| 82 | + ]; | |
| 83 | + $yatra_search_atts = ''; | |
| 84 | + foreach ($yatra_search_field_settings as $yatra_arg => $yatra_setting_key) { | |
| 85 | + $yatra_search_atts .= sprintf( | |
| 86 | + ' %s="%s"', | |
| 87 | + $yatra_arg, | |
| 88 | + \Yatra\Services\SettingsService::isEnabled($yatra_setting_key) ? 'yes' : 'no' | |
| 89 | + ); | |
| 90 | + } | |
| 91 | + echo do_shortcode('[yatra_search' . $yatra_search_atts . ']'); | |
| 92 | + ?> | |
| 64 | 93 | </div> |
| 65 | 94 | |
| 66 | 95 | <div class="yatra-listing-wrapper yatra-listing-wrapper--overlay-host"> |
| 67 | 96 | <div id="yatra-listing-loading-overlay" class="yatra-listing-loading-overlay" aria-hidden="true" role="status"> |
| @@ -134,9 +163,9 @@ | ||
| 134 | 163 | </div> |
| 135 | 164 | |
| 136 | 165 | <div class="yatra-listing-layout"> |
| 137 | 166 | <!-- Filter Sidebar - Comprehensive Filters --> |
| 138 | - <aside class="yatra-filter-sidebar"> | |
| 167 | + <aside class="yatra-filter-sidebar"<?php echo \Yatra\Services\SettingsService::isEnabled('collapse_filters_on_mobile') ? ' data-yatra-collapse-mobile="1"' : ''; ?>> | |
| 139 | 168 | <div class="yatra-filter-header"> |
| 140 | 169 | <h2><?php esc_html_e('Filters', 'yatra'); ?></h2> |
| 141 | 170 | <button type="button" class="yatra-clear-filters"><?php esc_html_e('Clear all', 'yatra'); ?></button> |
| 142 | 171 | </div> |
| @@ -144,11 +173,18 @@ | ||
| 144 | 173 | <!-- Price Range --> |
| 145 | 174 | <?php |
| 146 | 175 | $price_stats = $filter_data['price_stats'] ?? $tripListingService->getPriceStats(); |
| 147 | 176 | |
| 148 | - $min_price = $price_stats ? (int)$price_stats->min_price : 0; | |
| 149 | - $max_price = $price_stats ? (int)$price_stats->max_price : 10000; | |
| 150 | - $step = max(1, (int)($max_price / 100)); // Dynamic step based on price range | |
| 177 | + $min_price = $price_stats ? (int) floor($price_stats->min_price) : 0; | |
| 178 | + $max_price = $price_stats ? (int) ceil($price_stats->max_price) : 10000; | |
| 179 | + // Step 1 so the range slider can land EXACTLY on the true | |
| 180 | + // maximum price. A larger "dynamic" step (max/100) only lets | |
| 181 | + // the thumb stop on min + N*step, so unless (max - min) is a | |
| 182 | + // whole multiple of that step the slider caps short of the | |
| 183 | + // real max — e.g. min 9 / max 10000 / step 100 stops at | |
| 184 | + // 9909, hiding the most expensive trips from the filter. | |
| 185 | + // An integer step also keeps submitted price bounds whole. | |
| 186 | + $step = 1; | |
| 151 | 187 | ?> |
| 152 | 188 | <div class="yatra-filter-section"> |
| 153 | 189 | <div class="yatra-filter-title" data-toggle="price"> |
| 154 | 190 | <div class="yatra-filter-title-content"> |