Customizing Product Category Links


or instances where a product category needs to lead to a custom URL instead of actual products, a few simple updates is all that's needed.

First, we're going to need a new Sitecore template which contains the customizable URL, but also has all the standard Category template fields.  Here's how the Builder and Content tabs on the new template should look:

Now we can write a new C# class which will map to this template, extend the base ProductCategory class, and override the default Url property implementation.  See attached for an example.  For the mapped class to be picked up by Glass mapper, Glass needs to know in what assemblies to look.  Here's an example configuration where Assembly.Containing.Types.dll contains the types to be mapped:

    <glassConfiguration type="ActiveCommerce.Glass.Configuration, ActiveCommerce.Kernel">
    <assemblies hint="list">
        <assembly id="customtypes">Assembly.Containing.Types</assembly>

After the appropriate mapping has been made, the links for categories made using the new template will be configurable with the new Redirect Location field.

Have more questions? Submit a request