Commerce Server Blog

Build world class ecommerce applications using Microsoft Commerce Server
  •  
  • Home
  • About
  • Advertise
  • Copyright Policy
  • Disclaimer

Creating Discounts through code

ravikanth | July 28, 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

Comments
No Comments »
Categories
commerce server 2007
Tags
approve discounts, commerce server, discount, marketing
Comments rss Comments rss
Trackback Trackback

Adding Image to Profile Sub-System

ravikanth | July 25, 2008

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).

Comments
3 Comments »
Categories
commerce server 2007
Tags
add images to profile, commerce server, extending profile sytem, Profile System
Comments rss Comments rss
Trackback Trackback

Products without inventory

ravikanth | July 23, 2008

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

Comments
No Comments »
Categories
commerce server 2007
Tags
commerce server, disable inventory, inventory, no inventory products
Comments rss Comments rss
Trackback Trackback

Commerce Server 2007 Training

ravikanth | July 21, 2008

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

Comments
No Comments »
Categories
commerce server 2007
Tags
commerce server, commerce server 2007 training, commerce server hyderabad
Comments rss Comments rss
Trackback Trackback

Commerce Serer Profile System – Making user name as login ID instead of email Id

ravikanth | July 17, 2008

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());
     
Comments
1 Comment »
Categories
commerce server 2007
Tags
commerce server 2007, commerce server profile system, UPMMembership
Comments rss Comments rss
Trackback Trackback

« Previous Entries

Sign up for Newsletter


Categories

Quiz

  • Catalog Quiz for Beginners
  • Profile Quiz for Beginners
  • Quiz 1 for Advance Users
  • Quiz for Beginners

Recent Posts

  • Configuration Error: Could not load type ‘Microsoft.Commerce.Providers.SharePointCommerceOrderModule from assembly because the parent type is sealed
  • How commerce server Site Terms are stored
  • Troubleshoot: An unexpected error has occurred.
  • Design consideration for developing commerce server catalog system
  • Troubleshoot: AuthManager(CommerceServer): Error reading Commerce Server administration database
  • Account Creation Approval Process
  • Troubleshoot: Unauthorized exception when the new user tries to access MyAccount page
  • Microsoft Commerce Server 2009 code name "R2" – January 2010 Community Technical Preview
  • Merchant Access to Catalog Manager
  • Commerce Server 2009 December VPC ready for download

Archives

  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008

Tags

add discounts add images to profile Advantages of commerce server approve discounts authentication auto login process automatic user creation basket Brand Management business tools campaign management Catalog catalog import Category CategoryConfiguration cc_number checkout commerce 7 commerce server commerce server 2002 commerce server 2007 commerce server 2007 Display Types Commerce Server SP2 discounts ecommerce Estimation inventory Kanth Koppala marketing system migration error Mojave Product profile profile subsystem property metadata purchase order quick checkout Ravi Ravi Kanth site cache refresh starter site tools transactions error Variant
(c) 2009 Commerce Server Blog. All rights Reserved. Articles cannot be reproduced without permission from the author.Write to me at kanth@ravikanth.net if you have any comments, questions, suggestions about this site or would like to send us a tip
About Us | Terms of Use | Disclaimer | Advertise .