File: D:/web/castironradiatorcentre/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,22/10/19) Changes to fix errors shown in Google Search Console due to it thinking values missing from reviews on the home page
' Added Class RecentReviews and Sub ShowRecentReviewsStructuredData
' Snippets removed from ShowRecentReviewsItem
' (SS,11/12/19) Removed redundant code including Class RecentReviews (which was added on 21/10/19)
' Also replaced link to recent reviews page with link product page itself
' (SS,13/05/21) Added for Trustpilot: ShowRecentReviewsEmptyTP, ShowRecentReviewsHeaderTP, ShowRecentReviewsItemTP, ShowRecentReviewsFooterTP
' (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,27/05/21) Added alt="Trustpilot" (for W3C checker) Sub ShowRecentReviewsHeaderTP
' (SS,14/06/24) 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_old
%>
<div id="row recent-reviews">
<div id="recent-reviews-header">
</div>
<%
End Sub
' (SS,13/5/24) new Bootstrap 5 version, added class="row"
Sub ShowRecentReviewsHeader
%>
<div class="row g-2" 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,22/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">
' (SS,11/12/19) Replaced link to recent reviews page with link product page itself (decided not to use #reviews anchor, due to most recent reviews shown in the main description)
' (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
Sub ShowRecentReviewsItem_old(ANumber, AReviewID, AProductCode, AProductName, ADateInfo, AReviewTitle, AProductRating, AReviewerName, AReviewText)
Dim i
%>
<!-- START OF RECENT REVIEWS ITEM -->
<div class="recent-reviews-item">
<%For i = 1 To AProductRating%>
<span class="glyphicon glyphicon-star" style="color: #f8b805; font-size:18px"></span>
<%Next%>
<div class="recent-reviews-date">
<%=AReviewerName%>, <%=ADateInfo%>
</div>
<div class="recent-reviews-title">
<strong><%=AReviewTitle%></strong>
</div>
<div class="recent-reviews-text">
<span><%=AReviewText%></span>
</div>
<div class="recent-reviews-name"><a href="<%=GetProductLinkWithName(AProductCode, AProductName)%>"><%=AProductName%></a></div>
<!-- END OF RECENT REVIEWS ITEM -->
</div>
<%
End Sub
' (SS,13/5/24) new Bootstrap 5 version, replaced glyphicon with fontawesome
' replaced stars loop with call to ShowReviewRatingStars
' added "col" class for 3 across, had to add "row" to an outside div in ShowRecentReviewsHeader
' help from https://getbootstrap.com/docs/5.1/utilities/flex/ to bottom align the name and date in column using Flex
' (SS,31/5/24) further mods, removed bg-light bg-gradient, changed m-1 to m-2, added rounded-4
' class recent-reviews-title removed italics, strong tag removed from title, not required, bold applied by style class
' name and date, styles changed in class
' <div class="col recent-reviews-item d-flex align-items-start flex-column border border-secondary-subtle m-2 py-2 rounded-4">
Sub ShowRecentReviewsItem(ANumber, AReviewID, AProductCode, AProductName, ADateInfo, AReviewTitle, AProductRating, AReviewerName, AReviewText)
Dim LHideOnBreakpoint
If ANumber > 4 Then
LHideOnBreakpoint = " d-none d-lg-block"
Else
LHideOnBreakpoint = ""
End If
' (SS,18/6/24)
Dim LReviewName
LReviewName = AReviewerName
If LReviewName = "Anonymous" And AProductRating >= 4 Then LReviewName = "Happy Customer"
%>
<!-- START OF RECENT REVIEWS ITEM -->
<div class="col-6 col-sm-12 col-md-6 col-lg-4 recent-reviews-item d-flex flex-column<%=LHideOnBreakpoint%>">
<div class="border border-secondary-subtle p-3 py-2 rounded-4">
<div>
<% ShowReviewRatingStars AProductRating, "" %>
</div>
<div class="recent-reviews-title my-1">
<%=AReviewTitle%>
</div>
<div class="recent-reviews-text my-1">
<span><%=AReviewText%></span>
</div>
<div class="mt-auto">
<div class="recent-reviews-name mt-2">
<%=LReviewName%>
</div>
<div class="recent-reviews-date">
<%=ADateInfo%>
</div>
</div>
</div>
</div>
<!-- END OF RECENT REVIEWS ITEM -->
<%
End Sub
Sub ShowRecentReviewsFooter_old
%>
<div id="recent-reviews-footer">
<a href="<%=GetPageLink("reviews")%>">More Reviews</a>
</div>
<div class="clear"></div>
</div>
<%
End Sub
' (SS,13/5/24) new Bootstrap 5 version
Sub ShowRecentReviewsFooter
%>
</div>
<%
End Sub
' (SS,24/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 RECENT REVIEWS TEMPLATES FOR TRUSTPILOT --- '
Sub ShowRecentReviewsEmptyTP
' html to show if no recent reviews to go here '
%>
<%
End Sub
' (SS,27/5/21) added alt="Trustpilot" (for W3C checker)
Sub ShowRecentReviewsHeaderTP(AAverageRating, ARatingTitle, AReviewCount)
Dim LAverageRating, LRatingTitle
If AAverageRating = 0 Then
LAverageRating = 5
Else
LAverageRating = Round(AAverageRating)
End If
LRatingTitle = ARatingTitle
If LRatingTitle = "" Then LRatingTitle = "Excellent"
%>
<div id="recent-reviews-tp">
<div id="recent-reviews-header-tp">
<div>
<a href="https://uk.trustpilot.com/review/<%=GetTrustpilotSiteName%>" target="_blank">
<%=LRatingTitle%>
<img src="images/trustpilot/stars-<%=LAverageRating%>.svg" height="30" alt="<%=LAverageRating%> stars">
on
<img src="images/trustpilot/trustpilot-logo.png" height="30" alt="Trustpilot">
</a>
</div>
</div>
<%
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,19/11/20) used for Trustpilot reviews, added Trustpilot's own stars
' also removed the rich snippets, imnproved layout
Sub ShowRecentReviewsItemTP(ANumber, AReviewID, AProductCode, AProductName, ADateInfo, AReviewTitle, AProductRating, AReviewerName, AReviewText)
Dim i
%>
<!-- START OF RECENT REVIEWS ITEM -->
<div class="recent-reviews-item-tp">
<img src="images/trustpilot/stars-<%=AProductRating%>.svg" height="20" alt="<%=AProductRating%> stars">
<div class="recent-reviews-date-tp">
<%=AReviewerName%>, <%=ADateInfo%>
</div>
<div class="recent-reviews-title-tp">
<strong><%=AReviewTitle%></strong>
</div>
<div class="recent-reviews-text-tp">
<span><%=AReviewText%></span>
</div>
<!-- END OF RECENT REVIEWS ITEM -->
</div>
<%
End Sub
Sub ShowRecentReviewsFooterTP
%>
<div id="recent-reviews-footer-tp">
<a href="https://uk.trustpilot.com/review/<%=GetTrustpilotSiteName%>" target="_blank">More Trustpilot Reviews</a>
</div>
<div class="clear"></div>
</div>
<%
End Sub
' --- END OF RECENT REVIEWS TEMPLATES FOR TRUSTPILOT --- '
' --- START OF REVIEWS PAGE TEMPLATES --- '
' (SS,18/6/24) removed style="padding: 0"
Sub ShowReviewsPageHeader
' (SS,5/12/19) modified to add "" as 2nd and 3rd parameters
ShowPageTitle "Reviews", "", ""
%>
<div id="other-pages2">
<%
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,17/6/24) Modified Sub ShowReviewsPageItem to add additional parameter "" to ShowReviewRatingStars
Sub ShowReviewsPageItem_old(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-xs-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-xs-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><em><%=AText%></em></p>
</div>
</div>
</div>
</div><!--row-->
</div>
<hr>
<!-- END OF REVIEWS PAGE ITEM -->
<%
End Sub
' (SS,18/6/24) modified for Bootstrap 5
' replaced col-xs-12 with col-12
' removed reviews-page-item, reviews-page-item-header, reviews-page-item-name, reviews-page-item-left, reviews-page-image, reviews-page-item-review-by, reviews-page-item-right, reviews-page-item-right-header, reviews-page-item-rating, reviews-page-item-body
' added img-fluid rounded mx-auto d-block
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
' (SS,18/6/24) change Anonymous to Happy Customer
Dim LReviewedBy
LReviewedBy = AReviewedBy
If LReviewedBy = "Anonymous" And ARating >= 4 Then
LReviewedBy = "Happy Customer"
End If
%>
<!-- START OF REVIEWS PAGE ITEM -->
<div class="row border m-1 my-3 p-3 rounded-5 shadow-sm">
<div class="col-lg-3 col-md-3 col-sm-4 col-12">
<%=LProductLinkStart%><img class="img-fluid rounded mx-auto d-block" src="<%=GetProductImageLink(AProductCode, "s")%>" alt="<%=AProductName%>"><%=LProductLinkEnd%>
</div>
<div class="col-lg-9 col-md-9 col-sm-8 col-12">
<h4><%=LProductLinkStart%><%=AProductName%><%=Iif(AProductDisabled, " (discontinued)", "")%><%=LProductLinkEnd%></h4>
<div class="mb-2">
<%ShowReviewRatingStars ARating, ""%>
<span class="fs-5 fw-bold ms-1"><%=ATitle%></b></span>
</div>
<%=AText%>
<div class="float-start text-secondary">Review by <%=LReviewedBy%> on <%=ADate%></div>
<div class="float-end">
<a href="#top"><i class="fa-regular fa-chevron-up"></i></a>
</div>
</div>
</div>
<!-- END OF REVIEWS PAGE ITEM -->
<%
End Sub
Sub ShowReviewsPageFooter
%>
</div> <!-- end #other-pages2 -->
<%
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,21/2/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 --- '
%>