I set up the module and everything works except for anonymous users are unable to see the cart contents/totals on the confirm order page.

I messed around with this and have found that if i give anonymous user the permission View any order of any type. then the cart contents show up and are visible, but i think this would be a security issue and don't want a user to be able to move over to someone else's order confirmation.

Any ideas how i can make this work?

CommentFileSizeAuthor
#5 confirm_view_own.png5.11 KBjesss
#5 confirm_view_any.png8.31 KBjesss

Comments

rszrama’s picture

Status: Active » Needs review

Are you sure it wouldn't work with just "View own orders of any type?"

blankstar85’s picture

I currently have that permission set to the anonymous user. But its not working

nelslynn’s picture

Any updates? I have the same issue.

rszrama’s picture

Status: Needs review » Closed (duplicate)

The only other known reason for this would be if your View uses a product relationship and authenticated users have some higher level product viewing permissions that anonymous users don't have. This isn't really an issue with the PayPal module, so you might follow this core issue and update your View / permissions in the meantime: #2001080: Views Product relationship permissions are too strict

jesss’s picture

Issue summary: View changes
Status: Closed (duplicate) » Active
StatusFileSize
new8.31 KB
new5.11 KB

I don't think this is a duplicate as Views isn't involved in my use case. When an anonymous user is returned to the site to confirm their order after checking out with Paypal, the shopping cart contents are blank. View Own Orders of Any Type does not work, but if I change the permissions to View Any Order, anonymous can see their cart contents. (See attached screenshots.)

Of course, now anonymous can see the contents of any order, which is definitely a security issue so this is not a good solution.

Maybe some sort of token needs to be passed as well, similar to how webform allows anonymous users to see their own results.

pmelab’s picture

After digging deep through the process I found the problem. There is a new order state for checkout_paypal_ec, but cart access is not set to true. Thats why anonymous users are able to see the cart at the start of the process (in states cart or checkout_review) but not as soon as the paypal redirect returns and the order is set to checkout_paypal_ec. You need to alter order statuses and enable cart visibility.

function mymodule_commerce_order_status_info_alter(&$statuses) {
  if (array_key_exists('checkout_paypal_ec', $statuses)) {
    $statuses['checkout_paypal_ec']['cart'] = TRUE;
  }
}
rszrama’s picture

Status: Active » Closed (duplicate)

This is not correct. That parameter doesn't affect visibility, just the shopping cart refresh. The issue here is a duplicate of the one I linked in my comment #4 above which is itself more or less a duplicate of #1276450: Views results empty for unprivileged user when using Relationship: Content: Referenced Product. My recommended solution is in #1276450-136: Views results empty for unprivileged user when using Relationship: Content: Referenced Product.

mr.m0dit’s picture

Can @pmelab or some else please tell me where to put the code in post #6?

Thank you!