| @@ -6,9 +6,12 @@ | ||
| 6 | 6 | // Reviews Section |
| 7 | 7 | // Expected variables: $trip |
| 8 | 8 | ?> |
| 9 | 9 | <!-- Reviews: full width within unified trip container (same max-width + padding as .yatra-trip-container) --> |
| 10 | -<section class="yatra-reviews-section" id="reviews" itemscope itemtype="https://schema.org/Review"> | |
| 10 | +<?php // Structured data for reviews is emitted as JSON-LD (Product.review[]) in | |
| 11 | + // SEOService. The old itemtype="Review" here made the whole list a single | |
| 12 | + // Review with no author/itemReviewed, which Google flagged. ?> | |
| 13 | +<section class="yatra-reviews-section" id="reviews"> | |
| 11 | 14 | <div class="yatra-reviews-section-container"> |
| 12 | 15 | <div class="yatra-reviews-header"> |
| 13 | 16 | <h2 class="yatra-reviews-section-title"> |
| 14 | 17 | <?php echo yatra_svg_icon('star', 'yatra-reviews-section-icon'); ?> |
| @@ -13,9 +16,8 @@ | ||
| 13 | 16 | <h2 class="yatra-reviews-section-title"> |
| 14 | 17 | <?php echo yatra_svg_icon('star', 'yatra-reviews-section-icon'); ?> |
| 15 | 18 | <?php echo esc_html__('Reviews', 'yatra'); ?> |
| 16 | 19 | </h2> |
| 17 | - <meta itemprop="about" content="<?php echo esc_attr($trip->getTitle()); ?>"> | |
| 18 | 20 | </div> |
| 19 | 21 | |
| 20 | 22 | <?php |
| 21 | 23 | // Use dynamic reviews from database (via SingleTripController) |
| @@ -65,10 +67,13 @@ | ||
| 65 | 67 | <span class="yatra-rating-max">/5</span> |
| 66 | 68 | </div> |
| 67 | 69 | <div class="yatra-overall-stars"> |
| 68 | 70 | <?php |
| 69 | - $full_stars = floor($avg_rating); | |
| 70 | - $has_half = ($avg_rating - $full_stars) >= 0.3; | |
| 71 | + // Same helper as the confirmation page and listing cards, so a | |
| 72 | + // rating never renders differently on two screens. | |
| 73 | + $star_parts = yatra_rating_star_parts($avg_rating); | |
| 74 | + $full_stars = $star_parts['full']; | |
| 75 | + $has_half = $star_parts['half']; | |
| 71 | 76 | for ($i = 1; $i <= 5; $i++): |
| 72 | 77 | if ($i <= $full_stars): |
| 73 | 78 | ?> |
| 74 | 79 | <span class="yatra-star-icon filled">★</span> |