Commerce Server: Multi-Channel E-tail - Targeting Discounts to 1 Store
You need to support multiple e-commerce stores and simply rebrand each store with it's own theming, CSS, etc. while sharing all of the business logic you have written in your business layer. Your stores (www.a.com, www.b.com, www.c.com) all share the same catalog,inventory and checkout. However, you want to give your business users the ability to target discounts to a particular store or select stores.
Depending on your requirements, you could implement this with 1 CS site and an IIS application per each store. Each application will share the site's resources (profiling, transactions, marketing, catalog, inventory).
In such an implementation, by default any discount you create will appear on all stores. To target particular stores, we just need to do a little extra work.
1. Create a profile definition called StoreTargeting which points to a SQL table called StoreTargeting.
2. Give the StoreTargeting table a StoreID and Description.
3. Populate StoreTargeting table w/ store data.
4. Open Marketing Manager.
5. Go to “Set Targeting Profiles” and add StoreTargeting as a targeted context.
6. Create Global Expressions for each store.
Name Field Condition Value
www.b.com StoreTargeting.StoreID Is equal to B
www.c.com StoreTargeting.StoreID Is equal to C
7. Create a discount called “www.a.com Only – 10% Off”.
8. Under the eligibility tab, add the “www.a.com” global expression.
9. Create a discount called “www.b.com Only – 20% Off”.
10. Under the eligibility tab, add the “www.b.com” global expression.
11. Create a discount called “www.c.com Only – 30% Off”.
12. Under the eligibility tab, add the “www.c.com” global expression.
13. Add the following to your web.config
<!—Store # -->
<add key="StoreNumber" value="A"/>
14. Put this code just prior to the Basket.pcf execution.
// Get the Store # from the web.config
string storeNumber = System.Configuration.ConfigurationManager.AppSettings["StoreNumber"];
// Get the Store Targeting Profile
Profile storeTargetProfile = CommerceContext.Current.ProfileSystem.GetProfile(storeNumber, "StoreTargeting");
// Add the Store Targeting Profile to the pipeline’s profiles collection.
using (PipelineInfo pipeline = new PipelineInfo(“basket”, OrderPipelineType.Basket))
// Execute the pipeline
PipelineExecutionResult result = basket.RunPipeline(pipeline);
15. Try out each discount under each IIS application. You will of course need to set the Store # appSetting to the appropriate value. When you access www.a.com, you will receive a 10% off discount but not when you access www.b.com or www.c.com.
Comments and feedback are very much welcome.