Thursday, May 2, 2013

Orchard CMS, Magelia WebStore & Credit Card Processing

I recently became the project manager for a fully integrated CMS and eCommerce solution.  After reviewing  possible options, I selected Orchard CMS(www.orchardproject.net) with a Magelia WebStore (http://www.magelia.org/) integration.

I was able to get both solutions installed without to much trouble using Microsoft Web Platform Installer.  Magelia provides some decent documentation on their website on how to integrate both solutions but their credit card processing documentation is non-existent.

After emailing back and forth with the Magelia CEO and development team, I now have a good understand of how it works and have documented their undocumented API which i am posting here including an overview of the solution.

Overview:

  • Once you have installed both Magelia and Orchard and have integrated both products via the Magelia website tutorial (Found Here) you should be able to see products, add them to your cart and begin the checkout process.  
  • Once you get to the end of the process you will get the following error:  "Override this view (DisplayTemplates\Checkout\ProceedToPayment.cshtml) in your theme in order to submit payment data to the payment provider of your choice/". see example below:


ProceedToPayment.cshtml
  • Magelia provides an Orchard theme based off the default theme to make Paypal the payment gateway for the stores (Found Here).  If we want to use any other payment gateway we will need to override this theme.  It can be downloaded or install manually using the link above OR you can goto the theme gallery in Orchard and install it using the interface (recommend).  
  • At this point you can edit the theme directly in notepad.  I have Visual Studio and so i wanted to create a VS project.  Orchard has a great system for generating theme templates which visual studio project solutions. To do so you need to use the Orchard Command Line interface (More Info).  
  • Once the Orchard CLI is running execute the following command
    • codegen theme MyTheme /BasedOn:TheThemeMachineWithPaypalForMageliaWebStore /CreateProject:true /IncludeInSolution:true
  • This will create a new theme with a visual studio project file in it.
  • modify {IIS SERVER}\Orchard\Themes\MyTheme\Views\DisplayTemplates\Checkout\ProceedToPayment.cshtml and implement your credit card processing logic using Razor syntax.

Once complete you will need to log into orchard and apply the theme to your site.

Post questions below

Phoenix

I am resurrecting this tech blog for notes related to Azure Logic Apps with SAP.