ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart > Using ProductCart
  New Posts New Posts RSS Feed - Converting Reviews from Image to Numerical Values
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Converting Reviews from Image to Numerical Values

 Post Reply Post Reply
Author
Message
Lindsay View Drop Down
Newbie
Newbie


Joined: 17-December-2008
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lindsay Quote  Post ReplyReply Direct Link To This Post Topic: Converting Reviews from Image to Numerical Values
    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?
Back to Top
Hamish View Drop Down
Admin Group
Admin Group


Joined: 12-October-2006
Location: United Kingdom
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hamish Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Lindsay View Drop Down
Newbie
Newbie


Joined: 17-December-2008
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lindsay Quote  Post ReplyReply Direct Link To This Post Posted: 08-September-2013 at 1:26pm

Great- but is there a way to hide that number on listings in search results?
Back to Top
Guests View Drop Down
Guest
Guest
Post Options Post Options   Thanks (0) Thanks(0)   Quote Guests Quote  Post ReplyReply Direct Link To This Post 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)"


Edited by Sean@WMS - 10-September-2013 at 2:52pm
Back to Top
Lindsay View Drop Down
Newbie
Newbie


Joined: 17-December-2008
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lindsay Quote  Post ReplyReply Direct Link To This Post Posted: 10-September-2013 at 5:34pm


PERFECT! Thank you Sean!
Back to Top
Guests View Drop Down
Guest
Guest
Post Options Post Options   Thanks (0) Thanks(0)   Quote Guests Quote  Post ReplyReply Direct Link To This Post 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:

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).
Back to Top
Lindsay View Drop Down
Newbie
Newbie


Joined: 17-December-2008
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lindsay Quote  Post ReplyReply Direct Link To This Post 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..
Back to Top
Lindsay View Drop Down
Newbie
Newbie


Joined: 17-December-2008
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lindsay Quote  Post ReplyReply Direct Link To This Post 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


Back to Top
Guests View Drop Down
Guest
Guest
Post Options Post Options   Thanks (0) Thanks(0)   Quote Guests Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.046 seconds.