Developer forum

Forum » Ecommerce - Standard features » GetProductLink breaks if Product no longer exists

GetProductLink breaks if Product no longer exists

Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi,

 

Although this is reproduced in Swift, we believe the GetProductLink extension method needs to check for a null product and/or PrimaryOrDefaultGroup.

 

Repro steps

 

The offending line in OrderDetails is this

string link = orderline?.GetProduct()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false) ?? "";

 

Apparently GetProduct() orderline method extension does return a ProductViewModel (https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_git/Dynamicweb?path=/src/77%20-%20Ecommerce/Dynamicweb.Ecommerce/Frontend/OrderLineViewModelExtensions.cs&_a=contents&version=GBmain), because the orderline does have a ProductId (and eventually a VariantId), but then the GetProductLink() method extension does not check whether the product exists, resulting in the error (line 65 - https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_git/Dynamicweb?path=/src/77%20-%20Ecommerce/Dynamicweb.Ecommerce/ProductCatalog/ProductViewModelExtensions.cs&_a=contents&version=GBmain)

 

This also happens in our batch import of orders, when a product does not exist in the EcomProducts table.

 

Best Regards,

Nuno Aguiar


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

bump

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Devops#13717 awaiting QA and release.

Votes for this answer: 1
 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Perfect, thanks Nicolai

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Nuno

Devops#13717 now released in hotfix version 9.15.8 

Get this from the download section https://doc.dynamicweb.dk/downloads/dynamicweb-9

Sorry for any inconvenience this may have caused

Kind Regards
Care Support
Kristian Kirkholt

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Thanks Kristian

 

You must be logged in to post in the forum