Package org.broadleafcommerce.core.order.domain

Examples of org.broadleafcommerce.core.order.domain.OrderItem


    public void removeItemFromOrder() throws PricingException {
        Order order = cartService.findOrderById(orderId);
        List<OrderItem> orderItems = order.getOrderItems();
        assert orderItems.size() > 0;
        int startingSize = orderItems.size();
        OrderItem item = orderItems.get(0);
        assert item != null;
        cartService.removeItemFromOrder(order, item);
        order = cartService.findOrderById(orderId);
        List<OrderItem> items = order.getOrderItems();
        assert items != null;
View Full Code Here


    @Transactional
    public void removeItemFromOrderAfterFulfillmentGroups() {
        Order order = cartService.findOrderById(orderId);
        List<OrderItem> orderItems = order.getOrderItems();
        assert orderItems.size() > 0;
        OrderItem item = orderItems.get(0);
        assert item != null;
        try {
            cartService.removeItemFromOrder(order, item);
        } catch (PricingException e) {
            throw new RuntimeException(e);
View Full Code Here

        newProduct.setDefaultSku(newDefaultSku);
        newProduct = catalogService.saveProduct(newProduct);

        Order order = cartService.createNamedOrderForCustomer("Pants Order", customer);

        OrderItem orderItem = cartService.addSkuToOrder(order.getId(), newDefaultSku.getId(),
                newProduct.getId(), category.getId(), 2);
        OrderItem quantityNullOrderItem = cartService.addSkuToOrder(order.getId(), newDefaultSku.getId(),
                newProduct.getId(), category.getId(), null);
        OrderItem skuNullOrderItem = cartService.addSkuToOrder(order.getId(), null,
                null, category.getId(), 2);
        OrderItem orderNullOrderItem = cartService.addSkuToOrder(null, newDefaultSku.getId(),
                newProduct.getId(), category.getId(), 2);
        OrderItem productNullOrderItem = cartService.addSkuToOrder(order.getId(), newDefaultSku.getId(),
                null, category.getId(), 2);
        OrderItem categoryNullOrderItem = cartService.addSkuToOrder(order.getId(), newDefaultSku.getId(),
                newProduct.getId(), null, 2);
       
        assert orderItem != null;
        assert skuNullOrderItem == null;
        assert quantityNullOrderItem == null;
View Full Code Here

        newProduct.setDefaultSku(newDefaultSku);
        newProduct = catalogService.saveProduct(newProduct);       

        Order order = cartService.createNamedOrderForCustomer("Pants Order", customer);

        OrderItem orderItem = cartService.addSkuToOrder(order.getId(), newDefaultSku.getId(),
                newProduct.getId(), category.getId(), 2);
        OrderItem quantityNullOrderItem = cartService.addSkuToOrder(order.getId(), newDefaultSku.getId(),
                newProduct.getId(), category.getId(), null);
        OrderItem skuNullOrderItem = cartService.addSkuToOrder(order.getId(), null,
                null, category.getId(), 2);
        OrderItem orderNullOrderItem = cartService.addSkuToOrder(null, newDefaultSku.getId(),
                newProduct.getId(), category.getId(), 2);
        OrderItem productNullOrderItem = cartService.addSkuToOrder(order.getId(), newDefaultSku.getId(),
                null, category.getId(), 2);
        OrderItem categoryNullOrderItem = cartService.addSkuToOrder(order.getId(), newDefaultSku.getId(),
                newProduct.getId(), null, 2);
       
        assert orderItem != null;
        assert skuNullOrderItem == null;
        assert quantityNullOrderItem == null;
View Full Code Here

   
    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();
    }
View Full Code Here

                }
                sb.append("]);");
            }
            for (FulfillmentGroup fulfillmentGroup : order.getFulfillmentGroups()) {
                for (FulfillmentGroupItem fulfillmentGroupItem : fulfillmentGroup.getFulfillmentGroupItems()) {
                    OrderItem orderItem = fulfillmentGroupItem.getOrderItem();

                    Sku sku = null;
                    if (orderItem instanceof DiscreteOrderItem) {
                        sku = ((DiscreteOrderItem)orderItem).getSku();
                    } else if (orderItem instanceof BundleOrderItem) {
                        sku = ((BundleOrderItem)orderItem).getSku();
                    }
                   
                    sb.append("_gaq.push(['_addItem','" + order.getOrderNumber() + "'");
                    sb.append(",'" + sku.getId() + "'");
                    sb.append(",'" + sku.getName() + "'");
                    sb.append(",'" + getVariation(orderItem) + "'");
                    sb.append(",'" + orderItem.getPrice() + "'");
                    sb.append(",'" + orderItem.getQuantity() + "'");
                    sb.append("]);");
                }
            }
            sb.append("_gaq.push(['_trackTrans']);");
        }
View Full Code Here

        if (priceOrder && !save) {
            throw new IllegalArgumentException("Pricing requires a save");
        }

        Order order = fulfillmentGroupItemRequest.getOrder();
        OrderItem item = fulfillmentGroupItemRequest.getOrderItem();
        FulfillmentGroup fulfillmentGroup = fulfillmentGroupItemRequest.getFulfillmentGroup();
       
        if (order == null) {
            if (item.getOrder() != null) {
                order = item.getOrder();
            } else {
                throw new IllegalArgumentException("Order must not be null");
            }
        }
       
View Full Code Here

        };
    }

    @Override
    public OrderItem findRelatedQualifierRoot(OrderItem relatedQualifier) {
        OrderItem relatedQualifierRoot = null;
        if (relatedQualifier != null) {
            relatedQualifierRoot = relatedQualifier;
            while (relatedQualifierRoot.getParentOrderItem() != null) {
                relatedQualifierRoot = relatedQualifierRoot.getParentOrderItem();
            }
        }
        return relatedQualifierRoot;
    }
View Full Code Here

            boolean checkOnly, Offer promotion, OrderItem relatedQualifierRoot, OfferItemCriteria itemCriteria,
            List<PromotableOrderItemPriceDetail> priceDetails, int targetQtyNeeded) {
        for (PromotableOrderItemPriceDetail priceDetail : priceDetails) {
            if (relatedQualifier != null) {
                // We need to make sure that this item is either a parent, child, or the same as the qualifier root
                OrderItem thisItem = priceDetail.getPromotableOrderItem().getOrderItem();
                if (!relatedQualifierRoot.isAParentOf(thisItem) && !thisItem.isAParentOf(relatedQualifierRoot) &&
                        !thisItem.equals(relatedQualifierRoot)) {
                    continue;
                }
            }

            int itemQtyAvailableToBeUsedAsTarget = priceDetail.getQuantityAvailableToBeUsedAsTarget(itemOffer);
View Full Code Here

        // Calculate the number of qualifiers needed that will not receive the promotion. 
        // These will be reserved first before the target is assigned.
        int qualifierQtyNeeded = itemCriteria.getQuantity();

        for (PromotableOrderItemPriceDetail detail : priceDetails) {
            OrderItem oi = detail.getPromotableOrderItem().getOrderItem();

            if (qualifierQtyNeeded > 0) {
                int itemQtyAvailableToBeUsedAsQualifier = detail.getQuantityAvailableToBeUsedAsQualifier(itemOffer);
                if (itemQtyAvailableToBeUsedAsQualifier > 0) {
                    // We have found a qualifier that meets this offer criteria. First, we'll save some state that we
View Full Code Here

TOP

Related Classes of org.broadleafcommerce.core.order.domain.OrderItem

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.