November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
You can follow the examples here. In short we don't work with the concrete Shipment and LineItem class, but use cart.CreateLineItem and cart.CreateShipment extension methods to create the instances of ILineItem and IShipment we need.
Hi,
Thanks for reply.
I tried to create line item and shipment using cart.CreateLineItem and cart.CreateShipment.But still same issue occured.
The most common reason for an lineitem to be removed during a validation is that it does not have a valid price, or it does not have a valid inventory. Make sure your "1477707" lineitem has both those information.
Hi,
Thanks for the reply.Order Total is not null.I found that Shipping method's base price is reflected in order total.I just get shipping methods using ShippingMethodDto and assign Base price value and save the changes.But it does not reflect in Commerce Manager.My code is like
//Get the list of all shipping methods to be filtered ShippingMethodDto methods = ShippingManager.GetShippingMethods(SiteContext.Current.LanguageName); //Assigning Base price value for(int i = 0; i < 4; i++) { methods.ShippingMethod[i].BasePrice = 500; methods.AcceptChanges(); } methods = ShippingManager.GetShippingMethods(SiteContext.Current.LanguageName); //-->its returns old Base price value
Help me to override the base price value.
Thanks in advance.
For future ref!
Updates or add a shippingmethod (COM 13):
var method = ShippingManager.GetShippingMethod(model.ShippingMethodId);
if (method?.ShippingMethod?.Count > 0)//update
{
method.ShippingMethod[0].DisplayName = model.DisplayName;
method.ShippingMethod[0].Currency = model.Currency;
method.ShippingMethod[0].IsActive = model.IsActive;
method.ShippingMethod[0].IsDefault = model.IsDefault;
method.ShippingMethod[0].Name = model.Name;
method.ShippingMethod[0].Description = model.Description;
method.ShippingMethod[0].Ordering = model.Ordering;
method.ShippingMethod[0].LanguageId = model.LanguageId;
method.ShippingMethod[0].BasePrice = model.BasePrice;
ShippingManager.SaveShipping(method);
}
else
{
//add
var methods = ShippingManager.GetShippingMethods("");
var row = methods.ShippingMethod.NewShippingMethodRow();
row.ShippingMethodId = model.ShippingMethodId;
row.ShippingOptionId = model.ShippingOptionId;
row.Created = row.Modified = DateTime.UtcNow;
row.DisplayName = model.DisplayName;
row.Currency = model.Currency;
row.IsActive = model.IsActive;
row.IsDefault = model.IsDefault;
row.Name = model.Name;
row.Description = model.Description;
row.Ordering = model.Ordering;
row.LanguageId = model.LanguageId;
row.BasePrice = model.BasePrice;
methods.ShippingMethod.Rows.Add(row);
ShippingManager.SaveShipping(methods);
}
Hi ,
I created an order by using IPurchaseorder API and created the LineItem using LineItem API. I added the LineItem to the order using PurchaseOrder.AddLineItem(LineItem).
On the CMS it displays the order total , order status. After editing Shipping method order total automatically change to $0.0 and Line Item disappered.
And another issue was after saving my purchase order if I load that order it returns null.
I need to check if it happens is correct or not and also I need some blogs to refer.
Thanks in advance.
//Load
purchaseOrder = orderRepository.Load(contactId);//It returns null