Developer forum

Forum » Ecommerce - Standard features » Subgroups are not of the same language as their parent group

Subgroups are not of the same language as their parent group

Peter Leleulya
Peter Leleulya
Reply

When I get my top level groups using:

var shop = !string.IsNullOrEmpty(shopId) ? Services.Shops.GetShop(shopId) : Services.Shops.GetDefaultShop();
var topLevelGroups = shop.get_TopLevelGroups(ecomLanguage);

Where my ecomLanguage value = "LANG2"

And I would like the subgroups of one of there top groups using:

var parentGroup = topLevelGroups.FirstOrDefault(tg => tg.Id.Equals(parentId));
var validGroups = parentGroup?.Subgroups?.Where(sg => validGroupIds.Contains(sg.Id));

The parentGroup.Subgroups are of "LANG1" ....

And there seems to be no way to get the LANG2 versions at this point ...

The subgroups are in the context language, which doesn't necessarily makes sense ....
 


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Peter,

I agree that it should be possible to get subgroups in the same language as the parent, and I've created a task to find a solution: #83984.

In the meantime, you have a couple of workaround available to you:

  1. Change the Context.Language to the language of the group, which will cause Group.Subgroups to use the correct language.
  2. Manually iterating through the group relations by doing something like this:
    var relations = Dynamicweb.Ecommerce.Products.GroupRelation.GroupRelationsByParentId(id);
    foreach (var relation in relations)
    {
        yield return Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(relation.Id, languageId);
    }
    

- Jeppe

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Peter

The feature #83984 was released in Dynamicweb version 9.9.1

You are able to find this in the download section:

https://doc.dynamicweb.com/downloads/releases

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 

You must be logged in to post in the forum