Developer forum

Forum » Development » Orderline fields in Sales Discount

Orderline fields in Sales Discount

Nuno Aguiar
Reply

Hi,

 

In Dynamicweb it is not possible (unfortnately) for the client to choose 1 out of X products for the offer. Due to a syncing integration, we cannot simply have a generic product, however by adding a reference we can do it.

 

We noticed that updating an orderline field is simple but it has to exist when we add the product to the cart (otherwise we need to force it everytime the cart loads), but if it is a discount orderline, it is deleted every single time.

 

I understand how Discounts work, and why the discounts are deleted every time the cart loads, however I want to know if there is any way to prevent this:

  1. This is only a problem when the user goes to a payment provider and closes the window - why are discounts processed after submitting to a payment provider
  2. Why delete all discounts orderlines before processing them. Most of the times it is the same discount, so Dynamicweb ends up deleting and inserting the same DB record

 

If both situations were to be analyzed we could save up on processing ( situation 1. ) and on DB interaction ( situation 2. )

 

Here's what we are doing on every cart template (Razor)

var orderLine = Dynamicweb.eCommerce.Orders.OrderLine.GetOrderLineByID(obj_options.str_orderLineId);

orderLine.OrderLineFieldValues.Add(new Dynamicweb.eCommerce.Orders.OrderLineFieldValue(obj_options.str_fieldName,obj_options.str_fieldValue));
orderLine.Save();

 

This being said, since the user is not coming back to the last template, how could we enforce the orderline field to ensure the values we need?

 

Best Regards,

Nuno Aguiar


Replies

 

You must be logged in to post in the forum