Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2920337-2.refactor_total_quantity_condition.patch | 5.34 KB | rszrama |
|
Comments
Comment #2
rszrama CreditAttribution: rszrama at Centarro commentedActually, 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.
Comment #3
rszrama CreditAttribution: rszrama at Centarro commentedCommitted.