| @@ -30,14 +30,18 @@ | ||
| 30 | 30 | </span> |
| 31 | 31 | </nav> |
| 32 | 32 | <h1 class="yatra-trip-hero-title-new" itemprop="name"><?php echo esc_html($trip->getTitle()); ?></h1> |
| 33 | 33 | <div class="yatra-hero-meta"> |
| 34 | - <div class="yatra-hero-rating" itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating"> | |
| 34 | + <?php // Rating is expressed via JSON-LD (Product.aggregateRating) in SEOService — no microdata here, which Google rejected on a TouristTrip parent. ?> | |
| 35 | + <div class="yatra-hero-rating"> | |
| 35 | 36 | <?php if ($trip->getAverageRating() > 0 || $trip->getReviewCount() > 0): ?> |
| 36 | 37 | <?php |
| 38 | + // Shared helper, so the hero, the reviews block below it and the | |
| 39 | + // booking confirmation all draw the same rating identically. | |
| 37 | 40 | $hero_avg = (float) $trip->getAverageRating(); |
| 38 | - $hero_full = (int) floor($hero_avg); | |
| 39 | - $hero_half = ($hero_avg - $hero_full) >= 0.3; | |
| 41 | + $hero_parts = yatra_rating_star_parts($hero_avg); | |
| 42 | + $hero_full = $hero_parts['full']; | |
| 43 | + $hero_half = $hero_parts['half']; | |
| 40 | 44 | ?> |
| 41 | 45 | <div class="yatra-rating-stars"> |
| 42 | 46 | <?php for ($i = 1; $i <= 5; $i++) : ?> |
| 43 | 47 | <?php |
| @@ -55,15 +59,13 @@ | ||
| 55 | 59 | $i |
| 56 | 60 | )); ?>">★</span> |
| 57 | 61 | <?php endfor; ?> |
| 58 | 62 | </div> |
| 59 | - <span class="yatra-rating-number" itemprop="ratingValue"><?php echo esc_html(number_format($trip->getAverageRating(), 1)); ?></span> | |
| 63 | + <span class="yatra-rating-number"><?php echo esc_html(number_format($trip->getAverageRating(), 1)); ?></span> | |
| 60 | 64 | <span class="yatra-rating-text"> |
| 61 | - <span itemprop="reviewCount"><?php echo esc_html($trip->getReviewCount()); ?></span> | |
| 65 | + <span><?php echo esc_html($trip->getReviewCount()); ?></span> | |
| 62 | 66 | <?php echo esc_html(_n('Review', 'Reviews', $trip->getReviewCount(), 'yatra')); ?> |
| 63 | 67 | </span> |
| 64 | - <meta itemprop="bestRating" content="5"> | |
| 65 | - <meta itemprop="worstRating" content="1"> | |
| 66 | 68 | <?php else: ?> |
| 67 | 69 | <div class="yatra-rating-stars yatra-no-rating"> |
| 68 | 70 | <?php for ($i = 1; $i <= 5; $i++): ?> |
| 69 | 71 | <span class="yatra-star" aria-label="<?php echo esc_attr(sprintf( |
| @@ -73,9 +75,8 @@ | ||
| 73 | 75 | )); ?>">★</span> |
| 74 | 76 | <?php endfor; ?> |
| 75 | 77 | </div> |
| 76 | 78 | <span class="yatra-rating-text yatra-no-reviews"><?php echo esc_html__('No reviews yet', 'yatra'); ?></span> |
| 77 | - <meta itemprop="reviewCount" content="0"> | |
| 78 | 79 | <?php endif; ?> |
| 79 | 80 | </div> |
| 80 | 81 | <?php if (!empty($trip->getStartingLocation())): ?> |
| 81 | 82 | <div class="yatra-hero-location" itemprop="location" itemscope itemtype="https://schema.org/Place"> |
| @@ -82,14 +83,17 @@ | ||
| 82 | 83 | <?php echo yatra_svg_icon('map-pin', 'yatra-icon-sm'); ?> |
| 83 | 84 | <span itemprop="name"><?php echo esc_html($trip->getStartingLocation()); ?></span> |
| 84 | 85 | </div> |
| 85 | 86 | <?php endif; ?> |
| 86 | - <?php if (!empty($trip->getDurationDays())): ?> | |
| 87 | + <?php if (!empty($trip->getDurationDays()) || $trip->getDurationHours() > 0): ?> | |
| 87 | 88 | <div class="yatra-hero-duration" itemprop="duration"> |
| 88 | 89 | <?php echo yatra_svg_icon('clock', 'yatra-icon-sm'); ?> |
| 89 | 90 | <span> |
| 90 | - <?php | |
| 91 | - if (!empty($trip->getDurationNights()) && $trip->getDurationNights() > 0) { | |
| 91 | + <?php | |
| 92 | + if ($trip->getDurationHours() > 0) { | |
| 93 | + // Hour-based day tour: "8 hours", not "1 day" (matches quick-facts). | |
| 94 | + echo esc_html(yatra_format_duration(0, null, $trip->getDurationHours())); | |
| 95 | + } elseif (!empty($trip->getDurationNights()) && $trip->getDurationNights() > 0) { | |
| 92 | 96 | echo esc_html(sprintf( |
| 93 | 97 | /* translators: 1: number of days, 2: number of nights. */ |
| 94 | 98 | _n('%1$d day %2$d night', '%1$d days %2$d nights', $trip->getDurationDays(), 'yatra'), |
| 95 | 99 | $trip->getDurationDays(), |