Archive for July 2008

Through code, we can create discounts. For more information check below site.
http://msdn.microsoft.com/en-us/library/aa544659.aspx

The problem with this approach is that the discount will be created but it is in non-approved stage. So, when you use newly added discount code as it is now approved. The approach is to call “ActivateCampaignItem” method after creating discount.

For more information about this method refer to
http://msdn.microsoft.com/en-us/library/microsoft.commerceserver.marketing.webservice.marketingwebservice.activatecampaignitem.aspx

Related Articles


If you like this post, please click on our sponsor advertisement.


Commerce server profile will provide lot of advantages to developer by allowing extending it as per client business needs. In this article we are discussing how to add an image to use profile. Personalization is currently hot topic in the market and in this article we are extending our profile system to store user image in his profile. This image can be used to display in reviews/communities in ecommerce site.

There are two days we can implement this solution

1.       Store image in file system and the file path in database.

2.       Store image in the database.     

In the current article we are storing image in the database.

Follow these steps

1.       Create a new field named “u_UserImage” of type “Image” in UserObject table (This is  used to store user image).

ALTER TABLE dbo.UserObject ADD

                u_UserImage image NULL

GO

2.       Open commerce server manager. Expand Profile-> profile Catalog-> Data Sources-> ProfileService_SQLSource->DataObjects-> UserProfile.

3.       Right click on User Object and click on “Add Data Member” and enter text as shown in the image.

4.       Open commerce server manager. Expand Profile-> profile Catalog-> Profile Definitions and click on User object.
Add Data Member

5.       Click on General Information and click on Add Property and add values as shown in the image below.

 

Add Property
6.
      
In your registration page, add a input field of type file.

7.      

Add following code at submit button click event.

 

// Reading file content.

Stream s = File.OpenRead(filePath);
byte[] buffer = new byte[s.Length];
s.Read(buffer, 0, (int)s.Length);
s.Dispose();
s.Close();      

//Creating an user profile.

Profile userProfile = profileContext.CreateProfile(newId.ToString(), “UserObject”);
userProfile.Properties["GeneralInfo.user_id"].Value = newId.ToString();
userProfile.Properties["GeneralInfo.first_name"].Value = txtbox_FirstName.Text.ToString();
userProfile.Properties["GeneralInfo.last_name"].Value = txtbox_LastName.Text.ToString();
userProfile.Properties["GeneralInfo.email_address"].Value = txtbox_Email.Text.ToString();
userProfile.Properties["GeneralInfo.user_security_password"].Value = txtbox_Password.Text.ToString();
userProfile.Properties["GeneralInfo.user_type"].Value = 1;
userProfile.Properties["GeneralInfo.language"].Value = “en-US”;
userProfile.Properties["GeneralInfo.password_question"].Value = txtbox_PasswordAns.Text.ToString();
userProfile.Properties["GeneralInfo.password_answer"].Value = txtbox_PasswordAns.Text.ToString();
userProfile.Properties["GeneralInfo.image"].Value = buffer;   
userProfile.Update();

 

If you would like to have multiple images for a profile then better to create a table for all profile images. Each entry will have a unique ID and image content. Create a data object in commerce server. Extend userObject to hold a array of user images – i.e., unique Ids(as similar to storing multiple address).

Related Articles


If you like this post, please click on our sponsor advertisement.


All products doesn’t require inventory. Some products like services or digital media (like songs, movies, games) products may or may not require to track inventory. Commerce server provides flexibility to use inventory or to switch it off. There are two days to disable inventory for a product.

  1. Add product to the catalog that doesn’t have any association with inventory catalog .
  2. If the product is the catalog that have an association with inventory catalog then we have to explicitly disable inventory status for that particular product as shown in the image.

   

Product Inventory

Related Articles


If you like this post, please click on our sponsor advertisement.


If you would like to ramp up your team on commerce server 2007 by leveraging your existing ASP.NET and SQL Server skills, then here is the training course, especially designed for software developers.

  • Commerce Server 2007 Overview
  • Developing commerce server 2007
  • Business tools demo
  • Developing Catalog system
  • Developing Inventory system
  • Developing Profile system
  • Developing Marketing system
  • Developing Order system
  • Integrating commerce server with LOB applications

This entire course is for three days (8 hours a day). If you need more information on this training, you can drop me an email at – kanth(@)ravikanth(.)net

Related Articles


If you like this post, please click on our sponsor advertisement.


In starter site, email ID is declared as unique field. You need to customize and extend your profile system to enable such functionality (multiple profiles with same email ID).

Perform following tasks to enable this functionality.

  • In database (startersite_profile), userprofile table make sure email column doesn’t have unique key.
  • Add another column named “u_user_name” and make sure this column has unique key.
  • If there is data already exist in the table then you may get error. Make sure you don’t apply unique key during column creation. Once column is created, copy email value (or some other unique value) to this column and then apply unique constraint on this column.
  • Open commerce server manager. Navigate to Commerce server manager -> global resources -> profiles (startersite_profiles)-> data sources -> profileservice_sqlsource ->data Objects -> user object.
  • Create a data member named “user_name” and point to the column “u_user_name”.
    Open commerce server manager. Navigate to Commerce server manager -> global resources -> profiles (startersite_profiles)-> profile definitions -> user object.
  • Under general information -> add new property named “UserName” and point to data member “user_name” of data store.
  • click on general information -> email, make sure required property is set to false and keytype is set to blank.

Till now, we have done configuration changes to use user name as unique key but to make this field as login Id, we need to tell UPM provider about this change. For that, we can do configuration changes in any of the following two places.

  • web.config – By default upmprovider takes “GeneralInfo.email_address” as logon field. You need mention explicit that instead of email ID, use username.
    <membership defaultProvider=”UpmProvider”>
                <providers>
                    <add name=”UpmProvider” type=”Microsoft.CommerceServer.Runtime.Profiles.UpmMembershipProvider” logonNameProperty=”GeneralInfo.UserName”/>
                </providers>
            </membership>
  • you can pass this information in the code as part of collections.
    UpmMembershipProvider provider = new UpmMembershipProvider();
                System.Collections.Specialized.NameValueCollection collection = new System.Collections.Specialized.NameValueCollection();
                collection.Add(“logonNameProperty”,”GeneralInfo.UserName”);
                provider.Initialize(“UpmProvider”, collection);
                bool registeredUser = provider.ValidateUser(“ravi.kanth”, “pass123″);
                Response.Write(registeredUser.ToString());
     

Related Articles


If you like this post, please click on our sponsor advertisement.


Follow me on Google+
Couldn't get data from google+
Sign up for Newsletter