Archive for August 2008
Even though Commerce server got released 20 months before, still I am getting many mails from different business users explaining the usage of commerce server and what problems it can resolve. Why can’t we develop a e-commerce site from scratch without using commerce server.
My common answer for these types of questions is
Each aspect of developing, deploying, managing, maintaining, and monitoring e-commerce sites is designed to help maximize security, minimize Total Cost of Ownership (TCO), accelerate time to market, and simplify exchange of data with existing LOB systems and trading partners. You can create e-commerce sites that can support millions of customers and products. By using out-of-the-box functionality of commerce server, you can quickly start interacting with the various systems and processes that help you develop, manage, maintain, and help secure e-commerce web sites.
Here are the few advantages Commerce Server will provide.
- Ready made business tools to configure products, catalogs, virtual catalogs, advertisements, discounts, order tracking, etc.
- Supports service oriented architecture..
- Using CS adapter for BizTalk, it can easily integrate with LOB, Partners, etc.
- Through staging feature, we are first import data into staging server and once confirmed we can import the data in production.
- Profile system can be scalable and can store in SQL Server and/or in active directory.
- CS 2007 is based on .NET 2.0
- Partner software development kit is available.
- CS business Analytics system is available with CS 2007 enterprise edition.
With the new version of commerce server (Mojave), the existing customers need not spend lot of money for software migration.
Commerce Server 2007 was built and tested to support large enterprises and to be deployed in 99.9% availability customer environments. It was tested against the following criteria:
- Top-10 retail-oriented catalog scenarios
- 15+ catalog/virtual catalog mix on live site
- 2,500+ categories/catalog for 37.5 K+ categories live
- 250 K+ products/catalog for 3.75 M+ products live
- 250+ variants/product for 937 M SKUs live
- 600–1,200 campaigns w/2 M coupons active
- 60 M user profiles
- 100,000 orders/day (11-hour peak)
- 10 GB/hour Data Warehouse import
- Deployed w/99.9% availability out of the box
- Hosting support (100 active; 1,000 provisioned)
On top of this, if you add some facts and figures on investments and its returns (sorry I don’t have these details) then it will give full support to your business team to propose this technology for clients/projects.
If you like this post, please click on our sponsor advertisement.
With commerce server SP 2, the developers can start developing their application in visual studio 2008 but after installing commerce server SP 2, you may not find project template in visual studio. By default commerce server doesn’t install these templates and you have to manually install them.
Prerequisites:
- Install commerce server 2007
- Install commerce server 2007 SP2
Follow these steps to enable templates in visual studio 2008.
- Open control panel – go to add /remove programs. Select “Microsoft Commerce Server 2007 Developer Edition” and click on “Change/Remove” button.
- Installation wizard will be opened. Select “Modify” and click on next button.
- Select “Project Creation Wizard” check box from the available components (as shown below) and complete the installation.
- Now when you open the Visual studio, you can able to see commerce server templates in visual studio (as shown below)
- If you try to create commerce server C# ASP.NET web application, you may get “Package Load Failure” exception. This is known issue with visual studio packages where the full path of commercepkg.dll is missing.
- Follow these steps to fix this problem.
- Open Registry
- If you are using x86 OS then navigate to
[HKEY_LOCAL_MACHINESOFTWAREMicrosoftVisualStudio9.0Packages{1FAF7679-A5C1-4369-9F00-F87E8386F599}] - If you are using 64-bit OS then navigate to:
[HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftVisualStudio9.0Packages{1FAF7679-A5C1-4369-9F00-F87E8386F599}] - If you see the “CommercePkg.dll” in the registry “InprocServer32″ registry key, change this value to the full path to that dll:
- For x86 OS:
Change the “InprocServer32″ value to “C:Program FilesMicrosoft Commerce Server 2007CommercePkg.dll” - For 64-bit OS:
Change the “InprocServer32″ value to “C:Program Files (x86)Microsoft Commerce Server 2007CommercePkg.dll”
After performing above changes you can now create commerce server C# asp.net web application using visual studio 2008.
If you like this post, please click on our sponsor advertisement.
CategoryConfiguration class is used to configure the pre-loaded properties of a category object which includes child category and products. Through this object, we can tell commerce server whether to fetch all products under a category (including sub categories) or products under that category only. In this article I am explaining how to fetch category products with the help of CategoryConfiguration class.
Requirement:
1. If the category is root or parent then show all the products under that category (including products in sub categories).
2. If the category is sub-category and doesn’t have any categories under it then show only those products.
Pre-requisites:
I created a catalogName “MySite” and top category named “Dance”. Under “Dance”, I have created two categories named “classic dance” and “break dance”. “Dance” category is having two products and sub-categories having one product each.
|
string catalogName = “Mysite”; string categoryName = “Break Dance”; CatalogContext catalogContext = CommerceContext.Current.CatalogSystem; ProductCatalog catalog = catalogContext.GetCatalog(catalogName); CategoryConfiguration categoryConfig = new CategoryConfiguration(); categoryConfig.RecursiveChildProducts = false;
ProductCollection productCollection; CategoryCollection categoryCollection = null;
if (categoryName == string.Empty) { productCollection = catalog.GetRootCategory(categoryConfig).ChildProducts; } else { Category category = null; category = catalog.GetCategory(categoryName, categoryConfig); categoryCollection = category.ChildCategories; if (categoryCollection.Count > 0) { categoryConfig.RecursiveChildProducts = true; category = catalog.GetCategory(categoryName, categoryConfig); } productCollection = category.ChildProducts } Response.Write(productCollection.Count.ToString()); |
In the above code, we are checking whether the category is having any child categories, if yes then we are getting all products under that category by setting the catalogConfiguration class property – RecursiveChildProducts to true. If the category doesn’t have any sub-categories then the products at the root are returned.
If I pass “Dance” value to category variable then I will get four products and If I pass “Break Dance” value to category variable then I will get one product.
If you like this post, please click on our sponsor advertisement.
In Microsoft commerce server forums, I came across one post with a nice requirement. The requirement was
- Create a user in Starter site without manual entry . ie User Details would come from Active Directory, using this details , starter site should create a user profile if he visits the site for first time.
- If an Existing user visits the Starter site, his user profile details should be fetched automatically without entering username and password.
Here is the resolution for this requirement.
Pre-requisites
- Instead of having the same profile data at two different locations (commerce server & AD), if possible, try to extend the commerce server to map the fields in AD (optional).
- By default commerce server uses email ID as primary key in User Profile. You can extend profile system to make user Id (which holds AD user ID) as primary key. To change primary key value, check below site for more details.
http://techblog.ravikanth.net/blog/cns!F348D7145D1BE6C2!459.entry - Enable windows authentication on starter site.
Authentication Process:
- Get logged in user ID in to the application. We will check whether profile session available.
- If there is no profile session available, we will get user details using WindowsIdentity class.
- Call commerce server profile system to get user profile details
- If nothing is returned, we will create a user profile for that user. We will fetch necessary information from active directory and create an entry in commerce server profile system.
Note: The password will be same for all users – say Pass@123. - Store user profile details in session for further use.
I tested this approach on starter site and it worked. For instance, for auto-login feature I had added below code in standardLayoutMaster.CS init() method.
bool isAnonymousUser = SiteContext.Current.IsAnonymousUser;
if (isAnonymousUser == true)
{
CurrentUser.RefreshCache();
WindowsIdentity identity = WindowsIdentity.GetCurrent();
string[] userName = identity.Name.ToString().Split(”);
// Set new user id.
Guid registeredUserId = (Guid)Membership.GetUser(userName[1]).ProviderUserKey;
CommerceContext.Current.UserID = registeredUserId.ToString(“B”);
SiteSecurity.CreateUserCookie();
LogCommerceEvent.UserSignIn(registeredUserId);
}
Every time, application checks whether the current user is anonymous user. If yes, it will get user name (remove domain/system name) from windows identity and pass it to commerce server to get user Id (guid). This GUID is assigned to commerce server context.
If you like this post, please click on our sponsor advertisement.
Commerce server provides independent profile mechanism for authorization. Windows live Id is Microsoft Internet based software service that is designed to manage identity & trust within the Microsoft eco system. Let’s leverage the Windows Live ID as a login authentication method for an e-Commerce site. Using a username and password that the user is familiar with will reduce the costs and time spent on managing user identities. This article will describe the process of integrating Windows Live ID with the Commerce Server Starter Site.
Following are the steps in authentication process
- User clicks on sign-in or sign-out button in starter site.
- If user already signed in then
- Retrieve user’s unique identifier from stoken.
- If User has commerce server profile
- If yes, validate user and perform other login tasks.
- Starter site will display personalized contents to the user.
- If user doesn’t have commerce server profile
- Redirect the user to registration page.
- User fills the registration form.
- Create user profile and other login tasks.
- Starter site will display personalized contents to the user.
- If User has commerce server profile
- Retrieve user’s unique identifier from stoken.
- If user hasn’t signed in then
- Redirect user to windows live ID.
- Windows live ID authentication process will happen.
- Redirect to starter site.
This is two step process.
- Register your application with windows live.
- Change your web site to use windows live ID.
Click on below URL to register your application with windows live
https://msm.live.com/app/
The second step is to do following changes in starter site so that the application asks windows ID authentication instead of default profile authentication. Here are the steps.
- Copy WindowsLiveLogin.cs (from the Web Authentication SDK, downloaded above) to the Starter Site’s App_Code directory. You can download web authentication SDK from below link
http://www.microsoft.com/downloads/details.aspx?FamilyId=24195B4E-6335-4844-A71D-7D395D20E67B&displaylang=en - Create a new login page say LiveIDLoginPage.aspx
- Create a new registration page say LiveIDRegistrationPage.aspx.
- Update the Starter Site’s web.config file to reference the new pages – e.g. loginUrl=“~//LiveIDLoginPage.aspx”
- Add the following <appSettings> section to the web.config file. Make sure you set your application values appropriately.
<appSettings>
<add key=”wll_appid” value=”123456789″/>
<add key=”wll_secret” value=”MySecretKeyForStarterSite”/>
<add key=”wll_securityalgorithm” value=”XXXXX”/>
</appSettings> - In your LiveIDLoginPage.aspx page, verify if the user has already been authenticated by Windows Live ID. If not, redirect to Windows Live ID sign-in page.
- Retrieve user’s unique identifier and verify if profile exists in Commerce Server. Redirect to new user registration page if needed
This article will help you to understand how to implement window Live Id authentication and doesn’t provide end to end code? Many companies doesn’t want the user profile created at different entity (like passport authentication). Here we are using windows live ID only for authentication and rest of the user details are captured during registration process. This will help us to perform targeting our site content appropriately.
If you like this post, please click on our sponsor advertisement.
