Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » No result for productService.GetProductByNumber

No result for productService.GetProductByNumber

Peter Leleulya
Peter Leleulya
Reply

Hi guys,

I have a 9.12.4 application which suddently didn't return a product anymore on the GetProductByNumber call.
We found out that when we open a product in the CMS and save it without changing anything some fields in the database go from NULL to 0 or empty string, such as ProductPurchaseMinimumQuantity.

The GetProductByNumber method works for unchanged products with NULL. But doesn't work anymore for newly saved products !


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Peter,

That sounds weird.

Which overload of GetProductByNumber method are you using and what are the parameter values?

Try to execute the following sql statement and see if the result contains a product with matching product number and a language id which matches your current context language:

SELECT ProductNumber, ProductId, ProductVariantId, ProductLanguageId FROM EcomProducts WHERE ProductNumber = 'YOUR NUMBER HERE'

If you want it to fallback so that it finds the product in default language then you need to disable/uncheck "Only show translated elements" in Settings > Ecommerce > Advanced configuration

 
Peter Leleulya
Peter Leleulya
Reply

@morten the product is there.

Some functionality stopped working after core update to 9.12.4.
We noticed that when we changed the database values back to NULL the product could be found again.
We use the product number as string and the ecom language as string 

var product = productService.GetProductByNumber(StringConstants.ProductNumbers.PayInvoices, ecomLanguageId);
 
Hans Kloppenborg
Reply

N.B. Something that may be important, the product has a negative stock, since we use it without ever setting stock.

 
Hans Kloppenborg
Reply

Okey Morten,

Things are even stranger, while trying to show it was fixed to our support it suddenly didn't work any more, it seems that after an appool reset we get the product the first time, but calls after that do not return the product any more. So we suspect that the null -> 0 change does not have infuence after all.

Greetings Hans

 
Peter Leleulya
Peter Leleulya
Reply

@morten Can you remove this thread? I can't ...

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

I guess you found a solution to your problem.

Sorry, I can't delete the thread either. Besides, it might be useful to someone else that runs into issues with GetProductByNumber.

 
Aki Ruuskanen
Aki Ruuskanen
Reply

@peter what was your solution? We experience the same thing.

/Aki

 
Hans Kloppenborg
Reply

Hei Aki,

We discovered that the language parameter we used in our call was cached incorrectly, leading to the first call working fine, but further calls where done with language "", and since there is no product without language we got the expected null result back.

Greets Hans

 
Aki Ruuskanen
Aki Ruuskanen
Reply

OK, Thanks for the input Hans. 

/Aki

 

 

You must be logged in to post in the forum