Package org.broadleafcommerce.core.offer.service.discount

Examples of org.broadleafcommerce.core.offer.service.discount.PromotionQualifier


                    }

                    // Go ahead and mark this item as a qualifier
                    int qtyToMarkAsQualifier = Math.min(qualifierQtyNeeded, itemQtyAvailableToBeUsedAsQualifier);
                    qualifierQtyNeeded -= qtyToMarkAsQualifier;
                    PromotionQualifier pq = detail.addPromotionQualifier(itemOffer, itemCriteria, qtyToMarkAsQualifier);

                    // Now, we need to see if there exists a target(s) that is suitable for this qualifier due to
                    // the relationship flag. If we are on the last qualifier required for this offer, we want to
                    // actually go ahead and mark the target that we'll be using. Otherwise, we just want to check
                    // that there is an eligible target(s) and continue on.
                    if (itemOfferMarkTargets.markTargets(itemOffer, order, oi, true)) {
                        // We found a target. Let's save this related order item used as the qualifier in case
                        // we succeed
                        orderItemHolder.setOrderItem(oi);
                    } else {
                        // If we didn't find a target, we need to roll back how we marked this item as a qualifier.
                        qualifierQtyNeeded += qtyToMarkAsQualifier;
                        if (pq.getQuantity() == qtyToMarkAsQualifier) {
                            detail.getPromotionQualifiers().remove(pq);
                        } else {
                            pq.setItemCriteria(previousQualifierCriteria);
                            pq.setQuantity(pq.getQuantity() - qtyToMarkAsQualifier);
                        }
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.broadleafcommerce.core.offer.service.discount.PromotionQualifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.