Developer forum

Forum » CMS - Standard features » ProductListViewModel not returned expected values

ProductListViewModel not returned expected values

Roald Haahr Jensen
Reply

Hi,

I am currently setting a product list up on a new project running version 9.7.1, where I am inheriting from a ViewModelTemplate<ProductListViewModel>.

However, when calling some of the properties and methods accessible on the model, some unexpected values are returned, since Model.PageSize. Model.CurrentPage, Model.TotalProductsCount and Model.GetPageCount() return 0. Am I missing something?

Best regards,
Roald, Novicell 


Replies

 
Nicolai Pedersen
Reply

Hi Roald

It is a known bug - fixed in 9.7.2 released yesterday!

Sorry about the inconvenience.

BR Nicolai

 
Roald Haahr Jensen
Reply

Hi Nicolai,

The project is now upgraded to 9.7.2, but the problem persists.

I have rebuilt the index, recycled the application pool, deleted _parsed and emptied browser cache, but that did not solve it. They still return 0.

Best regards,
Roald

 
Nicolai Pedersen
Reply

Hi Roald

It is TFS#69892 - and you are right - the bug fix has not been merged to 9.7 branch - it is currently only on the 9.8 branch.

I'll ask QA to get it merged and released.

Sorry about the inconvenience!

BR Nicolai

 
Morten Buhl Dynamicweb Employee
Morten Buhl
Reply
This post has been marked as an answer

Fix merged and released in https://www.nuget.org/packages/Dynamicweb.Ecommerce/1.7.16

/Morten Buhl, DW

Votes for this answer: 1
 
Roald Haahr Jensen
Reply

Hi Nicolai and Morten,

Thank you for your help. I can confirm that it works when we updated the Ecommerce DLL.

However, now we are facing a new challenge, as we want to be able to show variants on a product. The variant related properties available on the view model are:

  • Variants (list is empty, although the tested product has variants)
  • VariantCombinations (list is not empty)
  • VariantId

In our case we need to be able to sort the variants on variant groups, so it would be nice to have a VariantGroups list available on the view model as well. For now, we are using the workaround shown below.

private static readonly ProductService productService = new ProductService();

public static IEnumerable<VariantGroup> GetVariantGroups(this ProductViewModel productVm)
{
    var product = productService.GetProductById(productVm.Id, productVm.VariantId, true);
    return product.VariantGroups;
}

Best regards,
Roald

 

You must be logged in to post in the forum