Developer forum

Forum » Development » Update UnitPrice for Orderline

Update UnitPrice for Orderline

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a situation where I need to update the Unitprice on the orderline with a custom value.

It is obvious that I need to use the API but I am a bit confused about all the "Obsolete" messages.

I have tried using Dynamicweb.Ecommerce.Order and Dynamicweb.Ecommerce.Orderline but they are marked as obsolete and there is an indication to use Ecommerce.Services.Orders instead but the documentation here: https://doc.dynamicweb.com/api/html/33d1e8f0-8a99-1118-98b8-b214644650ef.htm does not show any indication of on Orders property.

I have found instead OrderService and OrderlineService.

Considering the future proofing of this development, what would be the best approach to solve my problem? What API should I use?

Thank you,

Adrian


Replies

 
Vladimir Shushunov Dynamicweb Employee
Vladimir Shushunov
Reply

Hi Adrian,

These services still have "internal" access  (probably because of active refactoring)

I would like to suggest to create instances of these services in your code:

var orderService = new OrderService();
var orderLineService = new OrderLineService();

Best regards,

Vladimir

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Vladimir,

That's exactly what I did.

Thank you very much.

Adrian

 
Martin Vang
Martin Vang
Reply

Please note, that when a service is "hidden" like this, it probably means, that we will do some changes to it.

The orderservice has been fixed alot in the previous hotfixes of 9.4 and is almost ready to "go public" - it should have been ready for 9.4.0, but contained too many coding-errors to pass the code-review. The "fix" was to hide the public property containing the orderservice from Ecommerce.Services.

There is no real good solution for when we have to half-way pull back something that contains serious bugs - and I firmly believe that we did the correct thing in not releasing it as it was back then.

 

Hope you will have a better experience with the orderservice during 9.5 lifecycle. :)

 

BR

Martin

 
Cheng Fong
Reply

Hi Martin,

I found this thread and are facing the same problems with all the "Obsolete" messages when trying to update an old project! Im currently using 9.5.4 and the Ecommerce.Services.Orders are still internal propertys! I guess this means that its still not ready for public use, but in that case is it recommended to create new instances of new OrderService() or should we just keep using the obsolete methods until the services are public?

Best regards

Cheng

 

You must be logged in to post in the forum