Microdata / Rich Snippets: Price

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
webmaz
Lieutenant (LT)
Lieutenant (LT)
Posts: 52
Joined: Wed Apr 14, 2010 3:57 pm

Microdata / Rich Snippets: Price

Post by webmaz » Thu May 17, 2012 5:11 pm

Is there a way to tag the price/sale price with microdata from schema.org?

If the code was in only HTML code, it would look like this:

Code: Select all

<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price">$1.99</span>
<meta itemprop="priceCurrency" content="USD" />
</div>

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: Microdata / Rich Snippets: Price

Post by david-ebt » Thu May 17, 2012 5:57 pm

Take a look in the \ConLib\Utility\ProductPrice.ascx.cs file. The _RetailPriceFormat string is used to format the output for the standard price (no specials or variable price or popup price, etc). You should be able to change that to output the HTML you've shown. Something like this:

Code: Select all

private string _RetailPriceFormat = "<div itemprop=\"offers\" itemscope itemtype=\"http://schema.org/Offer\"><span class=\"msrp\" itemprop=\"price\">{0:ulc}</span> <meta itemprop=\"priceCurrency\" content=\"USD\" /></div>";
This ConLib also deals with the some of the other prices. If you use variable pricing you'll need to look at the ConLib\BuyProductDialog control.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

crazyjoe
Commander (CMDR)
Commander (CMDR)
Posts: 172
Joined: Mon Apr 26, 2010 2:20 pm

Re: Microdata / Rich Snippets: Price

Post by crazyjoe » Tue Aug 07, 2012 2:22 pm

This whole microdata thing seems pretty important and could really help everyone. Any chance of a wiki or post to tell us how to set this up correctly for everything schema.org product related? I tried to do the above but all my prices are variant based and this didn't seem to work. I added it manually to my BuyProductDialog.ascx but I'd like to hear a professionals take on how and where to add all the relevant rich snippets.

Thanks in advance.
Crazy Joe Sadloski
Webmaster
Hot Leathers Inc.
http://www.hotleathers.com

User avatar
triplw
Commander (CMDR)
Commander (CMDR)
Posts: 144
Joined: Sat Jan 12, 2008 5:34 pm
Contact:

Re: Microdata / Rich Snippets: Price

Post by triplw » Fri Aug 24, 2012 6:01 am

I put this in the content scriptlet and it seems to work.

<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price">$Product.Price.ToString("ulc")</span>
<meta itemprop="priceCurrency" content="USD" />
</div>

crazyjoe
Commander (CMDR)
Commander (CMDR)
Posts: 172
Joined: Mon Apr 26, 2010 2:20 pm

Re: Microdata / Rich Snippets: Price

Post by crazyjoe » Fri Aug 24, 2012 7:59 am

Cool! Thanks! Does anyone have any tips on how to properly tag our customer reviews?
Crazy Joe Sadloski
Webmaster
Hot Leathers Inc.
http://www.hotleathers.com

kens
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 84
Joined: Wed Apr 04, 2007 7:57 am
Location: West Palm Beach, FL
Contact:

Re: Microdata / Rich Snippets: Price

Post by kens » Mon Aug 27, 2012 7:34 am

I have been experimenting with this as well. using a combination of the buyproductdialog and productreviwpanel conlibs I think I have most of the product and reviews coded. I am trying to figure out the average rating now...

The reason I say i "think" I have it correct is that the only way I know to be sure is with Google's Rich Snippet Testing tool and the results looks a bit weird.For example, here is a sample for one of my pages...
-----------------------------------------------------
Item
Type: http://schema.org/product
name = Zingy Zaps
image = http://www.bulkcandystore.com/Assets/im ... y_zaps.jpg
review = Item( 1 )
name = Delicious!
description = I have these mailed across the country for me. I can't find them, and we don't have a bulk barn ;(
review = Item( 2 )
name = Customer service
description = I have been looking for these things since I was out of high school they are my favorite candy and I am glad to come acrossed them here. Thanks for still carrying them
brand
text = SweetWorks
href = http://www.bulkcandystore.com/Search.aspx?m=29
description = These are so bright and colorful that you just have to get happy when you see and taste them!Zingy Zaps are candy coated outside with a sour sweet tart inside! Taste just like Spree® Approx....

Item 1
Type: http://schema.org/review
reviewrating = Item( 3 )
author = Penny

Item 3
Type: http://schema.org/rating
ratingvalue = (5)

Item 2
Type: http://schema.org/review
reviewrating = Item( 4 )
author = Chris

Item 4
Type: http://schema.org/rating
ratingvalue = (5)

-----------------------------------

I am using 7.04 but would be happy to show I did it if works for you...

Ken

webmaz
Lieutenant (LT)
Lieutenant (LT)
Posts: 52
Joined: Wed Apr 14, 2010 3:57 pm

Re: Microdata / Rich Snippets: Price

Post by webmaz » Fri Aug 31, 2012 5:34 pm

Did you put this on the 'Show Product 1' scriptlet (or something similar)? We already have the price displayed through BuyProductDialog.ascx. It seems like we should be able to tag this code with microdata.

Something related to this line of code in BuyProductDialog.ascx:

Code: Select all

<uc:ProductPrice ID="OurPrice" runat="server" EnableDefaultKitProducts="false" /> 
triplw wrote:I put this in the content scriptlet and it seems to work.

<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price">$Product.Price.ToString("ulc")</span>
<meta itemprop="priceCurrency" content="USD" />
</div>

Post Reply