Totally geeked out over my latest project: MiniCommerce Ecommerce plugin for Mura

Meld MiniCommerce , Meld Solutions , Mura CMS , Mura Plugins Add comments

Over the last few years I've devoted a lot of my development hours to building on top of the Mura CMS. During that time there has remained a bright and burning point of desire in the Mura community (and myself) for one key ingredient: Ecommerce. I've developed a couple of proprietary solutions, but never anything that was going to be flexible or configurable enough for general use. Until now, that is.

My latest project (Meld MiniCommerce) has finally provided Mura a full-cycle Ecommerce solution via a custom plugin. Now, before I get you too excited I should point out this isn't exactly a storefront application (hence the 'Mini' bit). Instead it is a kind of Ecommerce 'engine' that adds a product-agnostic shopping cart to Mura, which can then be processed through an online merchant like PayPal. Now, before I get you too disappointed (apologies for playing ping-pong with your emotions), installation of the plugin does allow you to instantly add configurable products to Mura, let people 'add to cart' them and then proceed to the checkout. This is only the smallest part of the plugin's functionality ... let me explain.

Mura and Page / Product

The first thing installing the MiniCommerce plugin will do is add a Class Extension to the Mura page called "Product". By creating a "Page / Product" in the Mura Site Manager instead of just a regular "Page", you basically turn the page into a purchasable product. MiniCommerce will automatically render an 'add to cart' form on the page, and the Class Extension variables like "Price", "Use Quantity" etc. will allow you to configure a basic product. The real power of this page comes in three parts: custom includes, custom Renderers, and Mura Events.

Product Type + Includes & Renderers

It is possible and in fact very easy to replace the basic "choose quantity/add to cart" form with one that contains custom attribute like size, color, edition, style, etc. The shortest route to doing this is by adding a new directory in the Mura /[siteid]/includes/display_objects/custom/ folder called 'meldminicommerce'. By placing a cfm file in here named product_[producttype].cfm, you can create a product template for a specific type of product. Take, for instance, a product type of "T-shirt". I can copy the default product template located at /plugins/[MiniCommerce]/includes/product_default.cfm and paste it into /[siteid]/includes/display_objects/custom/product_tshirt.cfm. I can then add the following code:

By using the by-convention format of adding "attributes_" to my form field, MiniCommerce will realize that this is an attribute of the product. These values are automatically parsed out of the submitted form and stored as a JSON object with the product.

What's even cooler (sorry if I tend to geek myself out a little bit here) is that MiniCommerce will take any attributes added to the cart and convert the set into a unique but consistent UUID called 'attributeID'. In other words, a t-shirt with color: blue / size: Large will have a distinct but different attributeID to one with color: black / size: Large. This allows for consistency when adding and updating products to the cart. If somebody adds 3 white/Large shirts to the cart, then later adds 2 more, the combination of productID/attributeID will result in one record of 5 white/Large shirts rather than one of 3 and another of 2. This can be very important when adding specifically customized products and managing orders on the back-end.

If custom includes aren't your thing, then you can instead use a Mura Renderer to replace the product form. By listening for the event onPageProductBodyRender a developer can replace the form dynamically. All of the associated variables (productID, userID, etc.) are passed in the event, and the developer can then dynamically generate the replacement form.

Events & Renderers

In fact, MiniCommerce is built entirely around the concept of Mura Events and Renderers, with substitute includes thrown in for good measure (i.e. easy-access coding). Every part of the MiniCommerce front-end, from product forms to the cart and checkout to the receipts, can be replaced via Events and Renderers. Need a new form field added to the checkout form? Add a onMeldMiniCommerceRenderPaymentForm event listener. Need to adjust the discounts on a specific product? Use the onMeldMiniCommerceRequestDiscountInfo event to peer into the cart bean and quickly set your cart product's discount value. We tried to make every aspect of MiniCommerce as flexible and replaceable as possible, right down to the multiple 'transaction complete' notifications (web, customer and site owner).

It's this flexibility, combined with the next concept, that makes MiniCommerce as much an Ecommerce 'engine' as it is a shopping cart.

MiniCommerce as an 'Engine'

Imagine you have a client that want's you to build them a conference manager. They are going to handle room reservations and membership sign-ups, and will want to sell a few pieces of small merchandise like hats and shirts. MiniCommerce will allow you to turn what seems like a long path with multiple checkout streams into one cohesive process for the site users. The MiniCommerce cart operates in a state of 'blissful ignorance', in that it has absolutely no idea or interest in the type of product that it contains, other than it follows a couple of basic rules (has a productID, a quantity, and a price) and that when asked for the details of the product are filled in by the respective owner.

For instance, if a user added a hotel reservation, signed up for the "Premium" conference package, and purchased a couple of conference mugs, each part of the developer's application would simple fire off an onMeldMiniCommerceAddProduct event that contained either the product basics (productID, quantity, price, and a moduleID for back-reference) or the productBean 'helper' bean included with MiniCommerce. Whenever the user views the cart, MiniCommerce in return issues an onMeldMiniCommerceGetCart event that expects the product-owning applications to peer in, find their products, and fill in the details like title, summary and any tax/discount/shipping details. When the transaction is complete, MiniCommerce will issue a final onMeldMiniCommerceTransactionComplete event that contains all the transaction details. The Conference Manager application could then act upon each product as required, in this case by perhaps sending the hotel the registration information by Email, adding the user to a specific Mura User Group, and leaving the humans on the receiving end of the transaction notification Email to deal with the Mug order.

Download Now!

MiniCommerce is available for download now. We are dual-licensing Meld MiniCommerce, so it is available as a free (as in beer) GPL 2 licensed application, as well as providing it under a commercial license for organizations that cannot or perhaps just don't wish to integrate GPL code into their business. You can download the Beta version of MiniCommerce at meldsolutions.com. We have also created a special community support forum for the plugin, so if you have any questions or discover any bugs, please let us know. Documentation is a bit sparse for now (we felt it was better to get it out now rather than sit on it while we write volumes of helpful examples) but that will improve over the coming weeks.

Enjoy, and I hope you find it useful.

1 response to “Totally geeked out over my latest project: MiniCommerce Ecommerce plugin for Mura”

  1. David Says:
    Looks awesome, Grant! Will check it out soon.

Leave a Reply

Leave this field empty:

Powered by Mango Blog. Design and Icons by N.Design Studio
Clicky Web Analytics