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.
I am pleased to announce that today Microsoft has renewed my Most Valuable Professional (MVP) status in commerce server for the year FY11-FY12.
MVP award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others in Microsoft technologies. For past one year, I am actively contributing to the commerce server community. In addition, I am blogger and also assists individuals & companies with commerce server architectural advice and guidance.
This award has given me an opportunity, a recognition and motivation to continue the support to the community. Thanks Microsoft CS team & MVP India team (Abhishek Kant) by providing necessary support to achieve this award.
If you like this post, please click on our sponsor advertisement.
