Discussions

Stock won't display for Anonymous Users

I'm trying to build an ad-hoc ticket purchasing system whereby we sell tables of seats. Each table has 8 seats, so I created a product with 8 stock.

On my display page, I have a graphical representation for the table with (what should be) the number of seats available at the table.

Everything works perfectly... WHEN I'm logged in as an administrator. Though I haven't tried it as an authenticated user, I want the stock level to display when there is a stock level (or, in context, when there are available seats at that table)

For some reason, I can not get the stock to display, nor do I see a permission for it.

Any idea what I need to do to get this working?

Posted: Dec 2, 2013

Comments

crooker on December 4, 2013

No answers? C'mon... there has to be a simple fix.

In the VIEW, I have the product being displayed. The Formatter is "Rendered Product" and the VIEW mode is "Node: Full Content"

The stock is properly set to display in the Display settings. And yet it still won't show for anonymous users.

I need some assistance here. I'm clearly missing something.

Ivan H on December 4, 2013

I've faced a similar problem once that was related to user permissions to view the referenced product. Try providing access to view products themnselves (not the displays) to anyone. The stock is a feature of products, not product displays, so the field's not accessible to anyone.
see https://drupal.org/node/1276450 for an extended discussion.
My description of the problem from http://drupal.stackexchange.com/posts/86130 (the hypothesis that this was the source of the problem I inquired about was wrong, but the description above seems largely OK):
"It seems as its is related to access permissions. A similar problem was encountered in creating product views in drupal commerce. If you want to relate to the fields of the referenced product, you have to grant the View permisssion to all products (non-node enitities of DC). Otherwise the users without permission to view the product enitities will see an empty view (see Views results empty for unprivileged user when using Relationship: Content: Referenced Product). What makes it especially difficult to track that the problem does show up only when one uses Relationship & "Fields" display. A similar view with content / teaser etc renders the same content without problems."

crooker on December 4, 2013

Thank you! That did the trick. That was pretty obscure, and I combed over the permissions, and missed it every time.

I was worried that I would have to create a product AND a corresponding display for every product, which would require over 300 entities created... Now that I can do it with Views, it will be MUCH easier!

You're a live saver, Ivan!

Ivan H on December 5, 2013

...and just in your case, if you rendered it by "content" instead of "rendered entity" would also probably do the trick. This permission thing is crucial, though, I don't understand why the permissions are set up in this way in the first place (if I remember correctly, the devs realized it was not optimal, but kept it this way for compatiblilty reasons).