Techemistry Blog

DNN Custom Modules - Locations, Simple Product Catalog, Form Builder and more

5/20/2013 8:35:00 PM -- Ted Krapf

As I work with clients I come across special needs that the client will require on their website.  I want to remind everyone that I can custom build basically any functionality for your website.  Most of my clients are using the DotNetNuke CMS platform, and I've built a nice set of custom modules to help my clients get the results they need.  Here are a few of them . . .

MultiForm DNN Module
Everyone needs forms!  Whether it's a contact form, an employment application form, a request for quote form, a survey, a comment, a question, or anything else.  After looking at a myriad of options in the DNN store, I just couldn't find what I needed at a price that seemed reasonable.  I needed flexibility to make the forms I wanted and have it simple enough that a layperson could manage the tool themselves.  I'm all about empowering my clients instead of wasting time and resources on simple tasks they know they could accomplish quicker than the time it took to call me about it.  

So I created the MultiForm DNN Module.  Essentially it is a DNN Module that creates a form that can be easily created, styled, submitted and then the results emailed to an address of your choice.  You select the type of fields you want, the labels for those fields, decide if you'd like a file upload/attachment option or Captcha, set the TO:Email address, save and you are done.  I've provided this form module countless times now to clients and they can usually set it up themselves in just minutes.  Here's a screen shot of the settings screen to show you how simple it is:

Easy, right?

Location Locator DNN Module
Another common request I get is, "I want a user to be able to enter their ZIP code or GPS and see our branch location that is closest to them".  While at first this task seemed trivial, the math behind it was not.  At first glance, I thought, "this is easy, I can get the GPS coordinates of the user's ZIP code or phone location and subtract the distance from the brick and mortar locations and then output them in order of nearest to furthest."   As I read and thought more about how to calculate the distance between two points, I realized that, "Copernicus and others noted that the Earth is round and not flat. DUH!"  In other words, when calculating the distance between two points on Earth, you need to take the curvature of the Earth into consideration for the calculations to be more precise.  

Okay, so that might sound crazy, but think of it this way on a very small scale.  If you had a basketball and you measure the distance from point A on one side of the ball to point B on the opposite site of the ball, the distance (half the circumference of a regulation NBA ball) would be ~14.75".  Now if you measured a straight line through the basketball from point A to point B, you'd get 9.39" (the diameter of the ball).  That's a big difference, especially if you think about scale -- the earth is about 53.4 MILLIONS times bigger than a single basketball.

Long story short, to calculate the distance between two points on Earth, you must take the curvature of the Earth into consideration.  The math equation in C# looks a little like this: 
radius * 2 * Math.Asin(Math.Min(1, Math.Sqrt((Math.Pow(Math.Sin((DiffRadian(lat1, lat2)) / 2.0), 2.0) + Math.Cos(ToRadian(lat1)) * Math.Cos(ToRadian(lat2)) * Math.Pow(Math.Sin((DiffRadian(lng1, lng2)) / 2.0), 2.0)))))

The good news is, after figuring that out, some simple skinning, some custom Geo-Coding functions (to provide longitude and latitude coordinates for a physical address), and a nice DNN Module Settings GUI, I was able to package a very simple and easy to use Location Locator DNN Module for my clients.  Once installed, it asks where you are, runs the numbers and spits out the closest location(s) to you.  The end result is a DNN Settings screen looks something like this:

I've also built a variety of online catalog tools that can sync with Sage and other 3rd party inventory control software.  Or, if you work with software that allows you to export your products to excel or CSV (comma separate values), my online catalog tools can work for you as well.

If you are interested in any of these modules for your site or looking for an overhaul, please contact me.  All of my modules are available for purchase at reasonable rates with the source code included.



[return to articles list]