+1-888-365-2779
Try Now
More in this section

Forums / Ecommerce / Issue with create order detail in 7.0

Issue with create order detail in 7.0

4 posts, 0 answered
  1. Praneeth
    Praneeth avatar
    26 posts
    Registered:
    22 Jun 2012
    08 Aug 2014
    Link to this post

    Hi,

    I am successfully able to create an order and I am also creating an order detail for the order. In the admin I can see is only the Order and not the order details (screenshot attached). When I run the sql query to fetch the details i am able to see in the database that order details is created.

    The code I am using is below. Please let me know what I am missing that is creating this issue.


     private static void CreateOrderDetail(Order order, Guid productId, string title, string sku, double weight, decimal total, decimal price,
                     int quantity, int taxClassId, decimal taxRate, bool taxInPrice, decimal deltaPrice, decimal basePrice, bool isShippable, bool isOnSale)
            {
                OrdersManager ordersManager = OrdersManager.GetManager();

                if (order == null)
                {
                    return;        // Order does not exist.
                }

                //Create a new OrderDetail
                OrderDetail detail = ordersManager.CreateOrderDetail();

                //Set properties.
                detail.BasePrice = basePrice;
                detail.CreatedDate = DateTime.Now;
                detail.DeltaPrice = deltaPrice;
                detail.IsOnSale = isOnSale;
                detail.IsShippable = isShippable;
                detail.Price = price;
                detail.ProductId = productId;
                detail.Quantity = quantity;
                detail.Sku = sku;
                // detail.TaxClassId = taxClassId;
                detail.TaxInPrice = taxInPrice;
                detail.TaxRate = taxRate;
                detail.Title = title;
                detail.Total = total;
                detail.Weight = weight;

                //Associate detail with order.
                detail.Parent = order;
                order.Details.Add(detail);

                ordersManager.SaveChanges();
            }

  2. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    08 Dec 2016
    12 Aug 2014
    Link to this post
    Hi Praneeth,

    I have attached a code sample for full checkout through code, where all order details are set, in addition to the other options and settings for the checkout. I think it will be useful for you to review the whole process and the CartDetail information configuration for the Order. Please, check the product and customer to match the ones you need. You can also check this documentation article.

    Regards,
    Nikola Zagorchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Praneeth
    Praneeth avatar
    26 posts
    Registered:
    22 Jun 2012
    13 Aug 2014 in reply to Nikola Zagorchev
    Link to this post

    Thanks a lot. It helps a lot. 

    Regards

    Praneeth

  4. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    08 Dec 2016
    14 Aug 2014
    Link to this post
    Hi Praneeth,

    I am glad the provided code has helped you. Write back if you need further assistance.

    Regards,
    Nikola Zagorchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
4 posts, 0 answered