Wednesday, July 12, 2017

Creating Custom Fact Table in Sitecore

Here's how you can record page events and put them into the reporting table in Sitecore.  Followed these steps and it was quite easy!

https://www.onenorth.com/blog/post/sorting-sitecore-items-by-popularity-using-sitecore-analytics

One thing to remember to ensure that you include the VisitorIdentification function in the layout you're using or your page events may not record correctly.

Thursday, June 22, 2017

More on Image Resizing

Apparently starting with Sitecore 7.5, Sitecore has made it so that parameters for image resizing require a hash in order to work.  To programatically generate a url with the hash, the following code can be used:


Sitecore.Resources.Media.HashingUtils.ProtectAssetUrl(
                               Sitecore.Resources.Media.MediaManager.GetMediaUrl(
                                   myMediaItem,
                                   new MediaUrlOptions()
                                   {
                                       Language = Context.Language,
                                       Width = 100,
                                       Height = 75
                                   }))

If you only need the hash value for the provided image URL, you could use the GetAssertUrlHash(url).

For more details please see this blog entry here: http://kirkegaard-at.blogspot.sg/2015/06/media-hash-and-resizing.html

For more on MediaUrlOptions:  https://community.sitecore.net/developers/f/8/t/1654

Friday, May 19, 2017

Set Your Sitecore Source Field to a Relative Path

Just some quick hits, took me a little while to figure out how to do this so I thought I'd post.  Let's say you have a multilist field, and you want the source to be a sibling folder, in this case one that's called "tags".  Here's what you set the source for that multilist field to:

query:../tags/*

Let's say you have a dropdownlist and you want the source to be the parent of your current item, but you want to specify the template. This is how you do it:

query:../*[@@templateid='{templateId}']

Make sure templateid is written all lower-case.  That's it.  Quick like a bunny cuz I have to rush back to work.

Wednesday, January 11, 2017

Custom Reports with Sitecore Powershell Console

Sitecore Powershell is a great component to add to your sitecore solution, and it an be used to export custom reports.  Here's a quick snippet as an example: 
cd "master:\media library"
Get-ChildItem -recurse | Show-ListView -Property "name", "Language", "Id", "Url"