Hello, I'm trying to script an order creation (trying to migrate from TC1.4.4.4 to TC2.x), but when I try to get a product from the database, the object returned is null (well, a new empty orderline, not exactly null):
Guid g = new Guid("EABA0C27-6636-44E7-84D2-77B94DABAA29");
long l = 1;
Order order = TC.GetOrder(l, g);
var ps = new ProductSnapshot(1, "1249");
var ol = new OrderLine(ps);
order.OrderLines.Add(ol)
order.Save();
Both the ProductSnapshot and the OrderLine has no value, other than the values I provide:
The web application is using the Umbraco dlls, with the umbracoDbDSN configured in the web.config.
It is just a web forms application with the dlls attached. I can retrieve(or create) any order without problems, however, when trying to add a line to an order, stuff happens.
I'm pretty sure it is a configuration issue, but I can't wrap my head around it. When trying to use the "order.OrderLines.AddOrUpdate, I get a strange error:
When you add an order line with the product identifier 1249 this means the Umbraco node with the id 1249. So this node or an ancestor does need a store associated with it using the store picker in the Umbraco admin.
Adding an orderline from c#
Hello, I'm trying to script an order creation (trying to migrate from TC1.4.4.4 to TC2.x), but when I try to get a product from the database, the object returned is null (well, a new empty orderline, not exactly null):
Both the ProductSnapshot and the OrderLine has no value, other than the values I provide:
How do I add an orderline? :)
Best regards,
Ole Abrahamsen
Are you trying to create a new order? In that case just try to create a new order object and save it:
/Rune
I already did create a new order - I'm actually retrieving that order and trying to add an orderline.
Hi Ole
What context are you in? A web request? A console application or?
Kind regards
Anders
Hello Anders
The application is a web forms application, so the context is a web request. :)
Best regards,
Ole Abrahamsen
And the web application is a dll that is then copied and run in the context of the Umbraco site? Could you try and describe your case a little more?
And by the way - why not just use the order.OrderLines.AddOrUpdate( string productIdentifier)? The productIdentifier is just your umbraco node id.
Kind regards
Anders
Sorry - I'm new to this.
The web application is using the Umbraco dlls, with the umbracoDbDSN configured in the web.config.
It is just a web forms application with the dlls attached. I can retrieve(or create) any order without problems, however, when trying to add a line to an order, stuff happens.
I'm pretty sure it is a configuration issue, but I can't wrap my head around it. When trying to use the "order.OrderLines.AddOrUpdate, I get a strange error:
When you add an order line with the product identifier 1249 this means the Umbraco node with the id 1249. So this node or an ancestor does need a store associated with it using the store picker in the Umbraco admin.
Kind regards
Anders
is working on a reply...