Tuesday, August 5, 2014

ParseDataSourceString moved between version 7.1 and 7.2 of Sitecore

If you have upgraded from Sitecore 7.1 to 7.2 or sharing code libraries between 7.1 and 7.2 you may start getting an error message like this:

Method not found:  'System.Collections.Generic.IEnumerable`1<Sitecore.ContentSearch.Utilities.SearchStringModel> Sitecore.ContentSearch.Utilities.SearchStringModel.ParseDatasourceString(System.String)'.

The reason is that the ParseDatasourceString method moved between Sitecore versions.

In 7.1 you would find it in: Sitecore.Buckets.Utils.UIFilterHelpers.ParseDatasourceString whereas in 7.2 it can be found in Sitecore.ContentSearch.Utilities.SearchStringModel.ParseDatasourceString

The solution is to have two versions of your dlls or wrap this call in a third dll you can call from your larger library.  If you have the namespace the same in both projects you can swap them out for each version.

If you have any questions, tips, tricks or resources please email me at chris.williams@readwatchcreate.com

Wednesday, July 30, 2014

Sitecore Saving vs Saved Event and when to use which


One of the developers I am mentoring asked me a good question and I thought I would share the answer with the guild in case you are wondering the same.

The question is related to saving items to an external DB when they are saved in Sitecore.  There are really two ways to handle it.

1) Write an Item Provider and store them in a single location.
2) Use the item save events but which one is the right one to use.

In our case it was more beneficial to use option 2.  Using Saved vs Saving depends on whether the external DB will store any data that will be calculated based on saved data rather than simply saving a copy.  Saved happens after the Sitecore item is saved where as Saving will allow you to perform additional operations on the Sitecore item prior to save.

The other thing to be aware of is that when an item is duplicated it will NOT call the saving or saved events unless the user explicitly hits save.  If you require duplicate items to make it to your database too then you will need to implement this event too.

John West wrote a really good article with sample code as well, called Intercepting Item Updates with Sitecore.

If you have any tips, tricks or resources you would like to share with the guild please email them to chris.williams@readwatchcreate.com and we will post them here.

Wednesday, June 4, 2014

Having Trouble Finding a Sitecore Resource? Why Not Train one.

I recently wrote a quick article on LinkedIn regarding the current shortage of Sitecore talent called Having trouble finding s Sitecore resource.? Why not train one and am getting a lot of good feedback.

If you are interested in learning more on the best way to train a Sitecore resource to help build your team. Please contact us at  chris.williams@readwatchcreate.com and we will help.

On a side note, if you are a .NET Developer working with C# and are interested in working with Sitecore or Dynamics CRM, you can apply for our Mentorship Program.  If accepted, then we will mentor you on Sitecore or Dynamics CRM.  We will provide you with a project to work on with us that will build your skills and allow you to make some money at the same time.

To apply for the Mentorship Program please email your resume along with details on why you want to work with Sitecore or Dynamics CRM to chris.williams@readwatchcreate.com

We look forward to working with you to achieve your goals.

Tuesday, May 6, 2014

Sitecore 7.x and Internet Explorer 11 and Content Item Fields get covered in Grey Box

Here are the steps to reproduce:

1) Open Internet Explorer 11.
2) Log into the Sitecore Admin selecting Content Editor.
3) Click on a node in the tree.
4) On the right hand side move the mouse around, especially over the edit html for a rich text field.  The whole field panel will turn grey.
5) Click on a node in the tree and the grey will disappear and fields will come back.

WORKAROUND: Open windows explorer and edit \sitecore\shell\Themes\Standard\Default\content manager.css

The editorFrame style has the following:
#EditorFrames {
  width: 100%;
  position: absolute;
  top: 0;
  bottom: 0;
  margin-top: 25px;
  background: white;
}
In IE 11 this will width:100% will not work properly.  Change this style to:
#EditorFrames {
  width: 100%;
  position: absolute;
  top: 0;
  bottom: 0;
  margin-top: 25px;
  background: white;
min-width:400px;
min-height:1000px
}
This will resolve the issue however since this is a Sitecore file you have to be careful during upgrades that this fix is not overwritten.

Sunday, April 13, 2014

Possible Sitecore Hackathon as part of Sitecore User Group Conference 2014

Back on January 24, 2014 something amazing happened, the First ever Sitecore Hackathon.  9 Teams from various nations took part and had lots of fun.  Thanks to Akshay Sura (@akshaysura13) for arranging the first one.

Its looks like the next one will take place in person at the end of the Sitecore User Group Conference 2014
If you are able to take part please register here.  Also please forward on the registration information to everyone you know.  The more teams taking part the more fun it will be.

Look forward to Twitter commentaries and hearing the results of all the amazing modules that will come out of this.  Also look forward to many more.


Thursday, April 10, 2014

Sitecore 7, The Data Source and the GUID

For those looking at upgrading from Sitecore 6.x to 7.x beware of a subtle advancement that is very beneficial in most situations but a major issue in another.

Scenario #1:  A client is migrating from an existing CMS and pulls the content from the existing cms into Sitecore on a regular basis during migration to reduce the size of the outage windows for Clients.

Scenario #2:  A client injects data into Sitecore from an external system via clearing all the nodes under a certain node in sitecore and then re-imports the content items.

In both these scenarios the Guid would chance for the content item but the path would remain the same.
In Sitecore 6.6, this would work fine as the DataSource property of the sublayout stored the Item Path.

In Sitecore 7.0, a cool advancement was introduced that allowed you to move content around and it would automap the DataSoure much like it does with content links.  Nice feature but in the above scenarios it will break existing SubLayouts.

Workaround: This is not ideal but if you place text in front of the item path eg. "ITEM_PATH:" then sitecore cannot resolve the sitecore path so it will keep the string there.  Then in the sublayout when you grab the DataSource you look for that string and remove it before calling GetItem.  Here is some sample code:

                if (string.IsNullOrEmpty(subLayout.DataSource))
                    return Sitecore.Context.Item;
                string dataSource = subLayout.DataSource;
                Item dataSourceItem = null;

                if (dataSource.StartsWith("ITEM_PATH:"))
                {
                    dataSource = dataSource.Substring(10);
                }

                if (Sitecore.Context.Database.GetItem(dataSource) != null)
                {
                    dataSourceItem = Sitecore.Context.Database.GetItem(dataSource) ??
                                      Sitecore.Context.ContentDatabase.GetItem(dataSource);
                    Log.Info("CurrentContextBased On Data Source (" + dataSource + ")", this);
                }

Alternatively someone could override part of the mechanism to handle "ITEM_PATH:" much like Sitecore itself does currently with "query:"  If someone has created one, and is willing to share it in MarketPlace for others to use, let me know and I will reference it here for others to access.

If you have any tips, tricks or resources you would like to share with the Guild please email them to chris.williams@threepointturn.com or dennis.augustine@threepointturn.com and we will share them with the Guild.


Monday, March 24, 2014

E-Commerce Guild Blog

I would like to take this opportunity to welcome E-Commerce Guild to the Guild family.

This blog shares the same vision as our other Guild sites. It is designed to contain various Tips and Tricks to help you with your development projects, provide guidance, mentoring and assistance in relieving your pain points.

 If you know any Tips, Tricks or resources let us know and we can add them to this blog. If you have a particular pain point that requires assistance let us know as well. Please email us at chris.williams@readwatchcreate.com for assistance.

You can also register at readwatchcreate.com and we will reach out to discuss your needs.