Developer forum

Forum » Ecommerce - Standard features » Stop recurring order if product is inactive

Stop recurring order if product is inactive

Bjørn Ingebrigtsen
Reply

Is there a way to stop a recurring order from being created and sent to ERP when a product has been set as inactive after the recurring order was created?

I have tried creating a custom task that would skip the order if a product is inactive (code is based on RecurringOrdersScheduledTaskAddIn), but it fails on save of order. Seems that the context is lost when dynamicweb tries to save the new order, since it is not able to get the IP

this._ip = Converter.ToString(Context.get_Current().get_Request().get_UserHostAddress());

Exception:

System.ArgumentException: Value does not fall within the expected range. at
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at
System.Web.Hosting.IIS7WorkerRequest.GetServerVariableInternal(String name) at
System.Web.HttpRequestWrapper.get_UserHostAddress() at
Dynamicweb.Ecommerce.Orders.Order.get_Ip() at
Dynamicweb.Ecommerce.Orders.OrderRepository.Save(Order order) at
Dynamicweb.Ecommerce.Orders.OrderService.Save(Order order, Boolean saveOldVersion) at
Dynamicweb.Ecommerce.Orders.RecurringOrder.MakeRecurringCopy(Order order) at
Dynamicweb.Ecommerce.Orders.RecurringOrder.GetRecurringCopy(Order order) at
Dynamicweb.Ecommerce.Orders.Gateways.OrderManager.CreateRecurringOrder(Order order)


Replies

 
Rasmus Sanggaard Dynamicweb Employee
Rasmus Sanggaard
Reply

Hi,

 

I have created a bug for it #19363.

 

BR Rasmus Sanggaard

 

You must be logged in to post in the forum