Commerce Server 2009
A promotion code, also know as a coupon code, is a code that is associated with a marketing discount. For example, business might give premium customers to enter the promotion code "DIS20P" to receive a 20% discount on their whole order. One or more unique promotion codes are associated with the discount. One of our customer wants to implement single coupon promotion code feature (similar to private coupon code). A single use code is a promotional code that applies to an order with a particular SKU in it. Customer will provide the promo code to the user on each day during the campaign that will allow them to order a free product for the given SKU. Once the order is placed the promotional code can no longer be used.
When the user lands into the site, we are creating an unregistered basket to him . User enters products into the basket, provide promotion codes & decide to perform checkout. Now we are converting the unregistered basket to register basket (moving data from old basket to new basket). Since the promotion code has usage limit as one and in such scenario the promotion code is not be used in new basked as it is already used in other basket. This is by design & feature/limitation of the commerce server.
I went ahead and tweaked the commerce server by introducing a custom stored procedure which will perform some action that will make the new basket accept the promotion code. When such scenario happens, I am decrementing the promotion reserve count & updating the promo history with new basket id. Below is the SQL code.
|
CREATE PROCEDURE [dbo].[TransferPromotionCode] @PromotionCode NVARCHAR(100), @BasketId UNIQUEIDENTIFIER AS BEGIN DECLARE @PcId INT SELECT @PcId= i_pc_id FROM mktg_promocode WHERE u_pc_code = @PromotionCode UPDATE dbo.mktg_promocode_transactions SET i_pctrans_reserved_count = i_pctrans_reserved_count -1 WHERE i_pc_id = @PcId DELETE dbo.mktg_promocode_history WHERE guid_pchist_basketordergroup_id = @BasketId AND i_pc_id = @PcId END |
If you like this post, please click on our sponsor advertisement.
After configuring the default site using SharePoint Commerce Services Configuration Wizard tool & when I try to browse the application, the application throws back a wired exception & it says “The module ‘SharePointCommerceProfileModule’ depends on the site resource ‘Biz Data Service’ which does not exist in the Commerce Server administration database.” (as shown below).
After analyzing, I found that this is due to not proper configuration of profile system. I suspect there might be a problem with the tool while configuring profile resource. When I saw the application in commerce server manager, profile catalog is not seen (as shown below).
RESOLUTION : Add commerce server profile resources manually.
- Open commerce server manager.
- Deleted Profiles and CS Authentication from commerce server site.
- Right click site node and Add Resource.
- Select MicrosoftCommerceDefaultSiteNoData.pup and click ok
- Select CSAuthentication and Profiles, add them.
After creating profile resources, the site started working property.![]()
If you like this post, please click on our sponsor advertisement.
After installing commerce server , sometimes you will notice that your event log is flooded with lot of commerce server performance counter errors. The exception is shown below
|
Event Type: Error Description: |
These are CS2007 Performance Counters. You can either ignore these event messages or attempt to unregister/re-register the CSPerfCounters.dll (found in c:\program files\common files\Microsoft shared\enterprise servers\commerce server folder) which will solve the problem. You should be able to use the regsvr32 /i command to register the DLL.
If you like this post, please click on our sponsor advertisement.
Yesterday, I faced very wired issue. I got crazy & doubt my code why it is not working
. I extended line item as mentioned in my blog – Steps involved in extended commerce server 2009 Systems. When I run the code in Extended line item class, I am getting wired error in GetObject() method. The error is
“Member NewColumn was not found”.
The newColumn in the exception message is the newly added column to the line item table/class. I verified that the column already present in database, OrderObjectMapping.xml, OrderPipeline xml, translator, entity & extended line item but still I am getting the error. I thought this can be an environment issue & I have tested my code on my peer box & found the same issue is repeating. For some time I doubt whether I have done all the code changes properly.
After analyzing for some time, I found the root cause. If you already have LineItem objects in the database (for example baskets), when these objects are deserialized as instances of the Extended LineItem class, they will not have a value for the newly column property. In my system, I have many user baskets & these user baskets doesn’t have newly added columns as the baskets are weakly type & are before extending line item. If any change to the schema, commerce server will not modify it & only option left for me is to delete the baskets from my database.
| USE StarterSite_Transactions GO DELETE OrderTemplatesAndBaskets GI |
Once changes are done, my application is working fine. If you want to overcome this problem & effectively address them in production then better to keep try catch for all variables access in GetObject() method (sample shown below).
| protected ExtendedLineItem (SerializationInfo info, StreamingContext context) : base(info, context) { try { NewColumn = info.GetString("NewColumn"); } catch (SerializationException se) { NewColumn = "No Description"; } } |
If you like this post, please click on our sponsor advertisement.
Suddenly my customer & orders Manager application "crashed" when opened on the client’s workstation(no error displayed) . It way working last night but today when I try to open the customer & order manager, it crashes & it will log 102 error code in the event log. You may not get out of this error if you re-install .NET framework or business tools.
You should remember one thing, that for the first time when the user try to open customer and order manager tool it creates a user config xml file. This user.config file contains all connection strings and parameters necessary for the business app to function. Once you add a connection string to
the appropriate web services, this information is stored in the user.config file. For every user which users customer & order manager tool from that machine, a separate user.config file created on that machine. Every time the user start the business app, it will utilize the information in this file for startup and initialization. If this file gets corrupt, then the app will have problems with the information within. When you un-install .NET framework or business tools this file is not removed/deleted, which could explain why removing and re-installing does not clear the problem.
To fix this issue, the computer needs to have Visual Studio’s command line utility on it. If so, follow below steps
- Open Visual Studio’s Command Prompt
- Change to the \Documents and Settings\<User ID>\Local Settings\Application Data\Microsoft Corporation directory (example: cd c:\documents and setting\ravi\local settings\application data\Microsoft corporation where ravi is my sample user id)
- Change to the directory CustomerAndOrdersManager… (example cd \customerandorders*)
- Change to the directory 6.0.1.0 (example cd \6.0.1.0)
- Either rename (ren user.config temp.config) or delete (del user.config) the user.config file within this directory.
- Startup the Customer and Orders Manager Business Application. It will create a new blank user.config file.
Hope this will resolve your problem.
If you like this post, please click on our sponsor advertisement.
