xGenerator Introduction and Installing

Recently I was given the task of installing xGenerator for a #Sitecore site. I haven’t used this tool before so I started doing some research on it. It is a great testing for creating realistic traffic for your Sitecore site. I found that you can download the code in GitHub. I didn’t find an installation package, but the code contains a package definition that you can use to create a package with Sitecore Rocks.

I got the code from here:

https://github.com/Sitecore/xGenerator

I followed the instructions here https://github.com/Sitecore/xGenerator/blob/master/src/Build%20instructions.txt. After following the steps and publishing I noticed I was getting a lot of version errors on my local Sitecore test site. The mistake I made was that my site was version 8.1, but the code was for version 8.2. So I had to go back and get a version pre 8.2. I went to the releases page. https://github.com/Sitecore/xGenerator/releases. I ended up downloading the nightly commit. For some reason the download that came after that was still 8.2. Maybe I overlooked something. In any case the nightly commit worked.

So after redoing the steps in the build instructions I was able to publish to my Sitecore site and get it to work. Building the package was easy.

I already have Sitecore Rocks installed so I double clicked on the package.

Sitecore Rocks brings up a connection window. You just need to connect to the instance of where you installed the xGenerator updates with Unicorn.

Now you can easily generate and download a package.

Just for my own piece of mind I created a new 8.1 site and installed the package. Just to make sure it worked. It did and I was off and running. I want to play around with this tool more and get familiar with it. Stay tuned for another blog on xGenerator in the future.

Field Ordering When Inheriting Sitecore Templates

I have come across this many times before. I will have a base #Sitecore template that is inherited by another template. The fields from both templates are combined in one section. The content editor though wants the order of the fields changed. That is easy to do if the fields are from the same template, but it is not so easy to do it when the fields are from two different #Sitecore templates. I will show you an easy workaround though to get the correct order.

In my example I have a ProductBase template that has a Description field. The Product template inherits from this template so it will have the Description field.

This is what the current product item looks like. As you can see it is currently in the default alphabetical order. What if though the content editor wants the Description under the Name?

In order to have the fields reordered you will need to go to your main template. Select the field you want to reorder and navigate to the Appearance section and then the Sortorder field. Sitecore usually numbers their fields starting at 100, 200, 300 and so on. So in this case we want Name on the top. Giving it a -100 value in the Sortorder field will make it automatically be the top field since it will then be displayed before 100.

As you can see the order has now changed and the content editor will be able to edit in their preferred order.

This was a simple example. For more multiple field reorders changing the Sortorder fields with different values will take a little more of playing with the value, but the concept will be the same. I suggest never changing the Sortorder on a base template. The reason being is that for other templates they may want a different order and it would be the same for all templates that inherit the base template and/or will make it difficult to reorder your main template. Let me know if you have any questions.