use of org.broadleafcommerce.core.order.domain.FulfillmentGroup in project BroadleafCommerce by BroadleafCommerce.
the class BroadleafShippingInfoController method saveMultiShipInstruction.
public String saveMultiShipInstruction(HttpServletRequest request, HttpServletResponse response, Model model, MultiShipInstructionForm instructionForm) throws ServiceException, PricingException {
Order cart = CartState.getCart();
FulfillmentGroup fulfillmentGroup = null;
for (FulfillmentGroup tempFulfillmentGroup : cart.getFulfillmentGroups()) {
if (tempFulfillmentGroup.getId().equals(instructionForm.getFulfillmentGroupId())) {
fulfillmentGroup = tempFulfillmentGroup;
}
}
fulfillmentGroup.setPersonalMessage(instructionForm.getPersonalMessage());
fulfillmentGroup.setDeliveryInstruction(instructionForm.getDeliveryMessage());
fulfillmentGroupService.save(fulfillmentGroup);
// append current time to redirect to fix a problem with ajax caching in IE
return getCheckoutPageRedirect() + "?_=" + System.currentTimeMillis();
}
use of org.broadleafcommerce.core.order.domain.FulfillmentGroup in project BroadleafCommerce by BroadleafCommerce.
the class GoogleUniversalAnalyticsProcessor method getItemJs.
protected String getItemJs(Order order, String trackerPrefix) {
StringBuffer sb = new StringBuffer();
for (FulfillmentGroup fulfillmentGroup : order.getFulfillmentGroups()) {
for (FulfillmentGroupItem fulfillmentGroupItem : fulfillmentGroup.getFulfillmentGroupItems()) {
OrderItem orderItem = fulfillmentGroupItem.getOrderItem();
Sku sku = ((SkuAccessor) orderItem).getSku();
sb.append("ga('" + trackerPrefix + "ecommerce:addItem', {");
sb.append("'id': '" + order.getOrderNumber() + "'");
sb.append(",'name': '" + sku.getName() + "'");
sb.append(",'sku': '" + sku.getId() + "'");
sb.append(",'category': '" + getVariation(orderItem) + "'");
sb.append(",'price': '" + orderItem.getAveragePrice() + "'");
sb.append(",'quantity': '" + orderItem.getQuantity() + "'");
sb.append("});");
}
}
return sb.toString();
}
use of org.broadleafcommerce.core.order.domain.FulfillmentGroup in project BroadleafCommerce by BroadleafCommerce.
the class FulfillmentGroupServiceImpl method addFulfillmentGroupToOrder.
@Override
@Transactional("blTransactionManager")
public FulfillmentGroup addFulfillmentGroupToOrder(FulfillmentGroupRequest fulfillmentGroupRequest, boolean priceOrder) throws PricingException {
FulfillmentGroup fg = fulfillmentGroupDao.create();
fg.setAddress(fulfillmentGroupRequest.getAddress());
fg.setOrder(fulfillmentGroupRequest.getOrder());
fg.setPhone(fulfillmentGroupRequest.getPhone());
fg.setFulfillmentOption(fulfillmentGroupRequest.getOption());
fg.setType(fulfillmentGroupRequest.getFulfillmentType());
for (int i = 0; i < fulfillmentGroupRequest.getFulfillmentGroupItemRequests().size(); i++) {
FulfillmentGroupItemRequest request = fulfillmentGroupRequest.getFulfillmentGroupItemRequests().get(i);
request.setFulfillmentGroup(fg);
request.setOrder(fulfillmentGroupRequest.getOrder());
boolean shouldPriceOrder = (priceOrder && (i == (fulfillmentGroupRequest.getFulfillmentGroupItemRequests().size() - 1)));
fg = addItemToFulfillmentGroup(request, shouldPriceOrder);
}
return fg;
}
use of org.broadleafcommerce.core.order.domain.FulfillmentGroup in project BroadleafCommerce by BroadleafCommerce.
the class FulfillmentGroupServiceImpl method calculateNumShippableFulfillmentGroups.
@Override
public Integer calculateNumShippableFulfillmentGroups(Order order) {
Integer numShippableFulfillmentGroups = 0;
List<FulfillmentGroup> fulfillmentGroups = order.getFulfillmentGroups();
for (FulfillmentGroup fulfillmentGroup : CollectionUtils.emptyIfNull(fulfillmentGroups)) {
if (isShippable(fulfillmentGroup.getType())) {
numShippableFulfillmentGroups++;
}
}
return numShippableFulfillmentGroups;
}
use of org.broadleafcommerce.core.order.domain.FulfillmentGroup in project BroadleafCommerce by BroadleafCommerce.
the class FulfillmentGroupOfferProcessorImpl method calculateFulfillmentGroupTotal.
@Override
public void calculateFulfillmentGroupTotal(PromotableOrder order) {
Money totalFulfillmentCharges = BroadleafCurrencyUtils.getMoney(BigDecimal.ZERO, order.getOrderCurrency());
for (PromotableFulfillmentGroup fulfillmentGroupMember : order.getFulfillmentGroups()) {
FulfillmentGroup fulfillmentGroup = fulfillmentGroupMember.getFulfillmentGroup();
Money fulfillmentCharges;
if (fulfillmentGroup.getShippingOverride()) {
fulfillmentCharges = fulfillmentGroup.getFulfillmentPrice();
} else {
fulfillmentCharges = fulfillmentGroupMember.getFinalizedPriceWithAdjustments();
fulfillmentGroupMember.getFulfillmentGroup().setFulfillmentPrice(fulfillmentCharges);
}
totalFulfillmentCharges = totalFulfillmentCharges.add(fulfillmentCharges);
}
order.setTotalFufillmentCharges(totalFulfillmentCharges);
}
Aggregations