File: D:/web/hyperflight/inc-template-reviews.asp
<%
' (SS,15/02/12) New for recent reviews and reviews page, product reviews are held in inc-template-other.asp
' (SS,23/05/12) Minor change to ShowReviewsPageItem
' (SS,28/08/14) Bootstrap version, version 2 of ShowRecentReviewsItem has more parameters, Recent Reviews link more to fotter and named More Reviews
' (SS,17/02/16) Changes to Sub ShowRecentReviewsItem to add Rich Snippets / Microdata
' (SS,15/09/17) Added Sub ShowProductReviewsInDescHeader, ShowProductReviewsInDescItem, ShowProductReviewsInDescFooter
' (SS,28/10/19) Changes to fix errors shown in Google Search Console due to it thinking values missing from reviews on the home page
' Added Sub ShowReviewAggregateRatingStructuredData. Removed rich snippets from Sub ShowRecentReviewsItem
' (SS,31/10/19) Change to Sub ShowReviewsPageItem to remove italics (<em> tag) from text to allow replies from HyperFlight to show distinctively
' (SS,14/05/21) Modified layout (Sub ShowRecentReviewsItem and styles.css) to look more like Trustpilot reviews, changed star colour from FFB500 to #f8b805 i.e. same as Google Stars
' (SS,14/06/24) Change to Sub ShowProductReviewsInDescItem, added "" to ShowReviewRatingStars for new options parameter
' Modified Sub ShowReviewsPageItem to add additional parameter "" to ShowReviewRatingStars
' --- START OF RECENT REVIEWS TEMPLATES --- '
Sub ShowRecentReviewsEmpty
' html to show if no recent reviews to go here '
%>
<%
End Sub
Sub ShowRecentReviewsHeader
%>
<div class="col-lg-6 col-md-6 col-12">
<div class="home-panel">
<div class="home-panel-heading">Latest Reviews</div>
<div class="home-panel-body">
<div id="recent-reviews">
<%
End Sub
' (SS,26/8/14) new parameters AReviewTitle, AProductRating, AReviewerName, AReviewText
' (SS,15/2/16) added rich snippets for reviews
' (SS,16/4/17) replaced <i> tag with <span> for review stars due to <i> being deprecated
' (SS,28/10/19) new version with snippets removed due to Google now complaining about missing values (added to separate localbusiness snippet)
' removed itemscope itemtype="http://schema.org/Review"
' itemprop="itemReviewed" itemscope itemtype="http://schema.org/Product"
' itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"
'<span itemprop="name">
' meta itemprop="ratingValue"
' <span itemprop="reviewBody"
' <span itemprop="datePublished">
' <span itemprop="author" itemscope itemtype="http://schema.org/Person"
' <span itemprop="name">
' Also replaced link to recent reviews page with link to review section in product itself using #reviews anchor
' (SS,14/5/21) modified layout to look more like Trustpilot reviews, changed star colour from FFB500 to #f8b805 i.e. same as Google Stars
' (SS,22/5/26) modified for Bootstrap 5
' (SS,CGPT,28/5/26)
Sub ShowRecentReviewsItem(ANumber, AReviewID, AProductCode, AProductName, ADateInfo, AReviewTitle, AProductRating, AReviewerName, AReviewText)
Dim i
' (SS,14/5/21) for HyperFlight limit length to 300 (was 200) HF tends to have much longer reviews
Dim LReviewText, LReadMoreLink, LShowReadMore
Const MAX_REVIEW_TEXT_LENGTH = 300
LReviewText = AReviewText
If Len(LReviewText) > MAX_REVIEW_TEXT_LENGTH Then
LReviewText = Mid(LReviewText, 1, MAX_REVIEW_TEXT_LENGTH) & "..."
LShowReadMore = True
Else
LShowReadMore = False
End If
LReadMoreLink = GetProductLinkWithName(AProductCode, AProductName) & "#reviews"
%>
<!-- START OF RECENT REVIEWS ITEM -->
<div class="recent-reviews-item border-bottom pb-3 mb-3">
<div class="recent-reviews-header d-flex justify-content-between align-items-start gap-3 mb-1">
<div class="recent-reviews-stars" aria-label="<%=AProductRating%> out of 5 stars">
<%For i = 1 To AProductRating%>
<i class="fa-solid fa-star" aria-hidden="true"></i>
<%Next%>
</div>
<div class="recent-reviews-date text-end">
<%=AReviewerName%>, <%=ADateInfo%>
</div>
</div>
<div class="recent-reviews-title">
<%=AReviewTitle%>
</div>
<div class="recent-reviews-text">
<%=LReviewText%>
<%If LShowReadMore Then%>
<a href="<%=LReadMoreLink%>">read more</a>
<%End If%>
</div>
<div class="recent-reviews-name">
<a href="<%=LReadMoreLink%>"><%=AProductName%></a>
</div>
</div>
<!-- END OF RECENT REVIEWS ITEM -->
<%
End Sub
Sub ShowRecentReviewsFooter
%>
<div id="recent-reviews-footer" class="mt-2">
<a href="<%=GetPageLink("reviews")%>">More Reviews</a>
</div>
</div>
</div>
</div>
</div>
<%
End Sub
' (SS,28/10/19) to show count and average of all reviews in structured data, only run on home page
Sub ShowReviewAggregateRatingStructuredData
' exist if not home page or GetReviewAggregateRating returns false
If Not IsHomePage Then
Exit Sub
End If
Dim LReviewCount, LAverageRating
If Not GetReviewAggregateRating(LReviewCount, LAverageRating) Then
Exit Sub
End If
%>,
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "<%=LAverageRating%>",
"ratingCount": "<%=LReviewCount%>",
"bestRating": "5",
"worstRating": "1"
}
<%
End Sub
' --- END OF RECENT REVIEWS TEMPLATES --- '
' --- START OF REVIEWS PAGE TEMPLATES --- '
Sub ShowReviewsPageHeader
ShowPageTitle "Reviews", "", "" ' (SS,3/10/20) added 2 extra parameters
%>
<div class="reviews-page">
<%
End Sub
Sub ShowReviewsPageEmpty
%>
No reviews yet.
<%
End Sub
' (SS,23/5/12) removed bold tags from product name which was resulting in extra bold via different font in IE and FireFox
' (SS,12/9/14) replaced ShowReviewRatingImage with ShowReviewRatingStars for Bootstrap, also further <i> with <em>
' (SS,31/10/19) removed <em></em> (italics) from AText due to Neil sometimes adding replies in italics
' (SS,14/6/24) added additional parameter "" to ShowReviewRatingStars
' (SS,28/5/26) Bootstrap 5 cleanup
Sub ShowReviewsPageItem(ANumber, AReviewID, AProductCode, AProductName, AProductDisabled, ADate, ATitle, ARating, AText, AReviewedBy)
Dim LProductLinkStart, LProductLinkEnd, i
If AProductDisabled Then
LProductLinkStart = ""
LProductLinkEnd = ""
Else
LProductLinkStart = "<a href=""" + GetProductLink(AProductCode) + """>"
LProductLinkEnd = "</a>"
End If
%>
<!-- START OF REVIEWS PAGE ITEM -->
<div class="reviews-page-item">
<div class="reviews-page-item-header">
<div class="reviews-page-item-name"><a name="reviewid<%=AReviewID%>"></a>
<h4><%=LProductLinkStart%><%=AProductName%><%=Iif(AProductDisabled, " (discontinued)", "")%><%=LProductLinkEnd%></h4>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-4 col-12">
<div class="reviews-page-item-left">
<%=LProductLinkStart%><img class="reviews-page-image" src="<%=GetProductImageLink(AProductCode, "s")%>" alt="<%=AProductName%>" /><%=LProductLinkEnd%>
</div>
</div>
<div class="col-lg-9 col-md-9 col-sm-8 col-12">
<div class="reviews-page-item-right">
<div class="reviews-page-item-right-header">
<div class="reviews-page-item-rating">
<%ShowReviewRatingStars ARating, ""%>
<!--<div class="reviews-page-item-title"--> <big><b><%=ATitle%></b></big><!--</div>-->
</div>
<!--<div class="reviews-page-item-date"><%=ADate%></div>-->
<div class="reviews-page-item-review-by">Review by <%=AReviewedBy%> on <%=ADate%></div>
</div>
<div class="reviews-page-item-body">
<p><%=AText%></p>
</div>
</div>
</div>
</div><!--row-->
</div>
<hr>
<!-- END OF REVIEWS PAGE ITEM -->
<%
End Sub
Sub ShowReviewsPageFooter
%>
</div> <!-- end reviews-page -->
<%
End Sub
' (SS,15/9/17) added following for recent reviews to show in description, called from ShowProductReviewsInDesc in AppUtils.asp
Sub ShowProductReviewsInDescHeader
%>
<hr>
<div><h4>Most recent customer reviews</h4></div>
<%
End Sub
' (SS,15/9/17)
Sub ShowProductReviewsInDescItem(ADate, ATitle, ARating, AText, AReviewedBy)
ShowReviewRatingStars ARating, "" ' (SS,14/6/24) added "" for new options parameter
Response.Write "<span class=""small""> by " & AReviewedBy & " on " & ADate & "</span>"
Response.Write AText
End Sub
' (SS,15/9/17)
Sub ShowProductReviewsInDescFooter
End Sub
' --- END OF REVIEWS PAGE TEMPLATE --- '
%>