Posts Tagged ‘commerce server’
Microsoft Commerce Server team announced the availability of the Microsoft Commerce Server 2007 code name “Mojave” October CTP. This is the first public release of our next Commerce Server offering.
This CTP includes the first of two key additions to Commerce Server: the new multi-channel commerce foundation. This new run-time API adds new out-of-box functionality, adds pervasive multi-channel awareness, and unifies the run-time calling model across all subsystems.
To receive the October CTP, Mojave October CTP, to review and accept the EULA. You will receive an email with the link to the download package.
I will be reviewing CTP and will post my findings on this blog. So, stay connected to my blog.
If you like this post, please click on our sponsor advertisement.
By default only one discount will be applied to the basket. Commerce server is having its own algorithm to select the particular discount from the qualified discount list. The user can change selection behavior by prioritizing the discounts. What if you want to give multiple discounts to the customer.
For example, you have created 10% simple discount on the product "rockes" and another 10% simple discount on the product "polor stack" and the coupon code for both discounts is "kanth". Apart from this, you have defined 75% amount discount on shipping cost if the total basket cost is greater than > 100$.
Commerce server also provides us to apply same discounts in a basket through interaction policies. Check below site for more details.
http://msdn.microsoft.com/en-us/library/ms959119.aspx
So, for the given two simple discounts, I have enabled few properties (select check box as per your requirement).
Now when the user added two products into basket, he will get 10% discount on Rockes shoes and Polor Stack bags and as well as 75% discount on shipping cost. Check below diagram is the output of the above configuration changes.
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.
