Friday, 6 September 2019

GiftWrap Handling info

GiftWrap handling
I)How to create giftwrap commerce item.
  The following block of should be part of  synchronized blcok
 1) Get the skuId and product Id from component configuraiton.
 2)Create commerce item by passing giftwrapItemType,skuId,productId, qty  as parameters
 3)Call the Commerce Item as follows   ciManager.addAsSeparateItemToOrder(order, gWItem);
 4)Get the shipping group as ShippingGroup sg = (ShippingGroup) getOrder().getShippingGroups().get(0);
 5)Add item qty to shipping group as follows ciManager.addItemQuantityToShippingGroup(order, gWItem.getId(),sg.getId(), qty);
 6)Set qty to giftwrap commerce Item gWItem.setQuantity(qty);
 7)Get the extra parameters map as Map extraParams = createRepriceParameterMap();
 8)Reprice the order as follows
                String repriceOrderPricingOp = PricingConstants.OP_REPRICE_ORDER_TOTAL;
              runProcessRepriceOrder(repriceOrderPricingOp, order,
getUserPricingModels(), getUserLocale(), getProfile(),
extraParams);
9)Cal the CommerceItemManager.updateOrder(order);

Note: Already giftwrap Product and SKU is crated in BCC.

No comments:

Post a Comment