Print Page | Close Window

Converting Reviews from Image to Numerical Values

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Using ProductCart
Forum Description: Running your store with ProductCart
URL: https://forum.productcart.com/forum_posts.asp?TID=5664
Printed Date: 03-July-2025 at 7:56am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Converting Reviews from Image to Numerical Values
Posted By: Lindsay
Subject: Converting Reviews from Image to Numerical Values
Date Posted: 09-July-2013 at 6:49pm


Since ProductCart's latest release doesn't include structured data markup or the option to add metadata into product pages, I'm trying to use Google's Structured Data Markup Helper to add this information manually.

It appears that Google's tool is not able to recognize and convert productcart's stars, empty stars, and half stars to a numerical value- so I'm looking for a way to display a numerical value/aggregate score next to (or even instead of) the stars that are just under the product title, on the main product page.  Any suggestions?



Replies:
Posted By: Hamish
Date Posted: 06-August-2013 at 6:21pm
In pc/prv_incfunctions.asp find the following two lines and uncomment the second one :-

            ' Uncomment the following line to show the text value (e.g. "3.5")
            ' response.write Rev_SaveRate



-------------
Editing ProductCart Code?

See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code



Posted By: Lindsay
Date Posted: 08-September-2013 at 1:26pm

Great- but is there a way to hide that number on listings in search results?


Posted By: Guests
Date Posted: 10-September-2013 at 2:47pm
If you only want the numeric value to show on product pages, you could change
response.write Rev_SaveRate
to
if pcStrPageName = "viewprd.asp" then response.write Rev_SaveRate
or perhaps this is a bit nicer display:
if pcStrPageName = "viewprd.asp" then response.write "(" & Rev_SaveRate & "/5)"


Posted By: Lindsay
Date Posted: 10-September-2013 at 5:34pm


PERFECT! Thank you Sean!


Posted By: Guests
Date Posted: 17-September-2013 at 11:11pm
Hi Lindsay,

Well, maybe not so perfect after all.

Knowing that you are working on structured data/schema.org markup (which I am too), my quick edit above is way too down and dirty for that, and now that I look at the full implications of it, rather unsightly -- The numeric value will display next to everywhere the icons are called (via the WriteStar subroutine), including on each individual review. 

That, I think, makes it unsightly.

More to the point for structured data/schema.org markup, though, it's not practical: this sub can't be used to markup the aggregateRating properties, else they will recur over an over again.

The better solution is to append some code to the end of the pcs_ShowRating subroutine in viewPrdCode.asp and/or on prv_increviews.asp and then again on prv_allreviews.asp. 

Here's a rough on what that code would look like, though I would abstract this out to a subroutine called in each of these instances. In each of these files, find something like:
END IF 'Main Rating %>
(white space varies a bit in each file)
Just after that, add:
<%
query = "SELECT COUNT(pcRev_IDReview) AS revCnt FROM pcReviews WHERE (pcRev_IDProduct = "& pIdProduct &") AND (pcRev_Active = 1);"
set rsTemp = connTemp.execute(query)
if NOT rsTemp.eof then
%>
<span id="aggregateRating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">(<span itemprop="ratingValue"><%=pcv_tmpRating%></span>/<%=pcv_MaxRating%>) based on <span itemprop="reviewCount"><%=rsTemp("revCnt")%></span> customer ratings</span>
<%
end if
set rsTemp = NOTHING
%>
My preference would be to add it on prv_increviews.asp (rather than viewPrdCode.asp -- so's not to have this twice on the product page AND so's not to clutter up the top of the product page data with it) and then again on prv_allreviews.asp

Here's an example (WARNING: wear a hardhat -- work in progress) with this in all three locations:
http://pc47a-wms-net.3060.wmsmerchantservices.com/store/pc/viewPrd.asp?IDProduct=1&IDCategory=2" rel="nofollow - http://pc47a-wms-net.3060.wmsmerchantservices.com/store/pc/viewPrd.asp?IDProduct=1&IDCategory=2

Hope this helps you out better.

Meanwhile, lots of structured data stuff to do regarding the reviews themselves on both product pages and the "all reviews" page for a product (along with other SEO issues with the latter including duplicate title tag, duplicate meta description tag, bad canonical URL tag, etc. -- issues I've already solved if you are interested).


Posted By: Lindsay
Date Posted: 18-September-2013 at 11:13am


Thanks Sean for sharing that code, I will try inserting it later today and see if I can get it working for me.

My understanding is simplistic, I'm sure, but I believe I have added all the necessary schema product markup via editing viewPrdCode.asp and prv_increviews.asp, though I'm still trying to work out a few errors that show when I use google's Structured Data Testing Tool

I'm Interested in the fix for duplicate title tag, duplicate meta description tag with review pages, how much to purchase? I want to say EI already helped me with the canonical URLs issues, I'd have to check back in emails but I remember it was causing issues creating a sitemap and seems like we worked out a fix..


Posted By: Lindsay
Date Posted: 23-September-2013 at 4:25pm
Just a note on the code above, when I play with it on a product with a large number of reviews, pcv_tmpRating no longer rounds to the second decimal point. In the case of one popular product, this displayed: (4.82352941176471/5) based on 17 customer ratings




Posted By: Guests
Date Posted: 23-September-2013 at 11:09pm
Thanks, Lindsay.

I still haven't had the time to hash through exactly how PC is calculating/storing this value as it appears rather situational.

I any event, the code block I suggested above can be tamed to one decimal place by replacing:
<%=pcv_tmpRating%>
with:
<%=FormatNumber(pcv_tmpRating,1)%>

Looks like there's logic elsewhere to have that come out to either N or N.5, mostly for rendering the graphic representation. Not sure how important (or even desirable) it is to have the numeric representation render the same way, though.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net