How to get the culture version "DocumentSKUName", "DocumentSKUDescription" from the SKUTreeNode in t

Dominic Boyer asked on May 29, 2020 19:56

Hi in Kentico 12, i can retrieve the SKUID = cartItemInfo.SKUID, but how can i get the culture version from the cms_document or SKUTreeNode of that SKU in the shopping cart? cause now in french and english, my product is showing only in 1 culture :( Thank you

Correct Answer

Brenden Kehren answered on May 30, 2020 14:29

First you need to understand the underlying structure before you can search for content. The tree node holds the pages position in the content tree. It has no idea what culture the page is because that is stored with the document information.

The document record holds the culture info as well as foreign key references to the tree node, page type info, sku info objects. With this last statement you'll see you can't get a single documents culture if you only have the tree node or nodeid. Your query needs to include the document culture as well.

Take a look at the API Examples on how to retrieve a product page. Instead of using the CombineWithDefaultCulture() you can specify the culture to retrieve. While the Node has a SKUID associated with it, you need the culture as well which is stored with the Document.

0 votesVote for this answer Unmark Correct answer

Recent Answers

Dominic Boyer answered on June 1, 2020 15:20

Thank you Brenden, i found a solution. I was able to get the SKUID from the shopping cart end then:

SkuName = DocumentHelper.GetDocuments() .PublishedVersion() .Published() .OnSite(siteName) .Culture(currentCulture) .WhereEquals("NodeSKUID", SKUID) .FirstOrDefault() .DocumentName;

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.