Generation of a Composite Model Using Reflection and Sitecore Serialization

In my previous post, Iโ€™ve described the benefits of composition pattern over inheritance in code generation and mentioned that it simplifies restoration of models from reflection. From my point, this is a huge plus as it enables the creation of developer-friendly modular architecture in Sitecore. I do not think that someone still has problems with a creation of an update package with Sitecore config transforms, but it is not possible to install an update package in your Visual Studio solution....

August 4, 2016 ยท 6 min ยท Alex Smagin

Composite Reuse Principle in Sitecore Code Generation

If you do Sitecore projects and have never tried to create strongly typed models, then most likely you are doing something wrong. :) Why? As soon as your project grows a bit, the logic becomes more complex or you decide to refactor a few components, you will suffer from all magic things - strings, numbers, GUIDs. Of cause, there are a few things that you can do about that. Available Options You could create a file with constants for templates and field IDs, which would help you keeping references in one place and make them more manageable....

August 2, 2016 ยท 6 min ยท Alex Smagin

Mapping Sitecore StoreFront to Habitat

As Iโ€™ve mentioned in a previous post, my team and I are working on Sitecore Commerce StoreFront migration to Sitecore Habitat. Before we moved to code itself, we dug into codebases of both projects to review their โ€œas-isโ€ implementation and we decided to come up with a plan on how to go to map functionality to Habitat so that it would comply with the principles it suggests. And here is what we found out and came up with....

July 26, 2016 ยท 5 min ยท Alex Smagin

Debug TDS code generation templates

I was playing with Sitecore solution, project setup, and configuration, I faced a need to alter the code generation logic used in it. We use TDS for content synchronization as well as its code generation engine build on T4 text templates. While T4 is great for code generation, it is not as straightforward to debug them as it might be expected. So let me describe how to do this. How-To I have a solution with a set of projects....

July 21, 2016 ยท 2 min ยท Alex Smagin

Inception: Sitecore Storefront to Habitat Migrating

Sitecore is quite a hot topic in our company. We have a lot of impressive initiatives going on: platform education programs, and optimization of project implementation approaches, formalization of development best practices, various accelerators from project starter kits to integrate external systems covering different aspects of digital marketing and commerce, just investigation of new technologies and their potential applications to Sitecore. Being an R&D solution architect in Digital Engagement practice, Iโ€™m fortunate to be in the middle of those activities....

July 19, 2016 ยท 3 min ยท Alex Smagin

Using AngularJS directives in Sitecore edit mode

It is quite a standard approach that you can see in many CMS project now - designs, UX, and HTML is done upfront or way in advance in comparison with CMS development. You might think now about Agile and say that all done almost simultaneously within one iteration, but even in this case, you would need to have HTML done before it would be converted into your Sitecore rendering. In addition to that, there is a huge shift towards front-end technologies which affect Sitecore projects as well....

July 5, 2016 ยท 6 min ยท Alex Smagin

Manipulating config files with PowerShell

It is a quite common situation when you need to prepare multiple Sitecore servers with different roles. If you take a look Sitecore documentation you will find a huge amount of tables with configuration files that need to be enabled/disabled. Going manually through all of them isnโ€™t the most fun task you could do, so I prefer to do this only once. Donโ€™t repeat yourself :) Also, this would be needed for an environment automation work Iโ€™m involved in, but this would be a separate set of posts....

June 21, 2016 ยท 3 min ยท Alex Smagin

Why FXM should wait for your page to load

Working with FXM, I faced a very interesting sporadic issue: every 10-15 times some of the components were not loading on a page. A response object was identical all the time, with no errors in the console, no changes in a site code since the last deployments. I think you get the situation. However, this issue was able to cause a lot of trouble for a client as FXM was used on many legacy sites....

June 17, 2016 ยท 3 min ยท Alex Smagin

$(document).ready() for Sitecore FXM

Federated Experience Manager (FXM) is a marketing tool from Sitecore, that allows you to use components defined in your WCM on other site and application. This is very useful if you need to update multiple legacy applications or try some part of a new design on an existing site. Like most of the other similar tools, Sitecore provides you with a JavaScript beacon that has to be included in a target site....

June 15, 2016 ยท 3 min ยท Alex Smagin

Restore SSH password for VM with #sitecore #xdb in Azure

It is not always possible to find enough time to play with your free-time projects and sometimes it might take more than a week after you created an environment and you started using it. And during this week you could forget something, e.g. password for your SSH connection :) This is exactly what happened to me this weekend when I returned to my Sitecore development VMs with xDB and SOLR in Azure....

August 10, 2015 ยท 2 min ยท Alex Smagin

Sitecore Patterns Matching with SOLR

My nodeJS project is finally completed, so I could turn back to Sitecore and look for some interesting questions and solutions for them. Fortunately, I recently got one request. We have an e-commerce solution integrated with Sitecore, we also have DMS in place, and it is gathering statistics about users and their behavior on the site. We could add personalization to the site, trying to engage more clients, but it would be quite static, as a limited set of prepared content blocks would be shown based on defined rules....

July 27, 2015 ยท 6 min ยท Alex Smagin

Cache indirect output of Sitecore controls

In my previous post Iโ€™ve described a solution that allows you to inject scripts and styles in specific placeholders in a layout. Scripts are registered in views, but they will be rendered by global filters only when all output of a page is ready. However, when it comes to caching Sitecore will be able to record HTML generated by your component just after it is rendered. So none of the actions that will be required in other parts of the site will be triggered with cache enabled....

May 28, 2015 ยท 4 min ยท Alex Smagin

Require JS and CSS for a Sitecore components

According to HTML best practices and guidelines, we need to put styles in the head (so that they would be applied to HTML immediately after rendering) and scripts at the end of body (so that they will not block your browser from downloading other content). On the other hand for Sitecore, you need to create a component, which could require some styles on specific scripts, and put them in a placeholder in the middle of the page....

May 19, 2015 ยท 4 min ยท Alex Smagin

Render wrapper around components in Experience Editor (aka Page Editor)

When you working in Experience Editor (previously Page Editor) it is quite difficult to understand the hierarchy of controls and their relation to each other, moreover, it is not always clear where your control ends and placeholder starts. Why not add some wrappers around controls? Letโ€™s see how we can do this. Approach We need to create a pipeline processor that will inject some markup around the component if the page is in editing mode....

May 18, 2015 ยท 3 min ยท Alex Smagin

Sitecore Continuous Integration

Usually, during the standard process of development, you would have several environments like DEV, QA, UAT/STAGING, and so on. The more environments you have - the more cases and differences in deployment you will need to implement. In this post, I would try to describe how you could simplify your life implementing CI for Sitecore based projects. Solution Almost immediately you would face a question of content synchronizations. There are a lot of options that you could use:...

September 25, 2014 ยท 3 min ยท Alex Smagin