Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I see line items when viewing the order view online, but I get "No line items found." in the email receipt. Any idea why? Thanks.
Comments
Comment #1
eeyorrActually, when I email the invoice by clicking the "email" button in the order view, the line items appear, but the email triggered by the rule gives me the "No line items..." message.
Comment #2
najtsirk CreditAttribution: najtsirk commentedI get the same missing line items for anonymous users. What is the problem?
Comment #3
scottrouse CreditAttribution: scottrouse commentedThis is happening for me, too. It does appear to be tied to anonymous users. Initially, the UID in the email was showing up as 0 (anonymous user). I changed the weight of the rule to 10 so that it would be evaluated after the "Create a new account for an anonymous order" rule. The new UID now shows up in the email, but the line items show up as "No line items found."
Comment #4
BenStallings CreditAttribution: BenStallings commentedI'm changing the title back because I'm not convinced the problem is limited to anonymous users. I set the weight of the rule to 10, and the orders are getting assigned to the proper user, but regardless of whether the user is new or existing -- and regardless of whether they were logged in at time of checkout -- the emailed receipt does not show line items. The receipt I can pull up through the admin interface does show line items, and I can email that manually, but I don't want to have to do that for each and every order!
Just to try to think this through... the line items are displayed as $info['line_items'] in the template. This value is set by _commerce_invoice_receipt_get_invoice_info(), which is called by commerce_invoice_receipt_mail() using an order object it was passed, in turn, by the rule. Unless I'm missing a step.
The "No line items found." message is the No Results Behavior of the commerce_line_item_table view. So at the time the $info variable is populated, that view is returning no results. The view has no access restrictions and requires only the order number to be passed in as a parameter -- not the user ID.
So it seems to me that the weak link here is the way the rule retrieves the order (the commerce-order token) -- it may not be a problem in this module at all. But to test that theory I'm going to have to do some experimentation.
Comment #5
BenStallings CreditAttribution: BenStallings commentedIn order to test the hypothesis that the problem was with my Rule configuration, I added a condition to the rule to test whether the commerce-order entity has a commerce-line-item field, in order to make sure the field is available for use (since that is a common problem with Rules). That did not help -- the email still says "No line items found."
Comment #6
no2e CreditAttribution: no2e commentedI don't know if this might help here, but I had the same problem without using 'Commerce Invoice Receipt':
I use Commerce Email (7.x-1.x-dev) with the token
[commerce-order:commerce_line_items]
.If anonymous orders something, the mail contains "
".If a registered user orders something, it contains the line items table.
After giving anonymous the permission "View own orders of any type", it works for them, too.
Ah, and here is a related thread:
"No line items found." in email receipt if user is not authenticated during checkout
Comment #7
nasheet CreditAttribution: nasheet commentedHello,
I am also having this problem. For me it does not matter if the user is anonymous or authenticated. The difference is when I enable the Payment part of the checkout. If I disable the payment part, and a user places an "order" without paying (in my case transferred to PayPal using WPS) then the email works and the line items are all displayed. If I enable the Payment pane in checkout, the user is transferred to PayPal, then the email is sent with "No line items found" instead of the order.
I don't know how this can be fixed, but thought I would add my experience to the investigation.
Comment #8
agoradesign CreditAttribution: agoradesign commentedHello,
I've the same problem, very similar to nasheet's description: user is authenticated, permission "view own orders of any type" is on. Instead of PayPal I'm using Ogone.
Comment #9
geodaniel CreditAttribution: geodaniel commentedI also see this issue with just Commerce Email module (1.x-dev), and don't have Commerce Invoice Receipt module installed. I'm using the [commerce-order:commerce_line_items] token.
When you use a payment service which is externally hosted (PayPal, Ogone, etc.), it isn't the user coming back to the site which triggers the email, it's the payment provider requesting a URL in the background. As such, the request is coming from a completely different anonymous user, which won't have permissions to see the line items.
For me, giving the anonymous user 'View own orders of any type' permission didn't work, but by editing the commerce_line_item_table view and disabling SQL Query Rewriting under Advanced -> Settings I got it to work... for a while. Then it stopped working, and I haven't yet pinned down what changed in the meantime to make it stop.
Comment #10
nasheet CreditAttribution: nasheet commentedOh thank you geodaniel, this worked for me. Seems like the invoice is working now, I haven't tested it thoroughly yet, but your explanation makes sense and modifying the view works for now!
Comment #11
bradhawkins CreditAttribution: bradhawkins commentedThis could also be a result of the "line items" field being set to "hidden" in the display settings.
Go to:
Administration » Store » Configuration » Order settings » Manage display
...and make sure that "line items" is not hidden for the "Invoice/Receipt" display type. For me all fields were hidden by default.
Comment #12
stevieb CreditAttribution: stevieb commented#11 was the same for me and cleared the issue
Comment #13
micnap CreditAttribution: micnap commented#9 fixed the issue for me.
Comment #14
DagleesComment #16
kingandy CreditAttribution: kingandy commentedRe #9, "giving the anonymous user 'View own orders of any type' permission" naturally wouldn't work as the orders in question don't belong to the anonymous user :D You'd need to give them 'View any order of any type'. However this would give anonymous users permission to view any order, which is not particularly great for security, so the latter option (disabling SQL rewriting on the cart summary views) is thoroughly preferable.
Comment #17
francort CreditAttribution: francort commentedI've found that commerce_entity_access_query_access() is the function to be blamed on this issue.
Comment #18
martin74 CreditAttribution: martin74 commentedSame issue here. ( it worked few weeks ago..) now it doesnt ?
my order emails dont hold line items
can someone help me out ?
Comment #19
geraldito CreditAttribution: geraldito commented#9 fixed the issue for me.
Comment #20
ishworthapaliya CreditAttribution: ishworthapaliya commented#9 worked for me also. Thanks!
Comment #21
Anybody#9 worked and still works for me ;) But I'm still frightened, if this opens up security holes.
Comment #22
hockey2112 CreditAttribution: hockey2112 commented#11 fixed it for me. Thanks!
Comment #23
hectorelgomez CreditAttribution: hectorelgomez commentedI had the same problem. For me this response solve the issue. Thanks a lot.
Comment #24
victor.bexelius CreditAttribution: victor.bexelius commentedHello, I would like to post the fix on this issue to whomever have problems.
1. I am using a paymentprovider which takes the user to an off-site for payment, then returns the user to the page - thus triggering the complete checkout rules
Problem: The receipt to customer did not contain the line-items.
Solution:
1. #11: geodaniel -> commerce_line_item_table -> Disable SQL rewriting
Notes: Thanks to this you may send admin order email (example a custom email that goes to admin whenever an order is complete by a customer).
AND
2. commerce_cart_summary -> Disable SQL rewriting
Notes: Thanks to this - the customer email will contain the line items.
Best regards
Victor Bexelius
Comment #25
RAWDESK CreditAttribution: RAWDESK commentedHi,
Neither #9, #11 or commerce_cart_summary SQL rewriting disabling helped me solving my custom mandrill email confirmation implementation.
After some research, i finally found a solution thanks to this thread comment :
https://www.drupal.org/node/1895418#comment-9276425
Had to perform some additional tweaking since the last two instructions :
prevented me from successfully sending my mail to mandrill.
So here's my rather simple implementation for those who might be looking for a similar solution :
Comment #26
GiorgosK#9 @geodaniel's explanation and solution works for external payments (paypal)
otherwise for internal payments (Bank transfer, COD etc)
the "view own orders of any type" anonymous permission worked
Comment #27
localnetwork CreditAttribution: localnetwork as a volunteer and commented#11 is mandatory as the product line_items needs to be displayed in Invoice Receipt while #9 is a bug in sending "Invoice Receipt" on email for anonymous order.
Comment #28
nattyweb CreditAttribution: nattyweb commented#11 wasn't an issue for me - already set that way. But #9 did the job. Thank you. Shame this is still an issue, 5 years on.
Using recommended Stable release 7.x-1.1 released 7 January 2014 and Drupal 7.56.
Comment #29
Dubs CreditAttribution: Dubs as a volunteer and at Drupology commentedThe issue is around order ownership and permissions. Even though the order has a user, and the patch allows the user to switch temporarily, access checks still fail.
The workaround is #24 is good as long as that view is not accessible outside of this module's use (security).