Developer forum

Forum » Ecommerce - Standard features » Error with Discount when Editing Ecom Group

Error with Discount when Editing Ecom Group

Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi,

 

I am getting a server error editing ecom groups associated with Discounts. This started happening after a recent upgrade to 9.7 (currently in 9.7.5)

I tried looking at the source code of the EcomGroupEdit.aspx file but there are 2 GetType methods on the same line and I can't tell which one is causing it, nor why it is being caused. Is this a known issue?

 

https://www.screencast.com/t/sNQX6k7DbLd

Server Error in '/' Application.


Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:
 

[NullReferenceException: Object reference not set to an instance of an object.]
   System.Object.GetType() +0
   Dynamicweb.Admin.eComBackend.EcomGroupEdit.LoadDiscounts(Group grp) +221
   Dynamicweb.Admin.eComBackend.EcomGroupEdit.Page_Load(Object sender, EventArgs e) +2444
   System.Web.UI.Control.OnLoad(EventArgs e) +106
   System.Web.UI.Control.LoadRecursive() +68
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3785

 

Best Regards,

Nuno Aguiar


Replies

 
Viktor Letavin Dynamicweb Employee
Viktor Letavin
Reply

Hi Nuno,

could you please execute SQL "SELECT SalesDiscountDiscountType, * FROM EcomSalesDiscount" and see if there are any discounts with "SalesDiscountDiscountType" = null?
If yes - you have corrupted data or you have some custom discount provider which has created discount by code, and not set SalesDiscount.DiscountType property which should be set on creating to [discountProvider].GetType().


P.S. If you have null in db and no custom sales discount providers, you should fix the EcomSalesDiscount table rows containing null in SalesDiscountDiscountType by removing it or filling with the correct type e.g. "Dynamicweb.Ecommerce.Orders.SalesDiscounts.ProductDiscount"

BR, Viktor.

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Viktor,

 

I do have a custom discount provider, but the value is not null, it's actually the name of the namespace Lorenz.Custom.ManualDiscountProvider

https://www.screencast.com/t/D3kx9CycD9DV

 

That said, must I convert it to something else?

 

Best Regards,

Nuno Aguiar

 
Nicolai Pedersen
Reply

Delete the rows one by one, and find the one that is fucked up...

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

I fixed the sucker in a different way.

I edited the discount and hit "save and close". In Dev the "Discount (old)" module was active so I could easilly do that. I'll work in getting this in the QA environment.

 

Thanks to both of you for your help.

 

Nuno

 

You must be logged in to post in the forum