We Are A Web Services Hub

Experienced and professional partners to have on your side. We provide businesses the tools and knowledge needed to help with your website, video, social media and other marketing goals. By partnering with specialized professionals in focused areas, we're able to get the job completed on budget, and on time.

Our Services Contact Us

Our Services

Consulting

We provide web, video, photography & marketing consultation servies based on collective experiences in various niches.

Quality

It is an everyday standard that our work speaks volumes to efficiency and quality through the wide-range of services available to our clients.

Development

Our full-stack web development experience covers everything from impactful front-end design to best-in-class back-end functionality.

Partnership

Strong and long-lasting partnerships with local agencies, makes available services such as 4K videography, graphic design, photography, and ad-hoc services consultation.

Recent Work

Tuesday, June 13, 2017

Access a Kentico Page Type property value from anywhere within the Node Tree

The Kentico CMS system, in particular version 9+, can be very powerful and easy to display information from within a transformation, as long as you have the correct Macro syntax.  I still have my moments where I can't seem to get a statement to work, and rely on the Kentico DevNet Q&A website for some assistance.  

Let's consider a transformation within a product page, where we want to show related products.  In our case, we're using the built in eCommerce SKU Module and a "Product" page type with some additional custom fields, such as "ModelName", etc.

The goal of the Related Product repeater transformation is to show the SKU Number, the custom Model Name (title of product model), a SKU Description, and the SKU's Image.  

I'll break out what each piece of the working transformation does, based on the help from Anton (Certified Dev) at DevNet. To get the custom "Model Name" value of the SKU in the repeater, there's a slightly different method. Let me illustrate below:


The product page already has local data that can be accessed in shorthand in the following Macro format:

  {% SKUName %}

However, what tripped me up a few times is the Macro statement to get the value of a different product's property:

    {% Documents["/Products/All/"+SKUNumber].GetValue("ModelName") #%}

Essentially, you have to provide the node alias path of the SKU, then get the value using "GetValue()".  (Note: It's important to use double quotes and be careful of using && logic operators when it should be a concatenate operator)

Now, let me point out why we had to use the different Macro statement to get the "ModelName".  The Related Products repeater is a customer web part, where we're getting info from a SQL database, and then doing some custom handling, before it's displayed.   This custom web part has a Query, that we missed adding "ModelName" to, which is why if we were to access it directly like {% ModelName %}, it would resolve to the current document's property value, and not the queried value:


 var relatedDocuments = DocumentHelper.GetDocuments()
                .WhereIn("SKUNumber", relatedSKUs)
                .Columns("SKUNumber,SKUName,SKUImagePath,SKUDescription,ModelName");

There you have it.  Hopefully this helps you in some way.  

Happy coding.

55 Cups
Average weekly coffee drank
0% Bull
No unneccessary bull pucky.
110% Happy
Above and beyond for happy customers

Contact

Talk to us

Let us build on the web with beautiful, purposeful, and innovative websites. There are millions upon millions of web pages that live on the internet, of which most do not get any visitors because they are not visually stunning, intriguing or most importantly, useful. Delacom Inventive takes your needs, ideas and dreams and brings them to life!

Address:

Pacific Northwest, Canby, OR 97013 USA