Issue with create order detail in 7.0

Posted by Community Admin on 05-Aug-2018 12:35

Issue with create order detail in 7.0

All Replies

Posted by Community Admin on 08-Aug-2014 00:00

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();
       

Posted by Community Admin on 12-Aug-2014 00:00

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
 

Posted by Community Admin on 13-Aug-2014 00:00

Thanks a lot. It helps a lot. 

Regards

Praneeth

Posted by Community Admin on 14-Aug-2014 00:00

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
 

This thread is closed