13
Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect [email protected] E-commerce Scenarios

Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect [email protected]

  • Upload
    chaman

  • View
    51

  • Download
    5

Embed Size (px)

DESCRIPTION

E-commerce Scenarios. Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect [email protected]. Agenda. Customization Model Overview B undling Product with Custom Data Customization Scenarios DEMO: Flexible shipping, DEMO: Multiple pricing level per SKU - PowerPoint PPT Presentation

Citation preview

Page 1: Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect karolj@kentico.com

Partners’ Webinar10/25/2012

Karol JarkovskySolution [email protected]

E-commerce Scenarios

Page 2: Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect karolj@kentico.com

Agenda

1. Customization Model Overview

2. Bundling Product with Custom Data

3. Customization Scenarios

• DEMO: Flexible shipping,• DEMO: Multiple pricing level per SKU• DEMO: Shared membership

Page 3: Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect karolj@kentico.com

Customization Model

• Full details available as blog and video on DevNet, and in the Developer’s Guide,

<XYZ>InfoProvider.cs

public static ProviderObject

public static <methodName>()

protected virtual <methodName>Internal()

UserInfoProvider.cs

public static ProviderObject

public static GetUserInfo(int userId)

protected virtual GetUserInfoInternal

(int userId)

Page 4: Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect karolj@kentico.com

DatabaseCOM_ShoppingCartSKU [Table]

CartItemCustomData [Column]

<customdata> <mycustomvalue3>CME Group</mycustomvalue3> <mycustomvalue2>25.55</mycustomvalue2> <mycustomvalue4>35.47</mycustomvalue4> <mycustomvalue1>Sample value 1</mycustomvalue1></customdata>

Custom Data Bundling: CustomData

API protected override ShoppingCartItemInfo AddShoppingCartItemInternal(ShoppingCartInfo cart, ShoppingCartItemParameters itemParams) { // Add item to the shopping cart ShoppingCartItemInfo item = base.AddShoppingCartItemInternal(cart, itemParams); if (item != null) { // Accepts simple data values item.CartItemCustomData["MyCustomValue1"] = "Sample value 1"; item.CartItemCustomData["MyCustomValue2"] = 25.55; // int myVal = (int)item.CartItemCustomData["MyCustomValue2"]; // Hashtable myValues = item.CartItemCustomData.ConvertToHashtable(); }

return item; }

COM_OrderItem [Table]OrderItemCustomData [Column]

<customdata> <mycustomvalue3>CME Group</mycustomvalue3> <mycustomvalue2>25.55</mycustomvalue2> <mycustomvalue4>35.47</mycustomvalue4> <mycustomvalue1>Sample value 1</mycustomvalue1></customdata>

COM_ShoppingCart [Table]ShoppingCartCustomData [Column]

<customdata> <mycustomvalue1>CME Group</mycustomvalue1> <mycustomvalue2>Sample value 1</mycustomvalue2></customdata>

COM_Order [Table]OrderCustomData [Column]

<customdata> <mycustomvalue1>CME Group</mycustomvalue1> <mycustomvalue2>Sample value 1</mycustomvalue2></customdata>

Page 5: Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect karolj@kentico.com

Custom Data Bundling: RelatedData

API // Registering for event fired when lazy-loaded RelatedData property is accessed SKUInfo.TYPEINFOSKU.OnLoadRelatedData += new TypeInfo.ObjectLoadRelatedDataEventHandler(TYPEINFOSKU_OnLoadRelatedData);

protected object TYPEINFOSKU_OnLoadRelatedData(BaseInfo infoObj) { CustomDataContainer result = null;

SKUInfo prod = (infoObj as SKUInfo); if (prod != null) { result = new CustomDataContainer() { MarketPriceSourceName = "CME Group", MarketPriceValue = 35.47 }; }

return result; }

protected override ShoppingCartItemInfo AddShoppingCartItemInternal(ShoppingCartInfo cart, ShoppingCartItemParameters itemParams) { // Add item to the shopping cart ShoppingCartItemInfo item = base.AddShoppingCartItemInternal(cart, itemParams); if (item != null) { // Accepts simple data values item.CartItemCustomData["MyCustomValue3"] = item.SKU.GetValue("MarketPriceSourceName"); item.CartItemCustomData["MyCustomValue4"] = item.SKU.GetValue("MarketPriceValue"); }

return item; }

/// <summary>/// Summary description for CustomDataContainer/// </summary>public class CustomDataContainer : IDataContainer{ // Implementation of IDataContainer members}

Page 6: Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect karolj@kentico.com

Scenarios

DEMO: Flexible shipping Scenario

• Instead of flat shipping fee specified for shipping option you want to apply different shipping costs per product (e.g. based on dimensions),

• Total shipping costs should be discounted or completely waved if certain numbers of products are added to the cart

Page 7: Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect karolj@kentico.com

DEMO: Flexible shipping

API

CMS.Ecommerce.ShippingOptionInfoProvider

ApplyShippingFreeLimit[Internal](double shipping, double totalPrice, double siteStoreFreeLimit)

o Evaluates store free-shipping limit against total price and return shipping costs,

CalculateShipping[Internal](ShoppingCartInfo cartObj)o Evaluates total shipping costs for whole cart (all items),o To implement custom shipping cost calculation you need to override this method,

CalculateShippingTax[Internal](ShoppingCartInfo cartObj)o Evaluates taxes for total shipping costs,

IsShippingNeeded[Internal](ShoppingCartInfo cart)o Indicates whether the shipping is necessary for given shopping cart,

o Returns TRUE if any of the products in the cart requires shipping (has Needs shipping setting enabled),o Bundled items are not included within evaluation.

Page 8: Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect karolj@kentico.com

Scenarios

DEMO: Multiple pricing level per SKU Scenario

• Instead of single (flat) price you want to display price customized for current visitor,

• Each product will have two price variants – variant A representing full price and variant B representing special offer price for new customers,• New visitor is unknown customer,

• Also, if visitor is exiting customer you want to add 10% discount on any product they already purchased (in last 30 days)

Page 9: Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect karolj@kentico.com

DEMO: Multiple pricing level per SKU

Page 10: Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect karolj@kentico.com

DEMO: Multiple pricing level per SKU

API

CMS.Ecommerce.SKUInfoProvider

CalculateSKUDiscount[Internal](SKUInfo sku, ShoppingCartInfo cart, IItemDiscount discount, double priceAfterDiscount)

o Calculates discount for given SKU reflecting given discount information,o Performs actual calculation using price with any previous discounts applied,

GetSKUDiscounts[Internal](SKUInfo sku, ShoppingCartInfo cart, bool forCart)o Returns list of discounts that are then applied to the base price in order they are included in the list,o Method that is performing calculation is CalculateSKUDiscount[Internal]() above,

GetSKUPrice[Internal](SKUInfo sku, ShoppingCartInfo cart)GetSKUPrice[Internal](SKUInfo sku, ShoppingCartInfo cart, string column)GetSKUPrice[Internal](SKUInfo sku, ShoppingCartInfo cart, bool discounts, bool taxes, bool forCart, string column)

o Returns price for given product,o Customizations should be done by overwriting highlighted (bold) override as both methods left are internally calling this method,

Page 11: Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect karolj@kentico.com

Scenarios

DEMO: Shared membership Scenario

• You want to assign purchased membership for all users coming from the same company/organization,

• In other words instead of single-user membership product you want to allow buying shared membership

Page 12: Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect karolj@kentico.com

DEMO: Shared membership

API

CMS.Ecommerce.OrderInfoProvider

CreateEmailMacroResolver[Internal](ShoppingCartInfo cartObj)CMS.Ecommerce.ShoppingCartInfoProvider.GetShoppingCartResolver[Internal](ShoppingCartInfo cart, bool specialMacros)

o CreateEmailMacroResolver[Internal]() is called only from OrderInfoProvider.SendEmailNotification[Internal]()

o If you want to add resolver data available across whole E-commerce module (not just e-mail templates) you need to customize CMS.Ecommerce.ShoppingCartInfoProvider.GetShoppingCartResolver[Internal](),

o CreateEmailMacroResolver[Internal]() is calling this method internally to get base resolver,

ProcessOrderIsPaidChangeInternal(OrderInfo oi)o Raised when order is paid status changes (automatically or manually from the UI) ,o Handles alternative product types (e-product, membership) and sends out e-mail notifications,o Modify if you want to send additional notifications or so, however e-product processing is customized through separate methods

(below),

ProcessMembership[Internal](OrderInfo oi, OrderItemInfo oii, SKUInfo skui, UserInfo ui, DateTime now)ProcessEProduct[Internal](OrderInfo oi, OrderItemInfo oii, SKUInfo skui, DateTime now)

o Called from ProcessOrderIsPaidChange[Internal]() based on product type,

Page 13: Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect karolj@kentico.com

General

THANK YOU!