Wednesday, 4 October 2017

Sitecore PowerShell script to remove workflow from content items

Recently we had a situation in one of the projects where the client wanted to remove the workflow from all the items under Home, but wanted to keep them on standard values for some templates. Below is the Sitecore PowerShell script that was used to do so:

The above script can also be used to move items from one workflow state to other by changing workflow state value.
  • The above script goes through every item under “/sitecore/content/Home”
  • Disable the security for editing the items (required to make sure we don’t get permission errors like: The current user does not have write access to this Item. User: Sitecore\virtualssuser
  • Begin the item edit.
  • Update the workflow fields value.
  • End item editing.
  • Tuesday, 12 September 2017

    Sitecore SXA Solr Search not working issue - RESOLUTION



    In my previous post I discussed about Sitecore SXA search components and used Lucene as my search provider.
    But, when I tried to run the SXA search with the Solr I couldn’t get it to work.
    My instance running SXA was not showing any results on this URL:
    I had to reach out to my “Crawling.log.” file to see what was really happening when Sitecore is trying to index the SXA content.
    In the crawling log, I noticed repetition of errors related to the computed SXAContent field.
    Exact error:

    Wednesday, 6 September 2017

    Sitecore SXA search components


    After discussing about various Sitecore SXA capabilities before, today I am writing something about the search components which comes as part of SXA base installation. (version 1.3)

    Search comes with many out of the box components which can talk to each other:

    I will show you how to use some of the above to create search for our site.
     Below are the steps which enable search with a simple text box and search button:

    Friday, 1 September 2017

    Design Sitecore SXA components using Variant Template

    In my previous blog post we talked about Sitecore SXA Rendering Variants and added variant fields to the variant definition.
    The above variant did give us an option to include multiple fields but there can be a case where we have to extend the component by changing the HTML as well.
    Below are the steps which will enable us to add a custom HTML to any Sitecore SXA component: (Continuing with the page list example from last blog post)

    • If we add a new Field Variant for our image, we get the below HTML:



                                                      
    But many a times the “Agency” (Front end devs) want the image to be lazy loaded and follow a set HTML pattern.

    Wednesday, 30 August 2017

    Sitecore SXA Rendering Variants

    Many Sitecore SXA components provide functionality to extend the scope of the component and cater for different scenarios.
    This flexibility can be achieved by using Rendering Variants.
    We can see the rendering variants for all the SXA rendering under location:
    /sitecore/content/Tenant/Site/Presentation/Rendering Variants

    This blog post will talk about a few things that can be achieved using Rendering variants.
    I am taking an example of SXA Page List component.

    We already have few pages in our site and we have dragged the page list component into main at Home page:
























    Above image is showing default page list component with a Title field of all child pages under Home.

    Wednesday, 16 August 2017

    Remove Inline Styling on Sitecore SXA image component

    This post describes one of the basic issues we face while using some of the Out of the box SXA components.
    The Image component when dragged and dropped from the toolbox, straight away adds the following HTML:

     Here we can see that an inline style is added to the image tag, which overrides the image margin supplied by the Front end team(agency).
    This can be an issue where every image of the site has a forceful margin set to it as 0px 0px.

    This inline style is getting added from a SXA class called "SetImageStyleParameters", which can be found under: Sitecore.XA.Foundation.SitecoreExtensions.Pipelines.RenderField.

    We can find this class patched in : ~\Website\App_Config\Include\Foundation\Sitecore.XA.Foundation.SitecoreExtensions.config
    As :




     We can simply get rid of the inline style by removing the patch from "Sitecore.XA.Foundation.SitecoreExtensions.config" or we can override the process based on our custom requirements.







    Sunday, 13 August 2017

    Creating and adding Datasource for custom Sitecore SXA rendering in experience editor

             Now that we have dragged and dropped our custom carousel in previous blog post, we can’t see an option to create datasource on the fly (i.e in experience editor mode) like we see for other SXA renderings.
        To achieve that we need to add some custom buttons(Edit frame buttons) on the experience editor component panel.

             We can achieve that by following steps:

    Step 1: Creating edit frame buttons:
    o   Switch to core DB in Sitecore

    o   Create 2 folders for showing button to add a carousel item & other folder for adding carousel slides

    o   We can add above buttons by copying from the existing buttons in the OOB carousel/any other component folder.

    Note we can make editing the template fields for the carousel even easier by adding pipe separated field names in the edit item:


    Monday, 22 May 2017

    Clearing application cache on Sitecore publish

    This blog post will talk about a general problem which we face or may have faced while implementing Sitecore solutions where we have used any custom or application level caching.

    One most common example where we face this issue is while setting our sublayout/rendering as cacheable in code.

    Example:

    The above screenshot has a property "Cacheable=True", which caches the "Test.ascx" sublayout.
    The above caching is maintained even after we publish the sublayout or even the whole site.

    Saturday, 6 May 2017

    Sitecore Search Faceting & Date range faceting

    This blog post is divided in following 2 parts:

    Part 1: Search faceting and Date Range search facet available out of the box.
    Part 2: Date range faceting based on custom DateTime Field.

    Search facets help us filter the search results and limit the search results after running the actual search.
    Sitecore Lucene and Solr both support faceting.
    Sitecore 8.2 and some other lower versions provide Out of the box faceting.

    We can see these OOB facets under:
    Location: /sitecore/system/Settings/Buckets/Facets


    You can read about them here.

    This post will discuss about one of the above facet i.e. “Date range facet “.
    We will see below how the date range facet works and how we can leverage this date range facet in our project.

    Sunday, 2 April 2017

    Some useful tools recommended by Sitecore

    Debugging:
    • Cookie manipulation in Google chrome: Can be very useful for testing XDB functionality.
    • Fiddler: Can be used to fake responses for css & JS.
    Performance Analysers:
    • Wireshark
    • SQL Profiler
    • Prefix: For performance monitoring
    • Code decompilers - to debug within a Sitecore pipeline
    • Execution plans in SQL
    • ANTS profiler