E-commerce customization Petr Vozak, Technical Leader
E-commerce customization Agenda 1)Using custom e-commerce providers 2)Developing custom dialog for the checkout process 3)Developing custom payment gateway
E-commerce customization 1) Using custom e-commerce providers
Using custom e-commerce providers How doest it work?
Using custom e-commerce providers Assembly: CMS.Ecommerce Namespace: CMS.Ecommerce Provider: ShippingOptionInfoProvider Method: CalculateShipping(…) public static double CalculateShipping(ShoppingCartInfo cartObj, string siteName) { if (ECommerceHelper.UseCustomHandlers()) { return ECommerceHelper.GetShippingOptionInfoProvider().CalculateShipping(cartObj, siteName); } else { return CMS.CMSEcommerce.ShippingOptionInfoProvider.CalculateShipping(cartObj, siteName); } Are custom e-commerce providers enabled? YES → Run custom code NO → Run Kentico code Wrapper
Using custom e-commerce providers Assembly: CMS.Ecommerce Namespace: CMS.CMSEcommerce Provider: ShippingOptionInfoProvider Method: CalculateShipping(…) public static double CalculateShipping(ShoppingCartInfo cartObj, string siteName) { // if shipping free limit is reached -> return zero (shipping is free) // else -> return shipping option value } Here is Kentico logic for shipping calculation, something like: Kentico code
Using custom e-commerce providers Assembly: CMS.CustomECommerceProvider Namespace: CMS.CustomECommerceProvider Provider: CustomShippingOptionInfoProvider Method: CalculateShipping(…) public double CalculateShipping(object cartObj, string siteName) { return CMS.CMSEcommerce.ShippingOptionInfoProvider.CalculateShipping( (CMS.Ecommerce.ShoppingCartInfo)cartObj, siteName); } Kentico method is called by default Custom code
Using custom e-commerce providers 1)Open Visual Studio and add CustomECommerceProvider project from code samples to your CMS solution 2)Modify code of the custom e-commerce providers to reach your requirements 3)Add the following key to your web.config file to enable custom e-commerce providers:
Using custom e-commerce providers DEMO 1)How to customize shipping calculation – customize CalculateShipping() 2)How to automatically set some credit to a new customer – Customize SetCustomerInfo()
E-commerce customization 2) Developing custom dialog for the checkout process
Developing custom dialog for the checkout process
DEMO 1)Create checkout process step user control (*.ascx) inherit from ShoppingCartStep override bool IsValid() override bool ProcessStep() 2)Register checkout process step
E-commerce customization 3) Developing custom payment gateway
Developing custom payment gateway
DEMO 1)Create payment gateway form inherit from CMSPaymentGatewayForm override bool ValidateData() override bool ProcessData() 2)Create payment gateway provider inherit from CMSPaymentGatewayProvider override void GetPaymentDataForm() override bool ProcessPayment() 3)Register payment gateway
E-commerce customization Summary 1)Using custom e-commerce providers 2)Developing custom dialog for the checkout process 3)Developing custom payment gateway