Grokking Drupal : e-Commerce

Submitted by Frederic Marand on

UML class diagram thumbnail for Drupal e-Commerce 4.6 For anyone trying to understand the inner working of the Drupal e-Commerce 4.6.* module, a pair of UML data model diagrams should be really helpful.

As the upcoming sites for OSInet, Riff News and a few others are supposed to be based on the Drupal CMS, I've started diving into the Drupal data model, especially for the e-Commerce module part.

Here is a pair of data model diagrams for this Drupal functionality:

A couple of warnings are in order, though:

  1. As I'm currently in the process of learning Drupal, the diagrams may contain errors. Use at your own risk !
  2. The diagrams are based on the 4.6.2 code base, and are subject to change. At the very least, the country attribute in ec_addresse_base is changing from int(11) to char(2) in a recent patch and future release.
  3. The diagrams represent an object-oriented view of Drupal, but the code does not make use of the object features in PHP. This means that the diagrams do NOT represent the actual physical database implementation, either MySQL or PostgreSQL, but a higher-level view.
  4. This is apparent in the *_base classes. These are not part of the actual Drupal code, but represent abstractions from which actual Drupal code derives. For this reason, they are flagged in the UML diagrams as abstract, meaning they appear in italics. I know this is semantic abuse and UML purists would frown upon this, but it had to appear.

A case in point is the ec_address_base class. It is actually implemented six times in the current code for the MySQL version:

  1. as ec_address in modules/address/address.mysql
  2. as shipping_* attributes to ec_transaction in modules/payment/payment.mysql
  3. as billing_* attributes to ec_transaction in modules/payment/payment.mysql
  4. as ec_address in modules/store/store.mysql
  5. as shipping_* attributes to ec_transaction in modules/store/store.mysql
  6. as billing_* attributes to ec_transaction in modules/store/store.mysql

In this case, it is easier on the reader to refer to the abstract base class ec_address_base thant to the actual implementation, hence these abstractions.

Note that V2V has a video of Matt Westgate about the e-commerce module. Not very technical, but still interesting. Several videos about Drupal too.

Tagged for , , and in Technorati.

2006-10-07 - Update : See also a newer post about drupal ecommerce module dependencies in drupal 4.7.x

2005-11-28 - Update : this page, as well as other in the Grokking Drupal series of my blog, is now available on drupal.org. The version on drupal.org will probably be updated with time, whereas this one won't be.