Similar to #2844361: Refactor the condition "Order contains a particular product" to improve performance and #2920334: Refactor the condition "Order contains products of particular product types" to improve performance, refactor this condition's code to use an EFQ to find the matching line items and SUM their quantities using a single database query instead of the wrapper based approach.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rszrama created an issue. See original summary.

rszrama’s picture

Status: Active » Needs review
FileSize
5.34 KB

Actually, did this one first and created the API function I recommended in #2920334: Refactor the condition "Order contains products of particular product types" to improve performance. Reversed the pattern of exiting early when we didn't get a valid order I introduced in #2844361: Refactor the condition "Order contains a particular product" to improve performance because it actually changed the logic of the function. (Previously, the count would've assumed to have been 0, allowing it to pass < / <= checks.)

Patch attached.

rszrama’s picture

Status: Needs review » Fixed

Committed.

  • rszrama committed 8b01ac5 on 7.x-1.x
    Issue #2920337 by rszrama: Refactor the condition "Total product...

Status: Fixed » Closed (fixed)

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