OL-Commerce v2/AJAX

Author: Dipl.-Ing.(TH) Winfried Kaiser

http://www.seifenparadies.de/ajax
w.kaiser@fortune.de

© 2006 Dipl.-Ing.(TH) Winfried Kaiser, 24975 Husby


This software is based on "OL-Commerce v1.2.2.a", it is published under the "GNU General Public License".

No warranty whatsoever, expressed or implied, exists for OL-Commerce v2/AJAX!

Any usage of this software is solely in the users risk!

The user has to make sure, that he backs up his software and data before using the software,
so that he, in case of failure, can reconstruct the previous environment.


Programmers Guide

Advanced features requiring coding-standards

Mandatory coding standards

Joining the project

Using the "Sourceforge"-CVS-System

Online "Cross-Reference"

OL-Commerce v2/AJAX is a very major development step in the osCommerce => xtCommerce => OL-Commerce v1 line of products.

For one, it employs state-of-the-art, AJAX-based, "Web 2.0" functionality for the user interface. Secondly, it provides significant functional enhancements for the shop-software.


The definite development-goal for OL-Commerce v2/AJAX is nothing less then to become the world's best and most complete off-the-shelf "Open Source" shop-system!


And, at the same time, begin to restructure and streamline the existing xxCommerce-PHP-code (which has been put together by many, many different developers, with very different capabilities and different programming styles), so that further development and maintenance become better manageable. (To be honest, although a lot of effort has already been put in that area, a lot still remains to be done...)

OL-Commerce v2/AJAX offers some very advanced features, which, to the authors knowledge, can not be found in their entirety "off-the-shelf" (or at all!) in any existing "Open Source" shop-system!

OL-Commerce v2/AJAX can, nevertheless, be run transparently(!) in conventional mode, too, if it is used from a browser with no Javascript enabled!

There is only one code-base for both modes: AJAX and conventional!

These features have been implemented transparently, so that no special considerations have to be taken into account, when developing new features/enhancements for OL-Commerce v2/AJAX.

But if (and only if!), however, one stringently adheres to the (very easy!) guidelines described here.

Advanced features requiring coding-standards

Features making these guidelines mandatory are:

  • completely AJAX-based user interface
     
  • AJAX-based online data-validation
     
  • AJAX-based products-attribute management
  • Allowing the use of ADODB as a database layer for broadening supported database systems on top of MySQL.
  • Allowing a database-table-prefix (which allows multiple shops in one database)
  • "Multi-Shop"-function
    (Multiple shops can be driven by only one(!) software installation)
  • "Multi-Database"-function
    (A shop can use 2 different databases (on the same server), which allows having one common (products oriented) database, and many individual (customers and orders oriented) client databases. E.g.: a wholesale company or manufacturer manages a products database (common part), and offers its resellers individual shops of their own.)
  • Using the "Cool-Menue"-module for using a DHTML-menu instead of the xxCommerce static menu for navigation
  • "On-the-fly"-picture generation
    (Only the master picture needs to be stored on the server, all other product pictures are created as needed)
  • Sophisticated search-engine-optimized (SEO) URLs
    (The usual dynamic xxCommerce link-URLs are converted to static "xxxxx.htm"-links -like: seo-k-seifen-aloe_vera_seifen.htms)

Mandatory coding standards

All these functionalities will be automatically available to any module (both for user- and admin-mode modules), if (and only if!)

  • database-tables are referenced only by their defined constants ("TABLE_XXXXXX")
    (If new tables need to be integrated, an accordingly defined constant must be established in the module "includes/database_tables.php"!)
     
  • database-access is only made via the "olc_db_xxxxxx"-functions
     
  • images are only created with the "olc_image"-function
     
  • form-elements are only created using the "olc_draw_xxxxx"-functions
     
  • links are only created using the "olc_href_link"-function
     

By the way, this is good programming practice anyway! (But, unfortunately, this was not respected consistently throughout the xxCommerce-software, so it was a major effort, to implement and reinforce this structure in the existing code.)



Finally, the existing codebase of OL-Commerce v1/xtCommerce v2/osCommerce v2 has been completely(!) restructured in some areas:
  • the 12-odd different(!) ways of entering and verifying customer-data in the admin and user area have been reduced to just 2(!) modules (display ("inc/olc_show_customer_data_form.inc.php") and verification ("inc/olc_get_check_customer_data.inc.php")) and one (!) template (making changes in these areas manageable, and consistent)
     
  • the 10-odd different(!) ways of preparing various products lists have been reduced to just 1(!) module ("inc/olc_prepare_products_listing.inc.php") and one(!) template (making changes in these areas manageable, and consistent)
  • The script-structure has been streamlined, concentrating many repetitive functions now in central modules, making the scripts more readable an maintainable.
  • For strings, that are used many times all over the place as literals, constants are now defined. This for one enhances readability, and also avoids the multiple declaration of the same literals in the course of the program.
    (See: "includes/modules/application_init.php" for current definitions. ("includes/modules/application_init.php" is used from both user- and admin-programs.))
  • For (new) admin-scripts a new framework has been devised, which handles all the necessary system framework (including the use of AJAX in the admin-area, once the file upload-problem is solved), so the programmer can concentrate on his real application job.

The new "admin"-program framework is used as follows:

Build your application's net(!) HTML-code in the variable "$main_content".
(Do not(!) use "echo" any more in an admin-program, but build the complete application's HTML-code in this variable!!!!)

At the end of your application module include the following code:

 
 

$page_header_title='Your modules title';
$page_header_subtitle='Your modules sub-title';
$page_header_icon_image=The_icon_to_use;
$no_left_menu=true;                  //Display the "left" menu (application functions)
$show_column_right=true;        //Display the "right" admin-menu ("Configuration")
//(If both "$no_left_menu" and "$show_column_right" are set to "false", you will have the full screen available without any menues!)
require(PROGRAM_FRAME);

 
 

"$main-content" only needs to contain the applications' HTML, not the complete page HTML!!!

That is all there is!

You can even use "Smarty" to render your applications HTML-code into "$main-content"!

An instance of "Smarty" is available as "$smarty" also in the admin area. All "admin" Smarty-templates have to be stored in "templates/xxxxx/admin".

All "admin"-programs (existing or new) refer to the "stylesheet.css" in "templates/xxxxx/admin". The buttons used in the admin area have also been transferred to "templates/xxxxx/admin/buttons/(language)", so that also the admin-area now can take on different "looks".

Compare this to the (it must be said: "brain-dead") way of doing admin-programs so far!
(Each and every module carries not only its application payload, but also the complete, ever-repeating, page-framework. (Frame, Header, menu, footer.))


Joining the project

If you are interested to help create the world's best and most complete "off-the-shelf" "Open-Source" shop-software, please join the project as a developer!

Join here!

Send an eMail (via sourceforge) to the adminstrator, indicating your sourceforge-USERNAME(!).

Also, please indicate your level of experience with PHP, JavaScript, AJAX, MySQL, ADODB and xxCommerce-Software, your fluency in English and German, and what development tools you will be going to use.

Your request will be thoroughly reviewed, and you will be notified, once it has been accepted.
 


Using the "Sourceforge"-CVS-System

Once you have joined the project as a developer, and have been granted access to the CVS-repository, you can start using it.

For WINDOWS, a good CVS-manager is WINCVS (http://www.wincvs.org/).

You can also use other programs, to manage the CVS (e.g. Zend Studio, Eclipse).

A good tutorial an how to use Zend Studio with the sourceforge CVS can be found here: http://www.weberdev.com/ViewArticle/415.
(
This might be a good starting point for other managers, too!)

A quick WINCVS reference can be found here: http://www.thathost.com/wincvs-howto/.

The concepts described here are sure valid for other CVS management Systems, too.

When checking out the sourcecode from the sourceforge CVS, please make sure to use the path "olcommerce" branch tagged "olcommerce_2_0_0", which is the starting-point for all further OL-Commerce v2/AJAX development.

It is of utmost importance, that the integrity of the CVS-repository is maintained.

So please make sure, that you really understand, what you are doing, if you make modifications to the  CVS-repository!
 


Online "Cross-Reference"

A detailed online "Cross-reference" of OL-Commerce v2/AJAX as of 18.12.2006 is available here!

With its help, you will better find your way around this (increasingly complex) system.