Jump to content

Best approach to formatting "modules" for an eCommerce app


techtheatre

Recommended Posts

I am currently designing an eCommerce app.  I know, there are lots of really good ones out there already...but all of them have LOTS more functionality than i really need, and they tend to confuse people by offering TOO MUCH info.  So i am trying to build a very simple, straight-forward system.  I have gotten the basic cart and databases all set up, but i want to set up "modules" that can simply be copied into a directory on teh server and instantly begin affecting the functionality of the site.  I have seen similar things in osCommerce for example, but even there it requires some management.  I am looking for ideas on teh best way to structure the files and how to integrate things, etc.  Here is what i am thinking so far (but i have not started writing modules, so i am open to any and all suggestions):

 

I have a sub-directory called "modules" (clever...huh...).

 

I have already written a simple function that returns to me the name of all directories within this modules directory.

 

My plan is for each module to be completely self-contained within one of these directories.  The directory name would indicate what the module does (example:  "shipping_usps" or "billing_paypal" ).

 

I think I will have an index.php file that returns a header 404 just to throw off anyone looking for it.  Then i was planning to have a file that contains the real "guts" of the module.  Let's call it "actions.php" just for example.  Within actions.php (for every module) i will set some variables such as:

$ModuleTitle (Calculate USPS Shipping Rates)

$ModuleType (shipping, billing...)

(some others that i need your suggestions for)

 

At this point i don't knwo where to go next.  I assume that the best thing to do is to create some functions, maybe using the directory name as the same as the function name [  example: shipping_usps_main() and shipping_usps_admin()  ].  Then i can write a script to REQUIRE_ONCE() the actions.php file from all module directories and call the function name in teh right places in my code...

 

Anyway, i am just thinking out loud here...i have never tried to write anything modular like this before.  The idea is the the base cart script will be modified to use any new modules that are developed, but the module will only be used ("installed") if the directory is present.  This way, if someone wants to add some new functionality to their existing copy fo the cart, they simply download the new "engine" scripts and whatever current modules they want.

 

Any and all thoughts or links to ideas are very much appreciated.  If you have dome something similar  before and are willing to share the code you used for one or more modules, please let me know where to locate that.  THANKS!

 

Link to comment
Share on other sites

if i were you, i'd build a CMS for an eCommerce CMS. basically, you, the programmer, can login to an interface with a list of all the possible features or 'modules' that you can have with an eCommerce site. you check all the ones you want and click submit. this will create a directory and drop all the files needed into that directory for your clients to use for administration and public browsing pages.

Link to comment
Share on other sites

True that that method would work, and is commonly used...but i want to be able to simply drop in a module directory and have it start working just by being there.  This way if people want to upgrade their site functionality, all they have to do is download one directory with 2-3 files in it and dump that on the server.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.