The "Commerce order message: order notification e-mail" rule included with this module presumes that the user triggering the message is not anonymous. Trying to use this module out of the box with anonymous users results in confusing results, no emails being sent & errors in the log.
My main use case required that anonymous customers receive an order confirmation via email. In order to do this I had to make 2 amends to the "Commerce order message: order notification e-mail" checkout rule as detailed in this post. This gets me the basic functionality I'm after.
I wonder if if we can tweak the "Commerce order message: order notification e-mail" rule provided with this module in such a way that it first check the user role and then proceed accordingly so that out of the box, this module works just as well for anonymous users?
I guess this could be viewed as a feature request but I'm gonna file it as a bug report as I feel that the affected potential use cases are far from niche. IMHO it should really work for anonymous users without amends.
If I get time, I'll see if I can work up an example rule and post something here.
Comments
Comment #0.0
dddbbb CreditAttribution: dddbbb commentedTypo & issue accuracy corrections.
Comment #1
AdamGerthel CreditAttribution: AdamGerthel commentedThe solution you linked to causes a lot of other things to break, such as this token: [message:message-commerce-order:view-url] which will lead to user/0/order/XXXX.
Comment #2
Summit CreditAttribution: Summit commentedHi @danbohea would be great if you could post an example rule. I am also struggling with this.
Did you say in http://www.drupalcommerce.org/questions/8175/commerce-message-order-conf... that the ONLY things to change for the rules to work for anonymous users is:
- change in "Create a new entity" the user from commerce-order:owner to site:current-user and
- change in "Send Message with Message notify" the THE RECIPIENT OF THE EMAIL from nothing to [commerce-order:mail]
EDIT:This worked! Thanks
Greetings, Martijn
Comment #2.0
Summit CreditAttribution: Summit commentedRemoved mention of another issue (works as designed).
Comment #3
MrPeanut CreditAttribution: MrPeanut commentedAfter finally getting my Commerce Message formatted with all my data, I realized that it's not sending to anonymous users. While the changes from #1 did make the email send, it did not include the
!order-summary
token, which is the most important piece of my email (all the products, discounts, shipping costs, and total). That issue seems to be #1895418: Table with line items not included in the e-mail sent to regular user; however, I think this is its own issue.Comment #4
dddbbb CreditAttribution: dddbbb commentedChanges from #1?
Comment #5
MrPeanut CreditAttribution: MrPeanut commentedSorry, that should have said from the original post — the changes to the checkout rule (changing the user and recipient). That, combined with disabling query rewriting (from #5 on #1276450: Views results empty for unprivileged user when using Relationship: Content: Referenced Product), worked for me. Not sure if it's the best method, but it does get me the end result that I want.
Comment #6
mengi CreditAttribution: mengi commentedChange the weight of the rule to make it fire last and see if that fixes it. It was reported in the IRC chat that it did.
Comment #7
Selfirian CreditAttribution: Selfirian commented@mengi later on in the IRC chat we concluded that the weight might not have been the issue. By default the weight of the sending rule is higher as the others so that is not likely that this is causing anyone issues.
For me it worked out of the box even though I had to uninstall and reinstall it to start working correctly. (I had a error regarding duplicate entries in the DB and also I messed with the rules which was a bad idea)
So if you're letting commerce create an account for annon it should work out of the box.
Comment #8
MrPeanut CreditAttribution: MrPeanut commentedI have a fresh install of Drupal and Commerce with Commerce Message. I haven't adjusted any rules. The default weight of Commerce order message: order notification e-mail is 3. The rule Create a new account for an anonymous order is enabled at weight 2. The email did send. I also received the new account email.
When I change the message to include
!order-summary
, the order summary was not included. However, that's #1895418: Table with line items not included in the e-mail sent to regular user which can be fixed with #1276450-5: Views results empty for unprivileged user when using Relationship: Content: Referenced Product.So, it sounds like this issue is actually resolved? Not sure what caused the confusion (even on my own production site), but it does in fact work on a clean install.
Comment #9
jimmynash CreditAttribution: jimmynash commentedNot sure if this is helpful or not but I encountered this issue on custom messages that I was sending out with the message stack.
This helped me resolve it. It was an adjustment to the rule fired to send the custom message type.
https://drupalcommerce.org/questions/8175/commerce-message-order-confirm...
Comment #10
dddbbb CreditAttribution: dddbbb commented@jimmynash Yep - that's the link I mentioned in my initial post. We've gone full circle! :)
Comment #11
pslcbs CreditAttribution: pslcbs commentednice link!!!
Comment #12
wdseelig CreditAttribution: wdseelig commentedThe suggestions above, especially in the posts by mojolama worked just fine. Thanks very much!