|
26 | 26 | import org.broadleafcommerce.common.currency.util.BroadleafCurrencyUtils;
|
27 | 27 | import org.broadleafcommerce.common.money.BankersRounding;
|
28 | 28 | import org.broadleafcommerce.common.money.Money;
|
| 29 | +import org.broadleafcommerce.common.util.BLCSystemProperty; |
29 | 30 | import org.broadleafcommerce.core.offer.domain.Offer;
|
30 | 31 | import org.broadleafcommerce.core.offer.domain.OfferOfferRuleXref;
|
31 | 32 | import org.broadleafcommerce.core.offer.domain.OfferRule;
|
@@ -81,14 +82,32 @@ public void filterFulfillmentGroupLevelOffer(PromotableOrder order, List<Promota
|
81 | 82 |
|
82 | 83 | // Item Qualification - new for 1.5!
|
83 | 84 | if (fgLevelQualification) {
|
| 85 | + |
84 | 86 | CandidatePromotionItems candidates = couldOfferApplyToOrderItems(offer, fulfillmentGroup.getDiscountableOrderItems());
|
| 87 | + // couldn't qualify based on the items within this fulfillment group, jump out and now try to validate based |
| 88 | + // on all the items in the order across all fulfillment groups (not the default behavior) |
| 89 | + if (!candidates.isMatchedQualifier() && getQualifyGroupAcrossAllOrderItems(fulfillmentGroup)) { |
| 90 | + candidates = couldOfferApplyToOrderItems(offer, order.getAllOrderItems()); |
| 91 | + } |
| 92 | + |
85 | 93 | if (candidates.isMatchedQualifier()) {
|
86 | 94 | PromotableCandidateFulfillmentGroupOffer candidateOffer = createCandidateFulfillmentGroupOffer(offer, qualifiedFGOffers, fulfillmentGroup);
|
87 | 95 | candidateOffer.getCandidateQualifiersMap().putAll(candidates.getCandidateQualifiersMap());
|
88 | 96 | }
|
89 | 97 | }
|
90 | 98 | }
|
91 | 99 | }
|
| 100 | + |
| 101 | + /** |
| 102 | + * Whether or not items across the entire order should be considered in item-level qualifiers for the given fulfillment |
| 103 | + * group. Default behavior is to use only the items within the fulfillment group for the item-level qualifiers. |
| 104 | + * |
| 105 | + * @param fg the fulfillment group that we are attempting to apply item-level qualifiers to |
| 106 | + * @return |
| 107 | + */ |
| 108 | + protected boolean getQualifyGroupAcrossAllOrderItems(PromotableFulfillmentGroup fg) { |
| 109 | + return BLCSystemProperty.resolveBooleanSystemProperty("promotion.fulfillmentgroup.qualifyAcrossAllOrderItems", false); |
| 110 | + } |
92 | 111 |
|
93 | 112 | @Override
|
94 | 113 | public void calculateFulfillmentGroupTotal(PromotableOrder order) {
|
|
0 commit comments