| @@ -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"> |
| @@ -80,8 +109,9 @@ | ||
| 80 | 109 | <p class="yatra-listing-archive-lede"><?php esc_html_e('Compare trips, filter by budget and trip style, then open a trip for full details and booking.', 'yatra'); ?></p> |
| 81 | 110 | <?php elseif (!empty($current_filter_name) || !empty($current_filter_slug)) : ?> |
| 82 | 111 | <p class="yatra-listing-archive-lede"><?php |
| 83 | 112 | printf( |
| 113 | + /* translators: %s: applied taxonomy filter label (destination, activity, or category name). */ | |
| 84 | 114 | esc_html__('Filtered by: %s', 'yatra'), |
| 85 | 115 | esc_html($current_filter_name !== '' ? $current_filter_name : (string) $current_filter_slug) |
| 86 | 116 | ); |
| 87 | 117 | ?></p> |
| @@ -89,9 +119,10 @@ | ||
| 89 | 119 | <p class="yatra-results-count"> |
| 90 | 120 | <?php |
| 91 | 121 | if ($yatra_results['display_total'] > 0) { |
| 92 | 122 | echo sprintf( |
| 93 | - __('Showing <strong>%d-%d</strong> of %d trips (Page %d of %d)', 'yatra'), | |
| 123 | + /* translators: 1: first item index on the page, 2: last item index on the page, 3: total trips, 4: current page number, 5: total page count. */ | |
| 124 | + __('Showing <strong>%1$d-%2$d</strong> of %3$d trips (Page %4$d of %5$d)', 'yatra'), | |
| 94 | 125 | (int) $yatra_results['start_item'], |
| 95 | 126 | (int) $yatra_results['end_item'], |
| 96 | 127 | (int) $yatra_results['display_total'], |
| 97 | 128 | $trip_current_page, |
| @@ -132,9 +163,9 @@ | ||
| 132 | 163 | </div> |
| 133 | 164 | |
| 134 | 165 | <div class="yatra-listing-layout"> |
| 135 | 166 | <!-- Filter Sidebar - Comprehensive Filters --> |
| 136 | - <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"' : ''; ?>> | |
| 137 | 168 | <div class="yatra-filter-header"> |
| 138 | 169 | <h2><?php esc_html_e('Filters', 'yatra'); ?></h2> |
| 139 | 170 | <button type="button" class="yatra-clear-filters"><?php esc_html_e('Clear all', 'yatra'); ?></button> |
| 140 | 171 | </div> |
| @@ -142,11 +173,18 @@ | ||
| 142 | 173 | <!-- Price Range --> |
| 143 | 174 | <?php |
| 144 | 175 | $price_stats = $filter_data['price_stats'] ?? $tripListingService->getPriceStats(); |
| 145 | 176 | |
| 146 | - $min_price = $price_stats ? (int)$price_stats->min_price : 0; | |
| 147 | - $max_price = $price_stats ? (int)$price_stats->max_price : 10000; | |
| 148 | - $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; | |
| 149 | 187 | ?> |
| 150 | 188 | <div class="yatra-filter-section"> |
| 151 | 189 | <div class="yatra-filter-title" data-toggle="price"> |
| 152 | 190 | <div class="yatra-filter-title-content"> |