@Override public boolean isPricingAtContainerLevel() { return !shouldSumItems(); }
@Override public boolean getAllowDiscountsOnChildItems() { if (shouldSumItems()) { if (productBundle != null) { return productBundle.getItemsPromotable(); } else { return true; } } else { return false; } }
@Override public boolean isDiscountingAllowed() { if (shouldSumItems()) { return false; } else { return productBundle.getBundlePromotable(); } }
@Override public Money getTotalPrice() { Money returnValue = convertToMoney(BigDecimal.ZERO); if (shouldSumItems()) { for (OrderItem containedItem : getOrderItems()) { returnValue = returnValue.add(containedItem.getTotalPrice()); } returnValue = returnValue.multiply(quantity); } else { returnValue = super.getTotalPrice(); } return returnValue; }
@Override public Money getTaxablePrice() { if (shouldSumItems()) { Money currentBundleTaxablePrice = BroadleafCurrencyUtils.getMoney(getOrder().getCurrency()); for (DiscreteOrderItem discreteOrderItem : discreteOrderItems) { BigDecimal currentItemTaxablePrice = discreteOrderItem.getTaxablePrice().getAmount(); BigDecimal priceWithQuantity = currentItemTaxablePrice.multiply(new BigDecimal(discreteOrderItem.getQuantity())); currentBundleTaxablePrice = currentBundleTaxablePrice.add(BroadleafCurrencyUtils.getMoney(priceWithQuantity, getOrder().getCurrency())); } for (BundleOrderItemFeePrice fee : getBundleOrderItemFeePrices()) { if (fee.isTaxable()) { currentBundleTaxablePrice = currentBundleTaxablePrice.add(fee.getAmount()); } } return currentBundleTaxablePrice; } else { return super.getTaxablePrice(); } }
@Override public Money getRetailPrice() { if (shouldSumItems()) { Money bundleRetailPrice = BroadleafCurrencyUtils.getMoney(getOrder().getCurrency()); for (DiscreteOrderItem discreteOrderItem : discreteOrderItems) { BigDecimal itemRetailPrice = discreteOrderItem.getRetailPrice().getAmount(); BigDecimal quantityPrice = itemRetailPrice.multiply(new BigDecimal(discreteOrderItem.getQuantity())); bundleRetailPrice = bundleRetailPrice.add(BroadleafCurrencyUtils.getMoney(quantityPrice, getOrder().getCurrency())); } for (BundleOrderItemFeePrice fee : getBundleOrderItemFeePrices()) { bundleRetailPrice = bundleRetailPrice.add(fee.getAmount()); } return bundleRetailPrice; } else { return super.getRetailPrice(); } }
private boolean updateRetailPrice() { if (isRetailPriceOverride()) { return false; } // Only need to update prices if we are not summing the contained items to determine // the price. if (! shouldSumItems()) { if (getSku() != null && !getSku().getRetailPrice().equals(retailPrice)) { baseRetailPrice = getSku().getRetailPrice().getAmount(); retailPrice = getSku().getRetailPrice().getAmount(); return true; } } return false; }
private boolean updateSalePrice() { if (isSalePriceOverride()) { return false; } // Only need to update prices if we are not summing the contained items to determine // the price. if (! shouldSumItems()) { if (getSku() != null && getSku().getSalePrice() != null && !getSku().getSalePrice().equals(salePrice)) { baseSalePrice = getSku().getSalePrice().getAmount(); salePrice = getSku().getSalePrice().getAmount(); return true; } } return false; }
@Override public Money getSalePrice() { if (shouldSumItems()) { Money bundleSalePrice = null; if (hasSaleItems()) { bundleSalePrice = BroadleafCurrencyUtils.getMoney(getOrder().getCurrency()); for (DiscreteOrderItem discreteOrderItem : discreteOrderItems) { BigDecimal itemSalePrice = null; if (discreteOrderItem.getSalePrice() != null) { itemSalePrice = discreteOrderItem.getSalePrice().getAmount(); } else { itemSalePrice = discreteOrderItem.getRetailPrice().getAmount(); } BigDecimal quantityPrice = itemSalePrice.multiply(new BigDecimal(discreteOrderItem.getQuantity())); bundleSalePrice = bundleSalePrice.add(BroadleafCurrencyUtils.getMoney(quantityPrice, getOrder().getCurrency())); } for (BundleOrderItemFeePrice fee : getBundleOrderItemFeePrices()) { bundleSalePrice = bundleSalePrice.add(fee.getAmount()); } } return bundleSalePrice; } else { return super.getSalePrice(); } }