Presentation is loading. Please wait.

Presentation is loading. Please wait.

Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect E-commerce Scenarios.

Similar presentations


Presentation on theme: "Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect E-commerce Scenarios."— Presentation transcript:

1 Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect karolj@kentico.com E-commerce Scenarios

2 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

3 Customization Model Full details available as blog and video on DevNet, and in the Developer’s Guide,blogvideoDeveloper’s Guide InfoProvider.cs public static ProviderObject public static () protected virtual Internal() UserInfoProvider.cs public static ProviderObject public static GetUserInfo(int userId) protected virtual GetUserInfoInternal (int userId)

4 Database COM_ShoppingCartSKU [Table] CartItemCustomData [Column] CME Group 25.55 35.47 Sample value 1 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] CME Group 25.55 35.47 Sample value 1 COM_ShoppingCart [Table] ShoppingCartCustomData [Column] CME Group Sample value 1 COM_Order [Table] OrderCustomData [Column] CME Group Sample value 1

5 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 description for CustomDataContainer /// public class CustomDataContainer : IDataContainer { // Implementation of IDataContainer members }

6 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

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

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

9 DEMO: Multiple pricing level per SKU

10 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,

11 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

12 DEMO: Shared membership API CMS.Ecommerce.OrderInfoProvider CreateEmailMacroResolver[Internal](ShoppingCartInfo cartObj) CMS.Ecommerce.ShoppingCartInfoProvider.GetShoppingCartResolver[Internal](ShoppingCartInfo cart, bool specialMacros) oCreateEmailMacroResolver[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](), oCreateEmailMacroResolver[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,

13 General THANK YOU!


Download ppt "Partners’ Webinar 10/25/2012 Karol Jarkovsky Solution Architect E-commerce Scenarios."

Similar presentations


Ads by Google