I have testing the module for use on a site and running in test mode. The module appear to do exactly what we will need.
When processing an order with more than 1 line item multiple emails will be sent (1 for each line item on the order).
The query at line 56 of commerce_abandoned_carts.module returns a record for every line item.
$query = db_select('commerce_order', 'o');
$query->leftJoin('commerce_abandoned_carts', 'a', 'o.order_id = a.order_id');
$query->join('commerce_line_item', 'l', 'o.order_id = l.order_id'); // only query for carts that have line items in them
$query->fields('o', array('order_id', 'status', 'mail'))
->condition('o.mail', '', '!=')
->isNull('a.status')
->condition('o.created', $time - $carts_timeout, '<')
->condition('o.created', $time - $history_limit, '>=')
->condition('o.status', $statuses, 'IN')
->orderBy('o.created', 'ASC');
$result = $query->execute();This can be easily fixed by requiring the query only returns distinct orders.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | distinct-queery-2916735-1.patch | 418 bytes | andyhat |
Comments
Comment #2
andyhat commentedComment #4
3cwebdev commentedGood catch, thank you. Patch committed to DEV. Please test to verify it works as expected.
Comment #5
3cwebdev commentedComment #6
andyhat commentedI have tested the change on our site and it work as expected only sending a single email for each abandonded shopping cart.
Comment #7
nelslynn commented@quantumized
The patch is not implemented in the latest dev, however, applying the patch to the dev version works.
Comment #9
3cwebdev commentedCommited.
Comment #10
nelslynn commentedI tested the new dev version but now something else is happening (see below). Let me know if you want me to start another issue.
When there are two abandon cart order emails to send, the first one is sent fine. The 2nd email contains both orders in one email message. This happens in both test mode and live mode. The orders are from the same person. Personally, I would think these should come in two separate email messages.
Screenshot of the second email
https://www.dropbox.com/s/u3sw12t8ezfurpu/abandon-cart.png?dl=0
Comment #12
3cwebdev commented@nelslynn - I believe I have found and fixed the issue. However, I am unable to test this at the moment. I've pushed the commit to the DEV snapshot, would you be able to test to verify if the issue is resolved now?
Comment #13
nelslynn commentedThe latest version resolved the issue! Thanks for the quick fix!Sorry, just implemented the module on a live site and there still seems to be an issue. Only one email is sent when there should be 3 (all difference order owners). The log message indicates 3 emails are sent, but only the first email is received. Nothing in SPAM folder either.
Also, the sender is indicated as '(unknown sender)'.
Comment #14
Beckey commentedIs there any movement on this at all please? I would really like to use this module, but some of our orders have lots of lines on them and I can't risk sending masses of emails to customers :/
Comment #15
3cwebdev commentedMy tests have confirmed that this issue does not exist. Carts with multiple items are only receiving one email. Note that you can perform a 'test mode' run to have the abandoned email sent to your test email address for verification. Also, please be sure to update to the latest dev release released today.
Comment #16
3cwebdev commented