Hello,

I'm wondering if anonymous checkout is possible.

When I try an anonymous order everything is working perfectly (order is generated, pdf is generated), however the PDF is not getting attached to the email via the "Send the PDF with barcode" rule. I don't get any email at all, or one with no attachment if I set it to "Send the email even if the order has no tickets".

I thought it was because of the private file system storage, but I still get nothing if I set anonymous to be able to see private files (which I'd rather not do anyway).

Thanks,

•• matt

Comments

pjcdawkins’s picture

Component: Miscellaneous » Code
Assigned: Unassigned » pjcdawkins
Category: Support request » Feature request
Related issues: +#2260571: Sending en email and accessing the pdf

It isn't yet, so I'm converting this to 'Feature request'.

pjcdawkins’s picture

For the OP (mattlt):

There is no access check in the email code - if any valid tickets exist for the order, they will be attached. The reason why the PDF is not attached is more likely that the ticket(s) are not considered 'valid', for whatever reason.

pjcdawkins’s picture

Category: Feature request » Support request
Status: Active » Postponed (maintainer needs more info)

At the moment I don't think this is due to missing functionality - let me know if you still can't get this working

mattlt’s picture

Hi Patrick,

We're going to test out the most recent changes you made the last couple days and see if we can get it working. We'll definitely keep you update.

Thanks for the update and for the module!

•• matt

miechiel’s picture

Hi,

We recently started a website including this module which had the same issue as described in this issue.
I found that the drupal_mail() function also seems to check if the attachment on the mail to this user can be accessed.
I fixed this by adding the file to the mail as raw data. Attached is my patch that did the trick..

pjcdawkins’s picture

Title: Anonymous checkout » Anonymous checkout issue(s)
Assigned: pjcdawkins » Unassigned
Category: Support request » Bug report
Status: Postponed (maintainer needs more info) » Needs review

That patch might be a good idea, thanks @miechiel. I'll test it when I can.

pjcdawkins’s picture

Status: Needs review » Reviewed & tested by the community

I think #5 is good

alfthecat’s picture

The patch from #5 works, thanks!
On the ticket "anonymous" gets printed for the customer name instead of the usersname when anonymous users are allowed to checkout, but accounts are created in the process.

I think it would be great if the chosen username could be used.

pjcdawkins’s picture

@AlfTheCat

I don't really know anything about anonymous checkout but that doesn't seem like a commerce_event_ticket problem.

  $order = commerce_order_load($ticket->order_id);
// ...
  $owner = user_load($order->uid);
// ...
  $variables['data'] = array(
    t('Order number') => $order->order_number,
    t('Order date') => format_date($order->created),
    t('Customer') => format_username($owner),
  );

So if the order's UID is set properly, the customer name will be correct. Surely, if there is an anonymous checkout system, the order UID should be set correctly with a customer name?

alfthecat’s picture

Hi pjcdawkins,

Today the tickets are no longer being emailed at all... I've spent hours now trying to figure out why.

There's noting in the watchdog or apache log. UID1 and anonymous are just not getting emails with tickets. Other emails from the site do work.

Do you have any suggestions on what to do?

Thanks a bunch!

miechiel’s picture

@AlfTheCat

Are these new tickets available via the admin interface (admin/commerce/tickets ) and downloadable?

If Yes.
Did you already checked the folder where the pdf are generated are they readable for drupal?

alfthecat’s picture

Hi Miechiel,

Yes to all, the tickets are available via the admin interface, they're validated. The PDF's are accessible, at least to authenticated users (I can view and download them in my browser) but I've also made sure anonymous users have the permission to view their own private files, as do authenticated users. The folder is writable, readable.

During the "anonymous" checkout, accounts are actually created for these anonyous users. But as UID1, I'm also not getting the tickets by email. I'm getting the order confirmation emails, new account creation emails so the email part is working....

pjcdawkins’s picture

When you say 'validated', are they marked as 'used' already? or do you just mean they are 'valid'?

commerce_event_ticket_mail will not send tickets that are used:

  if (!$ticket->used && commerce_event_ticket_is_valid($ticket)) {
    // here's where the the ticket gets added to the email
alfthecat’s picture

Thanks pjcdawkins,

I found the issue(s): by default drupal commerce seems to set orders to "processing" after payment is received, not "completed" which triggers the ticket generation rules according to the default settings of this module. On top of that, I had to increase the weight of the "email tickets to customer" rule (to be safe I set it to 3). After doing this, it worked! I've now not tested this with the patch and the latest dev, as earlier in the process I've reverted back to the latest stable, beta2.

Thanks again!

  • pjcdawkins committed d369f40 on 7.x-1.x authored by miechiel
    Issue #2289953 by mattlt, miechiel: attach PDF files directly to the...
pjcdawkins’s picture

Status: Reviewed & tested by the community » Closed (fixed)

@AlfTheCat thanks for the update, yes it's weird that Commerce doesn't mark orders as 'complete' after checkout by default.

On top of that, I had to increase the weight of the "email tickets to customer" rule (to be safe I set it to 3).

Good catch, I'll patch that directly in the module.

Obviously some better documentation is needed too - see #2368625: General Documentation.

I have committed the patch in #5. Please create a new issue if you have other questions.

Status: Closed (fixed) » Needs work

The last submitted patch, 5: commerce_event_ticket-Anonymous_checkout-2289953-5.patch, failed testing.

pjcdawkins’s picture

Status: Needs work » Closed (fixed)

Stupid testbot