Posted by dimon00 on December 21, 2011 at 4:51pm
11 followers
| Project: | Fivestar |
| Version: | 7.x-2.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Issue Summary
This is a duplicate of:
http://drupal.org/node/1379064
I created a new node type and assigned it as microdata movie.
I added a fivestar field and filled the related properties with the "default filling function".
When I test a "movie node":
http://www.google.com/webmasters/tools/richsnippets?url=http%3A%2F%2Fsvi...
I obtain:
Item 1
Type: http://schema.org/aggregaterating
Warning: This item does not have a property!
looking into the html source for that node, in firefox, I cannot see any "ratingValue" property.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| fivestar microdata properties.jpg | 60.64 KB | Ignored: Check issue status. | None | None |
Comments
#1
This support was added as part of issue #1285084: Support microdata in fivestar.
Are you using the "Stars (rated while editing)" widget? That was the only one I added support for in that issue.
#2
I'm too stupid to read...
You are right.
I switched the widged and now the warning disappeared.
Do you plan to extend the support to the "rated while viewing"?
#3
I'd be happy to review patches and work with a developer to extend this, but I will not be able to do it myself.
I'm hoping to get more developers involved in adding support. There are about 200 different field formatters in contrib (as of August), so we'll need to have more people involved in writing and maintaining the code.
If anyone comes across this issue and wants to write a patch, I'd be happy to offer guidance... if you run into any problems, just ping me.
#4
I'm a newbie at best with drupal, php and such... but maybe I can provide some help... with the right amount of support. :)
#5
Ok, I would recommend reading the instructions in the IBM developerWorks article, starting with Enabling Microdata in FIeld Formatters about halfway down, and looking at the patch in #1285084: Support microdata in fivestar.
Note that one thing has changed since I created that patch, the part that is in hook_microdata_field_defaults was updated in #1379244: Update microdata hook for API change.
#6
This is my first attemp to generate a patch so the result could be quite crude.
Even the coding could be far from elegant (I'm not really a developer).
#7
#8
Great, thanks for stepping up on this. It works when I test it by hand. If I have time, I'm going to write automated tests for microdata in Fivestar so new patches can be tested to ensure that we still have correct output.
The only small issue is that there are small formatting issues with whitespace. To see this, you can install the browser plugin Dreditor. This will give you a blue "Review" button. When you click that, you will see some parts that are highlighted in pink; these are the whitespace errors. There are two empty lines that have two spaces on them and 4 lines where a tab is used instead of spaces.
Once those small things are fixed, I think this should be ready.
#9
Thank you.
I made the corrections.
Is there a Dreditor tool for an editor?
It would be useful to spot the mistakes before submitting the patch.
By the way: have a Merry Christmas. :)
Errata corrige: I don't know why but the patch was a copy of the previous one. I'm not able to delete it.
#10
Trying again to submit the above patch.
#11
I am using "Stars (rated while editing)" widget, but the microdata mapping field cannot be found, as if this field is not supported. Only itemtype is displayed. After saving I get:
Saved Rating configuration.
Error message
Notice: Undefined index: microdata in microdata_form_field_ui_field_edit_form_submit() (line 519 of /home/name/public_html/drupal/sites/all/modules/microdata/microdata.module).
Warning: Invalid argument supplied for foreach() in microdata_form_field_ui_field_edit_form_submit() (line 519 of /home/name/public_html/drupal/sites/all/modules/microdata/microdata.module).
Any idea how to solve this?
#12
Are you using the dev version of the module?
#13
Nope. Using latest alpha 5.
I also encounter a bunch of errors with keyword research module enabled. whenever I click save, I see errors and node cannot be saved. This issue is solved by disabling the keyword research module.
#14
I can't speak to any other issues besides microdata, but you probably need to try with dev in order to get microdata.
#15
I don't think the last bug reported is related to fivestar.
I'm currently getting the same error on "content type page".
The last dev version seems to solve the issue.
#16
Can anyone provide some sort of walkthrough on how to setup Fivestar + Microdata?
I have both modules installed and Fivestar is working fine, but I do not know how to get the Microdata module working with Fivestar. I've read a lot of posts about this but couldn't find a solution which doesn't require a patch (which I'm not able to do).
Thanks a lot!
#17
@remkovdz:
Sure you can Remko! ...all you have to do is be able to read and follow well-written instructions:
Applying patches
Applying a patch manually
BTW: #619650: Provide a link next to .patch attachments linking to help/documentation about applying patches. ;)
#18
Thanks for convincing me, I applied the patch manually..
But... I still don't where to begin with the settings in Microdata. Can anyone help me here?
#19
Haven't played with fivestar + microdata yet, but the handbook page seems like a good start: http://drupal.org/node/1181440
#1516982: Add a "View documentation" link to the project's page (left sidebar, "Resources" section)
#20
Is this patch still valid?
#21
Based on linclark last comment, this seems to need work.
Also note #1379244: Update microdata hook for API change has been committed.
#22
@erikduran: What changes do you need?
changes required by linclark have been inserted into microdata-while-viewing-fivestar-3.patch
#23
Can someone do manual testing on this both without the patch and with the patch and report the results back here? That will help Eric ensure that the patch is correct.
#24
I've installed the latest version of the Fivestar and the patch from entry #10 doesn't seem to correspond to the correct line numbers. Is there an updated patch for the newest version of the FiveStar module? (the 7.x-2.0-alpha2 version from March 28 2012)
#25
@msedlacek: Patches are always against latest dev where available and they also should be tested against it. You can still apply the patch manually. If you do go through the trouble to do that, then please be so kind to post a new patch ;)
#26
I tried implementing the above rated while viewing patch in combination with the latest dev version for Microdata (2012-May-04) and I don't see any property data showing up for the review in the source. Is anybody able to help on this? I guess at a basic level I'm not really understanding why there would be support for "rated while editing" and not for viewing, as I'd expect most reviews to be given by anonymous site visitors, and not logged in users. Anyway, if anybody can help with a patch that would be great. I'd be willing to help chip in and pay for the dev work, contact me if interested...
#27
The last submitted patch, microdata-while-viewing-fivestar-3.patch, failed testing.
#28
I rerolled the patch and simplified the logic just a little bit... but I barely touched it, attribution credit should go to dimon00 for figuring this out (nice work!) When this patch is applied, the test in #1385860: Add tests for microdata output should pass.
NOTE to USERS: To manage this via the UI, the code in #1569442: Microdata: allow users to toggle whether field is item or not must be applied. Until that is marked as fixed, you should apply the patch in that issue.
#29
thanks! just applied it and it works for me; (using the following versions)
Microdata 7.x-1.0-alpha5+8-dev
Fivestar 7.x-2.0-alpha2
#30
follow up to previous post. it looks like the aggregaterating property shows up ok in the source code (for me as a property of the Recipe schema, not a child/nested schema), and per the very top I believe there is also a way to do this as a nested schema using the configuration page.
Though, one issue I see in the testing tool and also quoted on this page:
http://support.google.com/webmasters/bin/answer.py?hl=en&answer=1093493
"Google needs certain data to generate a rich snippet preview for each product type. For example, a Review without a reviewer or a Review-aggregate without a count will not generate a preview."
So since the count value for the reviews is also not provided as a property (along with the aggregateReview property) the entire snippet is basically rejected by the Rich snippet testing tool if you include the aggregate rating, and it only works if you then take this out. So is there currently a workaround or way to get the count showing as well? maybe I am missing something? thanks! If I understand this correctly, the functionality is only valid if you also have the count property and without that you will cause Google to basically reject your recipe (or whatever schema you are using) if you include the aggregateReview by itself.
#31
Thanks for testing this patch. Anything specifically dealing with Google's Rich Snippets should move to it's own support request.
#32
Awesome.
This patches looks good to me, anything else should be in a follow up issue.
Proper commit credit attributed to dimon00 as per linclark comment.
--
http://drupalcode.org/project/fivestar.git/commit/46353d4
#33
Sorry. I've been busy of late (same as "lazy").
@ericduran For the ratingCount: as msedlacek, I noted the missing property, so I opened a topic sometime ago:
http://drupal.org/node/1445944
but it was closed because the discussion was supposed to take place here.
If you agree I would reopen the other topic. I think to have the ratingCount is really important to proper support microdata on fivestar fields.
Thanks
#34
Hi dimon00, yes if you could reopen the issue that would be great. per the http://drupal.org/node/1445944 thread you cited the issue would need to be addressed here in this thread. I think that for anyone to get functional or practical use out of the microdata/fivestar combination it needs to have the ratingCount, so that should definitely be included in the future...
ps if anyone is interested, I am currently using a workaround where I pull the ratingCount and aggregate/average values via a computed field and then spit them out with the correct microdata info wrapped, here is an example of the code:
$rating_count = $entity->field_review[$entity->language][0]['count'];
$divisor = 20; // this is done to give it a 1-5 value instead of 20, 100, etc
$rating_average = (int)$entity->field_review[$entity->language][0]['average'] / $divisor;
$display_output = <div itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\">" ."<span itemprop=\"ratingValue\" style=\"display: none;\">" . $rating_average . "</span>" ."<span itemprop=\"ratingCount\" style=\"display: none;\">" . $rating_count . "</span></div>";
it may not be pretty but works fine for now, validates properly with the rich snippets tool, and is an elegant solution in that it can be neatly undone/removed once the fivestar/microdata fix is implemented)
I had to use css to prevent the info from being displayed twice, which Google says isn't necessarily what they want, but since it validates ok I am content to use it for now...
thanks
#35
I re-opened the other issues.
Lets solved all the microdata problems :)