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.

CommentFileSizeAuthor
#2 distinct-queery-2916735-1.patch418 bytesandyhat

Comments

andyhat created an issue. See original summary.

andyhat’s picture

StatusFileSize
new418 bytes

  • quantumized committed ff8b543 on 7.x-1.x authored by andyhat
    Issue #2916735 by andyhat: Multiple emails sent for orders with more...
3cwebdev’s picture

Good catch, thank you. Patch committed to DEV. Please test to verify it works as expected.

3cwebdev’s picture

Status: Active » Needs review
andyhat’s picture

I have tested the change on our site and it work as expected only sending a single email for each abandonded shopping cart.

nelslynn’s picture

@quantumized
The patch is not implemented in the latest dev, however, applying the patch to the dev version works.

  • quantumized committed 79ec408 on 7.x-1.x authored by andyhat
    Issue #2916735 by andyhat, quantumized: Multiple emails sent for orders...
3cwebdev’s picture

Commited.

nelslynn’s picture

I 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

  • quantumized committed f78ca40 on 7.x-1.x authored by andyhat
    Issue #2916735 by andyhat, quantumized: Multiple emails sent for orders...
3cwebdev’s picture

@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?

nelslynn’s picture

The 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)'.

Beckey’s picture

Is 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 :/

3cwebdev’s picture

My 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.

3cwebdev’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.