Wednesday, December 26, 2018

SiteCore Basket missing details Blank


When created shopping cart using commerce accelerator, I found it blank:

  • Items header without any item
  • Summary/Totals appear labels only
After I checked error in browser found the following urls gave me 404:

I found these urls work fine with delivery page.
After investigation found difference in AntiForgery.
Finally, I found problem missing (Commerce metadata control) which add AntiForgery hidden field.

Thursday, October 25, 2018

Publishing Error:System.AggregateException: One or more exceptions occurred while processing the subscribers to the 'item:moving' event.

If you installed Sitecore 9.* and SXA 1.7, you may see error Publishing Error: System.AggregateException: One or more exceptions occurred while processing the subscribers to the 'item:moving' event.

I found patch  for solving this error:

Link for the patch: github.com/.../1.7.0.0

Download the zip file, extract it, and copy its contents into the sitecore website folder.

Tuesday, July 1, 2014

Knockout discover validation problem

Sometimes when you use knockout to build form with validation, You will find errors more than 0 although no message appeared.
Issue: You added validation without binding the contolor
To find property which cause this problem you need to iterate through object properties to find property cause this error using the following code:

var allValidatablesAreValid = true;
for (var property in self)
{
    if (self.hasOwnProperty(property) && self[property]["isValid"]) {
        allValidatablesAreValid = allValidatablesAreValid && self[property].isValid();
    }
    // You can add an early bail out here:
    // if (!allValidatablesAreValid) { break; }
}

Wednesday, December 18, 2013

How can I get K2 worklistitems without open Item

I need to get work flow Item by serial number without opening Item.

When I used below code does not return any  thing:

WorklistCriteria criteria = new WorklistCriteria();
criteria.AddFilterField(WCField.SerialNumber, WCCompare.Equal, serialNumber);
SourceCode.Workflow.Management.WorklistItems wl = cnnWMS.GetWorklistItems(criteria);

Work Field doesn't contain field called serialnumber

I use this code instead:

WorklistCriteriaFilter criteria = new WorklistCriteriaFilter();
RegularFilter rfPID = new RegularFilter();
RegularFilter rfActID = new RegularFilter();
// why doesn't setting this prevent me from knowing alias? Are there constants or enums to use?
//rfPID.TableName = "K2Server.dbo._ProcInst";
rfPID.ColumnName = "PI.ID";
rfPID.ParameterValue = serialNumber.Substring(0, serialNumber.IndexOf('_'));
rfPID.DbType = DbType.Int32;
rfPID.Comparison = Comparison.Equals;
rfPID.ParameterName = "@ICE_ProcInstID";
criteria.FilterCollection.Add(rfPID);

rfActID.Condition = RegularFilter.FilterCondition.AND;
// why doesn't setting this prevent me from knowing alias? Are there constants or enums to use?
//rfActID.TableName = "K2Server.dbo._WorklistHeader";
rfActID.ColumnName = "WLH.ActInstDestID";
rfActID.ParameterValue = serialNumber.Substring(serialNumber.IndexOf('_') + 1);
rfActID.Comparison = Comparison.Equals;
rfActID.ParameterName = "@ICE_ActInstID";
rfActID.DbType = DbType.Int32;
criteria.FilterCollection.Add(rfActID);

SourceCode.Workflow.Management.WorklistItems wl = cnnWMS.GetWorklistItems(criteria);

Install to global assembly cache without gacutil

In Windows Server 2012 you can't install a DLL to the GAC by drag/drop, but you can do it using GACUTIL.exe.
GacUtil.exe is not present on the server by default.
You can do it using the following script instead of Gacutil.exe
Run your powershell and use command like sample below:
.\Add-AssemblyToGlobalAssemblyCache.ps1 FullPath\itegration.dll
This will applied in legacy windows versions

In Windows 2012 you can use the following PowerShell to install dll to GAC

Set-location "c:\temp"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("c:\temp\MyDLL.dll")
iisreset

 In Windows 2012 you can use the following PowerShell to remove dll from GAC:

Set-location "c:\temp"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacRemove("c:\temp\MyDLL.dll")
iisreset

Sunday, October 6, 2013

Replace HtmlTextWriter before render

If we want to change HTML of control before rendering you can use the following code:
protected override void Render(HtmlTextWriter writer)
{

MemoryStream stream = new MemoryStream();
StreamWriter memWriter = new StreamWriter(stream);
HtmlTextWriter myWriter = new HtmlTextWriter(memWriter);
base.Render(myWriter);
myWriter.Flush();
stream.Position = 0;
using (StreamReader sr = new StreamReader(stream))
{
string renderedHtml = sr.ReadToEnd();
renderedHtml = renderedHtml.Replace("It looks like your browser does not have JavaScript enabled. Please turn on JavaScript and try again.", "");
writer.Write(renderedHtml);
writer.Close();
myWriter.Close();
}
//base.Render(writer);
}

Tuesday, April 16, 2013

How do I disable administrator prompt in Windows 8/Windows 2012?

I want disable administrator prompt in Windows 8 and Windows 2012, For this I did the following tasks:

  1. Go to Administrative Tools → Local Security Policy
    For windows 8 run secpol.msc
  2. Find Local Policies --> Security Options, in the left side of the window, and scroll down to the button.
  3. User Account Control: Admin Approval Mode for the Built-in Administrator account Disabled. (Default) The built-in Administrator account runs all applications with full administrative privilege.