5 Days of Mura Plugins: Day 3 - Coupons for MiniCommerce
Day 3 of "5 Days of Mura Plugins" brings us to Web Coupons for Meld MiniCommerce. MiniCommerce is a deceptively powerful eCommerce engine for Mura, and this should work as a demonstration for developers looking to build it into their own plugins ... or at least just add coupons to their online stores!
We built Meld MiniCommerce itself as both a test to see how far you could take Mura Events and Renderers, and to add much-requested eCommerce functionality to our favorite CMS. MiniCommerce exists as a sort of shopping cart 'core' that external plugins (or even regular Mura pages) can add products to via custom Mura Events. It worked out so well that MiniCommerce is going to be the basis and core engine for our much larger, full-featured Meld Ecommerce application coming later this year.
Adding products to the cart is only part of its magic, however; it is also easy to build custom discount, shipping and tax calculations into the cart process. Today's plugin will do just that.
Functionality
Our plan is to build a standalone plugin that coordinates with the MiniCommerce checkout process to:
a) add a 'coupon' field to the standard checkout form
b) check the coupon to see if it is valid
c) apply the discount to the cart
d) record that the coupon has been used
The Coupon plugin won't have to alter MiniCommerce at all, just use Mura Events, Renderers and custom templates to get the job done (we may, of course, take the opportunity to enhance MiniCommerce if we discover an easier or better way of getting it all to work together).
And again, we'll update this post throughout the day with progress reports, and the plugin will (hopefully!) be ready for download by the end of the day.
[update: 12:59 PM 09/02/2011]
Most of the groundwork is done, but because I want this to be a good example for other developers to extend MiniCommerce, I'm going to put a bit more polish on the admin area and in the code.
For reference, the way coupons will work is you 'generate' a coupon code, state how many times the code is good for, and then distribute the code as you see fit. It should work as a good base for somebody who wants to develop a more automated system or just learn how to incorporate custom discounting.
[update: 5:59 PM 09/02/2011]
Sometimes it's just too hard to say 'enough' and stop tinkering with the features. So, with that in mind, we are done! You can now download the Meld MiniCommerce Coupons plugin for Mura. As always, let us know if you have any questions or find any issues with the plugin.
Tomorrow we will continue with our "5 days of Mura CMS plugins" series.
» download the Meld MiniCommerce Coupons plugin
Comments
- Jas Panesar
-
I still object to you calling it MiniCommerce.
It's more MediumCommerce with all the built-ins.
Web coupons will be a welcome addition!
- February 9, 2011, 1:52 PM
- Grant
-
@Jas, yes, we are getting that comment a lot. Perhaps I will consider changing the name to better reflect it's purpose and utility.
- February 9, 2011, 3:16 PM