private bool IsEnoughStock(out string errMsg)
    {
        errMsg = String.Empty;
        ICartItem cartItem = StoreContext.ShoppingCart.FindCartItemByID(CartItemID);
        int       quantity = ConvertUtilities.ToInt32(uxQuantityText.Text);
        OptionItemValueCollection options = uxProductOptionGroupDetails.GetSelectedOptions();
        int productStock = cartItem.Product.GetStock(options.GetUseStockOptionItemIDs());
        int currentStock = productStock - quantity;

        if (currentStock != DataAccessContext.Configurations.GetIntValue("OutOfStockValue"))
        {
            if (CatalogUtilities.IsOutOfStock(currentStock, CheckUseInventory(cartItem.Product)))
            {
                errMsg += cartItem.Product.Name;
                if (DataAccessContext.Configurations.GetBoolValue("ShowQuantity"))
                {
                    int displayStock = productStock - DataAccessContext.Configurations.GetIntValue("OutOfStockValue");
                    if (displayStock < 0)
                    {
                        displayStock = 0;
                    }
                    errMsg += " ( available " + displayStock + " items )";
                }
            }
        }
        if (!String.IsNullOrEmpty(errMsg))
        {
            errMsg = "Stock Error : " + errMsg;
            return(false);
        }
        else
        {
            return(true);
        }
    }
    public string GetSelectedOptions()
    {
        string selectedOption = string.Empty;

        if (CurrentProduct.ProductOptionGroups.Count > 0 && !uxProductOptionGroupPanel.Visible)
        {
            selectedOption = "0";
            return(selectedOption);
        }

        OptionItemValueCollection selectedOptionItemList = uxProductOptionGroupDetails.GetSelectedOptions();

        for (int i = 0; i < selectedOptionItemList.Count; i++)
        {
            if (String.IsNullOrEmpty(selectedOption))
            {
                selectedOption = selectedOptionItemList[i].OptionItemID;
            }
            else
            {
                selectedOption += "," + selectedOptionItemList[i].OptionItemID;
            }
        }

        return(selectedOption);
    }
    protected void uxOkButton_Click(object sender, EventArgs e)
    {
        if (uxOptionGroupDetails.IsValidInput)
        {
            OptionItemValueCollection selectedOptions = uxOptionGroupDetails.GetSelectedOptions();

            foreach (OptionItemValue item in selectedOptions)
            {
                ProductOptionIDs = item.OptionItemID + ",";
            }

            ProductOptionIDs = ProductOptionIDs.TrimEnd(',');
        }
        else
        {
            ProductOptionIDs = "Error";
        }

        if (CheckedRadio)
        {
            if (ProductCheckedChanged != null)
            {
                ProductCheckedChanged(this, EventArgs.Empty);
            }
        }
    }
    private void AddItemToShoppingCart()
    {
        OptionItemValueCollection     selectedOptions = uxOptionGroupDetails.GetSelectedOptions();
        ProductKitItemValueCollection selectedKits    = uxProductKitGroupDetails.GetSelectedProductKitItems();
        CartItemGiftDetails           giftDetails     = CreateGiftDetails();

        decimal customPrice = decimal.Parse(uxEnterAmountText.Text);

        customPrice = decimal.Divide(customPrice, Convert.ToDecimal(StoreContext.Currency.ConversionRate));


        CartAddItemService addToCartService = new CartAddItemService(
            StoreContext.Culture, StoreContext.ShoppingCart);
        int    currentStock;
        string errorOptionName;
        bool   stockOK = addToCartService.AddToCart(
            CurrentProduct,
            selectedOptions,
            selectedKits,
            ConvertUtilities.ToInt32(uxQuantityText.Text),
            giftDetails,
            customPrice,
            out errorOptionName,
            out currentStock);


        if (stockOK)
        {
            Response.Redirect("ShoppingCart.aspx");
        }
        else
        {
            DisplayOutOfStockError(currentStock, errorOptionName);
        }
    }
    private void AddToWishList(string productID, OptionItemValueCollection selectedOptions, string quantity)
    {
        Product product = DataAccessContext.ProductRepository.GetOne(
            StoreContext.Culture,
            productID, new StoreRetriever().GetCurrentStoreID());

        if (selectedOptions == null || selectedOptions.Count == 0)
        {
            StoreContext.WishList.Cart.AddItem(product, int.Parse(quantity));
        }
        else
        {
            OptionItemValueCollection inputLists = selectedOptions.GetOptionItemsByGroupType(
                OptionGroup.OptionGroupType.InputList);
            if (inputLists.Count == 0)
            {
                StoreContext.WishList.Cart.AddItem(product, int.Parse(quantity), selectedOptions);
            }
            else
            {
                OptionItemValueCollection optionsWithoutInputList =
                    selectedOptions.GetOptionItemsNotInGroupType(OptionGroup.OptionGroupType.InputList);
                //add product is Loop.
                foreach (OptionItemValue optionInput in inputLists)
                {
                    OptionItemValueCollection options = optionsWithoutInputList.Clone();
                    options.Add(optionInput);

                    StoreContext.WishList.Cart.AddItem(product, int.Parse(optionInput.Details), options);
                }
            }
        }

        DataAccessContext.CartRepository.UpdateWhole(StoreContext.WishList.Cart);
    }
示例#6
0
    private void AddItemToWishListCart(object sender, EventArgs e)
    {
        string errorMessage;

        if (VerifyValidInput(out errorMessage))
        {
            OptionItemValueCollection     selectedOptions = uxOptionGroupDetails.GetSelectedOptions();
            ProductKitItemValueCollection selectedKits    = uxProductKitGroupDetails.GetSelectedProductKitItems();

            if (CurrentProduct.MinQuantity <= ConvertUtilities.ToInt32(uxQuantityText.Text))
            {
                uxAddtoWishListButton.AddItemToWishListCart(CurrentProduct.ProductID, selectedOptions, uxQuantityText.Text);
            }
            else
            {
                uxAddtoWishListButton.AddItemToWishListCart(CurrentProduct.ProductID, selectedOptions, CurrentProduct.MinQuantity.ToString());
            }

            Response.Redirect("WishList.aspx");
        }
        else
        {
            uxMessage.Text = errorMessage;
        }
    }
示例#7
0
 protected string ConvertOptionCollectionToString(object obj)
 {
     if (obj != null)
     {
         OptionItemValueCollection collection = (OptionItemValueCollection)obj;
         return(collection.ToString());
     }
     else
     {
         return(String.Empty);
     }
 }
示例#8
0
    private decimal GetStock(string productID, string optionIDText)
    {
        Product product = DataAccessContext.ProductRepository.GetOne(StoreContext.Culture, productID, new StoreRetriever().GetCurrentStoreID());

        if (!String.IsNullOrEmpty(optionIDText))
        {
            OptionItemValueCollection options = new OptionItemValueCollection(StoreContext.Culture, optionIDText, product.ProductID);
            return(product.GetStock(options.GetUseStockOptionItemIDs()));
        }
        else
        {
            return(product.GetStock());
        }
    }
    protected void uxAddToWishList_Click(object sender, EventArgs e)
    {
        OptionItemValueCollection selectedOptions = uxOptionGroupDetails.GetSelectedOptions();

        if (CurrentProduct.MinQuantity <= ConvertUtilities.ToInt32(uxQuantityText.Text))
        {
            AddToWishList(CurrentProduct.ProductID, selectedOptions, uxQuantityText.Text);
        }
        else
        {
            AddToWishList(CurrentProduct.ProductID, selectedOptions, CurrentProduct.MinQuantity.ToString());
        }

        Response.Redirect("WishList.aspx");
    }
示例#10
0
    private void AddItemToShoppingCart()
    {
        OptionItemValueCollection     selectedOptions = uxOptionGroupDetails.GetSelectedOptions();
        ProductKitItemValueCollection selectedKits    = uxProductKitGroupDetails.GetSelectedProductKitItems();
        CartItemGiftDetails           giftDetails     = CreateGiftDetails();

        decimal customPrice = decimal.Parse(uxEnterAmountText.Text);

        customPrice = decimal.Divide(customPrice, Convert.ToDecimal(StoreContext.Currency.ConversionRate));

        CartAddItemService addToCartService = new CartAddItemService(
            StoreContext.Culture, StoreContext.ShoppingCart);
        int    currentStock;
        string errorOptionName;
        bool   stockOK = addToCartService.AddToCart(
            CurrentProduct,
            selectedOptions,
            selectedKits,
            ConvertUtilities.ToInt32(uxQuantityText.Text),
            giftDetails,
            customPrice,
            out errorOptionName,
            out currentStock);


        if (stockOK)
        {
            bool enableNotification = ConvertUtilities.ToBoolean(DataAccessContext.Configurations.GetValue("EnableAddToCartNotification", StoreContext.CurrentStore));
            if (UrlManager.IsMobileDevice(Request))
            {
                enableNotification = false;
            }
            if (enableNotification)
            {
                uxAddToCartNotification.Show(CurrentProduct, ConvertUtilities.ToInt32(uxQuantityText.Text), customPrice, giftDetails, selectedOptions, selectedKits);
            }
            else
            {
                Response.Redirect("ShoppingCart.aspx");
            }
        }
        else
        {
            DisplayOutOfStockError(currentStock, errorOptionName);
        }
    }
    public OptionItemValueCollection GetSelectedOptions()
    {
        // loop for each option in datalist
        // get selected option for each option
        //string[] result = new string[uxOptionDataList.Items.Count];
        OptionItemValueCollection optionSelected = new OptionItemValueCollection();

        for (int i = 0; i < uxOptionDataList.Items.Count; i++)
        {
            Components_OptionItemDetails details =
                (Components_OptionItemDetails)uxOptionDataList.Items[i].FindControl("uxOptionItemDetails");

            foreach (OptionItemValue item in details.GetSelectedItem())
            {
                optionSelected.Add(item);
            }
        }

        return(optionSelected);
    }
示例#12
0
 public void AddItemToWishListCart(string productID, OptionItemValueCollection selectedOptions)
 {
     AddToWishList(productID, selectedOptions);
 }
    public void Show(Product product, int quantity, decimal customPrice, CartItemGiftDetails giftDetails, OptionItemValueCollection selectedOptions, ProductKitItemValueCollection productKitItemCollection)
    {
        ProductImage image = product.GetPrimaryProductImage();

        uxProductImage.ImageUrl       = "~/" + image.RegularImage;
        uxProductNameLink.NavigateUrl = UrlManager.GetProductUrl(product.ProductID, product.Locales[StoreContext.Culture].UrlName);
        uxProductNameLink.Text        = "<div class='ProductName'>" + product.Name + "</div>";
        uxQuantityLabel.Text          = quantity.ToString();
        decimal productPrice = product.GetDisplayedPrice(StoreContext.WholesaleStatus);


        if (product.IsCustomPrice)
        {
            productPrice = customPrice;
        }

        if (product.IsGiftCertificate && !product.IsFixedPrice)
        {
            productPrice = giftDetails.GiftValue;
        }

        if (productKitItemCollection.Count > 0)
        {
            StringBuilder sb = new StringBuilder();
            foreach (OptionItemValue optionItemValue in selectedOptions)
            {
                sb.Append("<div class='OptionName'>");
                sb.Append(optionItemValue.GetDisplayedName(StoreContext.Culture, StoreContext.Currency));
                sb.Append("</div>");
            }

            if ((!productKitItemCollection.IsNull) && (productKitItemCollection.Count > 0))
            {
                sb.Append("<div class='OptionName'>");
                sb.Append("Items:");
                sb.Append("</div>");
            }

            foreach (ProductKitItemValue value in productKitItemCollection)
            {
                sb.Append("<div class='OptionName'>");
                sb.Append("- " + value.GetGroupName(StoreContext.Culture, StoreContext.CurrentStore.StoreID) + ":" + value.GetDisplayedName(StoreContext.Culture, StoreContext.CurrentStore.StoreID));
                sb.Append("</div>");
            }

            uxProductNameLink.Text = uxProductNameLink.Text + sb.ToString();
        }
        else
        {
            if (selectedOptions.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                foreach (OptionItemValue optionItemValue in selectedOptions)
                {
                    sb.Append("<div class='OptionName'>");
                    sb.Append(optionItemValue.GetDisplayedName(StoreContext.Culture, StoreContext.Currency));
                    sb.Append("</div>");

                    productPrice += optionItemValue.OptionItem.PriceToAdd;
                }

                uxProductNameLink.Text = uxProductNameLink.Text + sb.ToString();
            }
        }

        uxPriceLabel.Text = StoreContext.Currency.FormatPrice(productPrice);
        uxMessage.Text    = product.Name + "[$AddSuccess]";
        uxAddToCartPopup.Show();
    }
示例#14
0
    private bool IsEnoughStock(out string message)
    {
        message = String.Empty;

        foreach (ICartItem item in StoreContext.ShoppingCart.GetCartItems())
        {
            if (!item.IsPromotion)
            {
                int productStock = item.Product.GetStock(item.Options.GetUseStockOptionItemIDs());
                int currentStock = productStock - item.Quantity;

                if (currentStock != DataAccessContext.Configurations.GetIntValue("OutOfStockValue"))
                {
                    if (CatalogUtilities.IsOutOfStock(currentStock, CheckUseInventory(item.ProductID)))
                    {
                        message += "<li>" + item.GetName(StoreContext.Culture, StoreContext.Currency);
                        if (DataAccessContext.Configurations.GetBoolValue("ShowQuantity"))
                        {
                            int displayStock = productStock - DataAccessContext.Configurations.GetIntValue("OutOfStockValue");
                            if (displayStock < 0)
                            {
                                displayStock = 0;
                            }

                            message += " ( available " + displayStock + " items )";
                        }
                        else
                        {
                            message += "</li>";
                        }
                    }
                }

                if (item.IsProductKit)
                {
                    OptionItemValueCollection options = new OptionItemValueCollection();
                    foreach (ProductKitItemValue kitValue in item.ProductKits)
                    {
                        Product product = DataAccessContext.ProductRepository.GetOne(StoreContext.Culture, kitValue.ProductID, new StoreRetriever().GetCurrentStoreID());
                        productStock = product.GetStock(options.GetUseStockOptionItemIDs());
                        currentStock = productStock - kitValue.Quantity;
                        if (currentStock != DataAccessContext.Configurations.GetIntValue("OutOfStockValue"))
                        {
                            if (CatalogUtilities.IsOutOfStock(currentStock, CheckUseInventory(product.ProductID)))
                            {
                                message += "<li>" + product.Name + " of " + item.Product.Name;
                                if (DataAccessContext.Configurations.GetBoolValue("ShowQuantity"))
                                {
                                    int displayStock = productStock - DataAccessContext.Configurations.GetIntValue("OutOfStockValue");
                                    if (displayStock < 0)
                                    {
                                        displayStock = 0;
                                    }
                                    message += " ( available " + displayStock + " items )";
                                }
                                else
                                {
                                    message += "</li>";
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                CartItemPromotion cartItemPromotion = (CartItemPromotion)item;
                PromotionSelected promotionSelected = cartItemPromotion.PromotionSelected;
                foreach (PromotionSelectedItem selectedItem in promotionSelected.PromotionSelectedItems)
                {
                    Product  product         = selectedItem.Product;
                    string[] optionsUseStock = selectedItem.GetUseStockOptionItems().ToArray(typeof(string)) as string[];
                    int      productStock    = product.GetStock(optionsUseStock);
                    int      currentStock    = productStock - item.Quantity;
                    if (currentStock != DataAccessContext.Configurations.GetIntValue("OutOfStockValue"))
                    {
                        if (CatalogUtilities.IsOutOfStock(currentStock, CheckUseInventory(product.ProductID)))
                        {
                            message += "<li>" + item.GetName(StoreContext.Culture, StoreContext.Currency);
                            message += "</li>";
                        }
                    }
                }
            }
        }

        if (!String.IsNullOrEmpty(message))
        {
            message =
                "<p class=\"ErrorHeader\">[$StockError]</p>" +
                "<ul class=\"ErrorBody\">" + message + "</ul>";

            return(false);
        }
        else
        {
            return(true);
        }
    }
示例#15
0
    private bool IsEnoughStock(out string message)
    {
        message = String.Empty;

        int rowIndex;

        for (rowIndex = 0; rowIndex < uxGrid.Rows.Count; rowIndex++)
        {
            GridViewRow row = uxGrid.Rows[rowIndex];
            if (row.RowType == DataControlRowType.DataRow)
            {
                ICartItem cartItem    = (ICartItem)StoreContext.ShoppingCart.FindCartItemByID((string)uxGrid.DataKeys[rowIndex]["CartItemID"]);
                bool      isPromotion = (bool)uxGrid.DataKeys[rowIndex]["IsPromotion"];
                string    productID   = uxGrid.DataKeys[rowIndex]["ProductID"].ToString();
                string    productName = ((Label)row.FindControl("uxNameLabel")).Text;
                int       quantity    = ConvertUtilities.ToInt32(((TextBox)row.FindControl("uxQuantityText")).Text);
                if (!isPromotion)
                {
                    Product product = DataAccessContext.ProductRepository.GetOne(StoreContext.Culture, productID, new StoreRetriever().GetCurrentStoreID());

                    OptionItemValueCollection options = (OptionItemValueCollection)uxGrid.DataKeys[rowIndex]["Options"];
                    int productStock = product.GetStock(options.GetUseStockOptionItemIDs());
                    int currentStock = productStock - quantity;
                    if (currentStock != DataAccessContext.Configurations.GetIntValue("OutOfStockValue"))
                    {
                        if (CatalogUtilities.IsOutOfStock(currentStock, CheckUseInventory(productID)))
                        {
                            message += "<li>" + productName;
                            if (DataAccessContext.Configurations.GetBoolValue("ShowQuantity"))
                            {
                                int displayStock = productStock - DataAccessContext.Configurations.GetIntValue("OutOfStockValue");
                                if (displayStock < 0)
                                {
                                    displayStock = 0;
                                }
                                message += " ( available " + displayStock + " items )";
                            }
                            else
                            {
                                message += "</li>";
                            }
                        }
                    }
                }
                else
                {
                    CartItemPromotion cartItemPromotion = (CartItemPromotion)cartItem;
                    PromotionSelected promotionSelected = cartItemPromotion.PromotionSelected;
                    foreach (PromotionSelectedItem item in promotionSelected.PromotionSelectedItems)
                    {
                        Product  product         = item.Product;
                        string[] optionsUseStock = item.GetUseStockOptionItems().ToArray(typeof(string)) as string[];
                        int      productStock    = product.GetStock(optionsUseStock);
                        int      currentStock    = productStock - quantity;
                        if (currentStock != DataAccessContext.Configurations.GetIntValue("OutOfStockValue"))
                        {
                            if (CatalogUtilities.IsOutOfStock(currentStock, CheckUseInventory(product.ProductID)))
                            {
                                message += "<li>" + productName;
                                message += "</li>";
                            }
                        }
                    }
                }
            }
        }

        if (!String.IsNullOrEmpty(message))
        {
            message =
                "<p class=\"ErrorHeader\">[$StockError]</p>" +
                "<ul class=\"ErrorBody\">" + message + "</ul>";

            return(false);
        }
        else
        {
            return(true);
        }
    }
示例#16
0
    private bool ReOrderToCart(Product product, OrderItem orderItem, string optionItemIDs, ProductKitItemValueCollection itemCollection)
    {
        string errorCurrentStock  = string.Empty;
        int    currentStock       = 0;
        bool   isAddToCartSuccess = false;

        OptionItemValueCollection optionCollection = new OptionItemValueCollection(StoreContext.Culture, optionItemIDs, product.ProductID);
        CartItemGiftDetails       giftDetails      = new CartItemGiftDetails();

        if (product.IsGiftCertificate)
        {
            GiftCertificateProduct giftProduct = (GiftCertificateProduct)product;

            IList <GiftCertificate> giftCertificateList = DataAccessContext.GiftCertificateRepository.GetAllByOrderID(orderItem.OrderID);

            foreach (GiftCertificate giftCertificate in giftCertificateList)
            {
                if (orderItem.OrderItemID == giftCertificate.OrderItemID)
                {
                    giftDetails = new CartItemGiftDetails(
                        giftCertificate.Recipient,
                        giftCertificate.PersonalNote,
                        giftCertificate.NeedPhysical,
                        giftCertificate.GiftValue);
                }
            }

            if (giftProduct.GiftAmount == 0)
            {
                giftProduct.GiftAmount = orderItem.UnitPrice;
            }

            product = (Product)giftProduct;

            CartAddItemService addToCartService = new CartAddItemService(
                StoreContext.Culture, StoreContext.ShoppingCart);
            isAddToCartSuccess = addToCartService.AddToCart(
                product,
                optionCollection,
                itemCollection,
                orderItem.Quantity,
                giftDetails,
                0,
                out errorCurrentStock,
                out currentStock);
        }
        else if (product.IsCustomPrice)
        {
            CartAddItemService addToCartService = new CartAddItemService(
                StoreContext.Culture, StoreContext.ShoppingCart);
            isAddToCartSuccess = addToCartService.AddToCart(
                product,
                optionCollection,
                itemCollection,
                GetProductQuantity(product, orderItem),
                giftDetails,
                orderItem.UnitPrice,
                out errorCurrentStock,
                out currentStock);
        }
        else
        {
            CartAddItemService addToCartService = new CartAddItemService(
                StoreContext.Culture, StoreContext.ShoppingCart);
            isAddToCartSuccess = addToCartService.AddToCart(
                product,
                optionCollection,
                itemCollection,
                GetProductQuantity(product, orderItem),
                giftDetails,
                0,
                out errorCurrentStock,
                out currentStock);
        }

        if (!isAddToCartSuccess)
        {
            StoreContext.ClearCheckoutSession();
            string message = "<p class=\"ErrorHeader\">[$StockError]</p>";

            ErrorMessage(message);
            return(false);
        }

        return(true);
    }
示例#17
0
 private void AddToWishList(string productID, OptionItemValueCollection selectedOptions)
 {
     AddToWishList(productID, selectedOptions, "1");
 }
 public void PopulateControls(OptionItemValueCollection selectedValue)
 {
     _selectedValue = selectedValue;
     uxOptionDataList.DataSource = GetOptionGroups();
     uxOptionDataList.DataBind();
 }
    public bool UpdateCartItem(bool isSubscriptionable, out string errMsg)
    {
        errMsg = String.Empty;
        if (!VerifyValidInput(out errMsg))
        {
            if (!String.IsNullOrEmpty(errMsg))
            {
                DisplayErrorMessage(errMsg);
                return(false);
            }
        }

        //string errMsg;
        if (!VerifyQuantity(out errMsg))
        {
            DisplayErrorMessage(errMsg);
            return(false);
        }
        if (!IsMatchQuantity())
        {
            return(false);
        }

        ICartItem item = StoreContext.ShoppingCart.FindCartItemByID(CartItemID);
        OptionItemValueCollection selectedOptions = uxProductOptionGroupDetails.GetSelectedOptions();
        CartItemGiftDetails       giftDetails     = CreateGiftDetails();

        Currency currency   = DataAccessContext.CurrencyRepository.GetOne(CurrencyCode);
        decimal  enterPrice = ConvertUtilities.ToDecimal(currency.FormatPriceWithOutSymbolInvert(ConvertUtilities.ToDecimal(uxEnterAmountText.Text)));

        if (enterPrice == item.Product.GetProductPrice(StoreID).Price)
        {
            enterPrice = 0;
        }

        decimal customPrice = 0;

        if (item.Product.IsCustomPrice)
        {
            customPrice = ConvertUtilities.ToDecimal(currency.FormatPriceWithOutSymbolInvert(ConvertUtilities.ToDecimal(uxEnterAmountText.Text)));
        }

        int    currentStock;
        string errorOptionName;

        StoreContext.ShoppingCart.DeleteItem(CartItemID);

        CartAddItemService addToCartService = new CartAddItemService(
            StoreContext.Culture, StoreContext.ShoppingCart);
        bool stockOK = addToCartService.AddToCartByAdmin(
            item.Product,
            selectedOptions,
            ConvertUtilities.ToInt32(uxQuantityText.Text),
            giftDetails,
            customPrice,
            enterPrice,
            StoreID,
            out errorOptionName,
            out currentStock,
            isSubscriptionable);

        if (stockOK)
        {
            return(true);
        }
        else
        {
            errMsg = DisplayOutOfStockError(currentStock, errorOptionName);

            return(false);
        }
    }
    private void BuildShoppingCart(string requestXml, NewOrderNotification notification)
    {
        foreach (Item item in notification.shoppingcart.items)
        {
            XmlNode[] node = item.merchantprivateitemdata.Any;

            Product product = DataAccessContext.ProductRepository.GetOne(
                StoreContext.Culture,
                item.merchantitemid,
                new StoreRetriever().GetCurrentStoreID()
                );

            if (node.Length <= 1)
            {
                StoreContext.ShoppingCart.AddItem(
                    product, item.quantity);
            }
            else
            {
                // Creating option item from google checkout is not details of option type is text.
                OptionItemValueCollection optionCollection = OptionItemValueCollection.Null;
                if (!String.IsNullOrEmpty(node[1].InnerText))
                {
                    optionCollection = new OptionItemValueCollection(
                        StoreContext.Culture, node[1].InnerText, item.merchantitemid);
                }

                StoreContext.ShoppingCart.AddItem(
                    product, item.quantity, optionCollection);
            }
        }

        Log.Debug("SetShippingDetails");
        Vevo.Base.Domain.Address address = new Vevo.Base.Domain.Address(
            notification.buyershippingaddress.contactname,
            "",
            notification.buyerbillingaddress.companyname,
            notification.buyershippingaddress.address1,
            notification.buyershippingaddress.address2,
            notification.buyershippingaddress.city,
            notification.buyershippingaddress.region,
            notification.buyershippingaddress.postalcode,
            notification.buyershippingaddress.countrycode,
            notification.buyerbillingaddress.phone,
            notification.buyerbillingaddress.fax);

        StoreContext.CheckoutDetails.ShippingAddress = new ShippingAddress(address, false);

        Log.Debug("Set Shipping ");
        MerchantCalculatedShippingAdjustment shippingAdjust = (MerchantCalculatedShippingAdjustment)notification.orderadjustment.shipping.Item;

        string         shippingID = DataAccessContext.ShippingOptionRepository.GetIDFromName(shippingAdjust.shippingname);
        ShippingMethod shipping   = ShippingFactory.CreateShipping(shippingID);

        shipping.Name = shippingAdjust.shippingname;
        StoreContext.CheckoutDetails.SetShipping(shipping);
        StoreContext.CheckoutDetails.SetCustomerComments("");

        PaymentOption paymentOption = DataAccessContext.PaymentOptionRepository.GetOne(
            StoreContext.Culture, PaymentOption.GoogleCheckout);

        StoreContext.CheckoutDetails.SetPaymentMethod(
            paymentOption.CreatePaymentMethod());

        Log.Debug("Set Coupon ID");
        StoreContext.CheckoutDetails.SetCouponID(GetCouponCode(notification.orderadjustment.merchantcodes.Items));

        Log.Debug("Set Gift");
        string giftID = GetGiftCertificateCode(notification.orderadjustment.merchantcodes.Items);

        if (giftID != String.Empty)
        {
            StoreContext.CheckoutDetails.SetGiftCertificate(giftID);
        }

        StoreContext.CheckoutDetails.SetGiftRegistryID("0");
        StoreContext.CheckoutDetails.SetShowShippingAddress(true);
    }