170 likes | 377 Views
E-commerce customization. Petr Vozak, Technical Leader. E-commerce customization. Agenda Using custom e-commerce providers Developing custom dialog for the checkout process Developing custom payment gateway. E-commerce customization. 1) Using custom e-commerce providers.
E N D
E-commerce customization Petr Vozak, Technical Leader
E-commerce customization Agenda • Using custom e-commerce providers • Developing custom dialog for the checkout process • Developing custom payment gateway
E-commercecustomization 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 doubleCalculateShipping(ShoppingCartInfocartObj, stringsiteName) { if (ECommerceHelper.UseCustomHandlers()) { returnECommerceHelper.GetShippingOptionInfoProvider().CalculateShipping(cartObj, siteName); } else { returnCMS.CMSEcommerce.ShippingOptionInfoProvider.CalculateShipping(cartObj, siteName); } } Wrapper Are custom e-commerce providers enabled? YES → Run custom code NO→ Run Kentico code
Using custom e-commerce providers • Assembly: CMS.Ecommerce • Namespace: CMS.CMSEcommerce • Provider: ShippingOptionInfoProvider • Method: CalculateShipping(…) public static doubleCalculateShipping(ShoppingCartInfocartObj, stringsiteName) { // if shipping free limit is reached -> return zero (shipping is free) // else -> return shipping option value } Kentico code Here is Kentico logic for shipping calculation, something like:
Using custom e-commerce providers • Assembly: CMS.CustomECommerceProvider • Namespace: CMS.CustomECommerceProvider • Provider: CustomShippingOptionInfoProvider • Method: CalculateShipping(…) public doubleCalculateShipping(objectcartObj, stringsiteName) { returnCMS.CMSEcommerce.ShippingOptionInfoProvider.CalculateShipping( (CMS.Ecommerce.ShoppingCartInfo)cartObj, siteName); } Custom code Kentico methodis called by default
Using custom e-commerce providers • Open Visual Studio and add CustomECommerceProviderproject from code samples to your CMS solution • Modify code of the custom e-commerce providers to reach your requirements • Add the following key to your web.config file to enable custom e-commerce providers: <add key=“CMSUseCustomEcommerceProviders” value=“true”>
Using custom e-commerce providers DEMO • How to customize shipping calculation • customize CalculateShipping() • 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 • Create checkout process step user control (*.ascx) • inherit from ShoppingCartStep • override boolIsValid() • override boolProcessStep() • Register checkout process step
E-commerce customization 3) Developing custom payment gateway
Developing custom payment gateway DEMO • Create payment gateway form • inherit from CMSPaymentGatewayForm • override boolValidateData() • override boolProcessData() • Create payment gateway provider • inherit from CMSPaymentGatewayProvider • override void GetPaymentDataForm() • override boolProcessPayment() • Register payment gateway
E-commerce customization Summary • Using custom e-commerce providers • Developing custom dialog for the checkout process • Developing custom payment gateway