Tuesday, September 29, 2015

Field’s raw value in Sitecore

A field's raw value is something like what the data is stored in underlying database.







You will not find any difference for single line text's raw and rendered value but will find difference between link,image etc raw and rendered value. Please see the above screenshot for raw and rendered value of a image. Basically the raw value of the image is XML.

Monday, September 28, 2015

Easiest way to update Admin password to b using SQL script in Sitecore

You need to run below SQL query in core database and that will update your default admin password to b

UPDATE [aspnet_Membership] SET Password='qOvF8m8F2IcWMvfOBjJYHmfLABc='
WHERE UserId IN (SELECT UserId FROM [aspnet_Users] WHERE UserName = 'sitecore\Admin')

Sunday, September 27, 2015

Simple OOPs concept in Sitecore

A picture is worth a thousand words


How to open Developer Center in Sitecore 8.0

1. Login to Sitecore Instance. Suppose your Sitecore instance Name is sitecore8
2. Open http://sitecore8/sitecore/shell/default.aspx?xmlcontrol=IDE
3. Developer Center will open

Very simple way to configure multiple CD server in your project

Content delivery server makes your web content available to your website visitors. You can configure n number of content delivery servers for improved scalability and better performance. If you expect to have high volume of visitors or to configure servers in different geographic locations, you can arrange CD servers into clusters.
Please find the below steps to configure CD server. We have configurated 3 CD server in localhost and datasource is same but you can define different datasource.This is just showing how to configure Multiple CD server.

1.ConnectionStrings.config:
Just copy the web database connection string 3 times like the below image and name it like "web1","web2","web3". Here all the server is same but you can mention different name for true configuration of CD server for dev or preprod or for production.


2.web.config:
Copy the settings section 3 times in web.config and name it "web1","web2","web3" like we have defined the name in ConnectionStrings.config file. Please see the below screenshot.

3.Validation:
1. Login to Sitecore
2. Click on Database selector and you will find 3 web database like the below image.










Sitecore pipeline

Sitecore pipeline consists of sequence of processor. When a pipeline is invoked, the processor within that pipeline are running in order.
A processor is nothing but .NET class that implements a method.

We can find Sitecore pipeline within web.config file or may be in patch file. If you have a series of tasks, which need to be performed to accomplish a task, then a pipeline might be the best way to go ahead. Most of the Sitecore functionality are controlled by Sitecore pipeline. In web.config file you will find a number of pipeline. Those pipeline are default pipeline from Sitecore. But you can write your own pipeline to accomplish a task.

Pipeline defined in web.config file



Pipeline contains class name with namespace and assembly name.Below is the "CheckLayout" is class name and "Sitecore.Kernel" is assembly name.

Sitecore contains more than 140 pipelines and each new version contains more pipeline.

Transfer Item from one database to another database in Sitecore

Lets take an example, Suppose by mistake you have deleted one item from master database and you do not have any backup of master database but you have that item present in your web database. Now how you will transfer that item from web to master database. There are two simple way to transfer item from one database to another database.

Way 1:
1. Select web” database from Database selector.



2. Open content editor --> select the item you want to transfer-->Right click on item -->Copying-->Transfer-->Next-->Next-->Select master database from dropdown-->Next-->Transfer.
Please see the below screen for how to transfer

Way 2:
1. Select web” database from Database selector.
2. Go to control panel -->click on database--> choose task Transfer Items to Another Database.
3. Next-->Next-->Select master database from dropdown-->Next-->Transfer

Stored procedure that will help us to find itemwise max version in Sitecore

Hi All,

Below stored procedure will help us to find itemwise max version in Sitecore. For better performance, we can delete older versions of any item and we can keep latest 7 – 10 versions of any item. Execute the below Stored Procedure in Master database and you will find itemwise max version of items.


create procedure Stp_Version_count
@counter          int 
as
begin
      WITH [Content_Items] AS  
       ( 
        SELECT [ID], [Name], Created 
         FROM [dbo].[Items] 
         WHERE ID='{11111111-1111-1111-1111-111111111111}' 
        
         UNION ALL 
        
         SELECT  i.[ID], i.[Name], i.Created 
         FROM [dbo].[Items] i 
         INNER JOIN [Content_Items] ci ON ci.ID = i.[ParentID] 
       ) 
       
       select ID,[Name], Created into #tbl    
       FROM [Content_Items]
       
       select top (@counter) ItemId,[Name],max(Version) as Total_No_Of_version from #tbl a ,
       VersionedFields b where a.ID = b.ItemId group by ItemId,[Name] order by max(Version) desc
      drop table #tbl

 end
   
exec Stp_Version_count 100
drop procedure Stp_Version_count