Portal Engine
Version 3.x > Portal Engine > Anonymous user - Checkout fields View modes: 
User avatar
Member
Member
gavin.bates - 12/4/2008 5:03:15 AM
   
Anonymous user - Checkout fields
morning!

Using the Kentico e-commerce and have enabled the 'Anonymous checkout' Although the standard fields that are compulsary include 'First name' 'Last name' and 'E-mail' Can we also make the 'Company' field compulsary?

Have found the code to remove '(optional)' but no sign of any verification settings.

Thanks

Gavin

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 12/4/2008 8:18:38 AM
   
RE:Anonymous user - Checkout fields
Hello Gavin,

I suppose you have already find the file: ShoppingCartCheckRegistration.ascx

So switch it to the code behind and find this code (line about 571):


// Check 'Continue as anonymous customer' section
else if (radAnonymous.Checked)
{
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "checkAnonymous", ScriptHelper.GetScript("showHideForm('tblAnonymous','" + radAnonymous.ClientID + "');"));

result = val.NotEmpty(txtFirstName2.Text, ResHelper.GetString("ShoppingCartCheckRegistration.FirstNameErr"))
.NotEmpty(txtLastName2.Text, ResHelper.GetString("ShoppingCartCheckRegistration.LastNameErr"))
.NotEmpty(txtEmail3.Text, ResHelper.GetString("ShoppingCartCheckRegistration.EmailErr")).Result;


and add the NotEmpty validation for the Company name control.

It could look like this:


// Check 'Continue as anonymous customer' section
else if (radAnonymous.Checked)
{
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "checkAnonymous", ScriptHelper.GetScript("showHideForm('tblAnonymous','" + radAnonymous.ClientID + "');"));

result = val.NotEmpty(txtFirstName2.Text, ResHelper.GetString("ShoppingCartCheckRegistration.FirstNameErr"))
.NotEmpty(txtLastName2.Text, ResHelper.GetString("ShoppingCartCheckRegistration.LastNameErr"))
.NotEmpty(txtCompany2.Text, "Error message!")
.NotEmpty(txtEmail3.Text, ResHelper.GetString("ShoppingCartCheckRegistration.EmailErr")).Result;


Best regards,
Helena Grulichova

User avatar
Member
Member
gavin.bates - 12/10/2008 5:47:49 AM
   
RE:Anonymous user - Checkout fields
That's great - got it working in the end, Thanks!