Distribution Release: IPFire 2.9 Core 47

Michael Tremer has announced the release of an updated version of IPFire, a Linux-based firewall distribution: "Today we release IPFire 2.9 Core 47. IPFire 2.9 Core 47 is a bug-fix release and it brings minor feature updates. The most important change, beside the security update of the PHP….

Fire Core – Drupal / Ubercart File Download e-commerce

Fire Core LLC designs powerful media center software aimed at complementing a number of popular Apple hardware products. Fire Core has been routinely featured in a number of major publications such as: Macworld, Popular Science, Gizmodo, Engadget and many more.

The previous site was utilizing 3 different software packages.

  • osCommerce
    The e-commerce part of their previous site was run with osCommerce.
  • WordPress
    The site blog was run on WordPress
  • phpBB
    Their support forum was driven by phpBB. Many of the users were also customers in their osCommerce store database, having separate accounts on both systems.

We (Rehab Creative) were approached by Fire Core about creating a new site, ideally merging the three systems into one. This project was a perfect fit for Drupal and Ubercart, and after a few brief discussions, Fire Core agreed that Drupal sounded like a great platform to work with. The slick visual design was provided by Jack Herbert and the PSDs were handed off to us to cut out to a Drupal theme.

osCommerce vs. Ubercart

One of the main advantages of Ubercart over osCommerce is Drupal itself. A Drupal based commerce solution provides content management, commerce capability, forum, blog and user management all in one proven package with a deep base of contributing users and modules. Using osCommerce as their e-commerce engine, Fire Core needed to utilize two other software packages (Word Press and phpBB) to achieve all requisite functionality.

Additionally, Fire Core expressed that many of the osCommerce contributions the site depended on (“contributions” are the closest thing osCommerce has to modules) required adjustments to the osCommerce core and often specific contributions would require core changes that would conflict with other contributions. This presented problems with both implementing relevant contributions and with keeping the osCommerce core up to date.

Challenges

The migration from osCommerce to Ubercart alone was a unique challenge due to the nature of the file-downloads and variable expirations sold on the site. The two carts handle purchased file downloads fundamentally differently, and reconciling those differences was more involved than a traditional physical-goods store migration would have been.

On top of that, many customers also had accounts on the phpBB based forum and even on the WordPress blog for commenting on blog posts. This meant that we had to reconcile users from the three user systems into the single Drupal user table, while maintaining proper associations of user->order, user->forum posts, etc.

Approach

The initial migration was done largely via the following modules:

While the modules above greatly helped expedite the import of many of the larger content items, the user consolidation and proper linking had to be handled largely via some custom PHP/MySQL logic outside of Drupal.

The migrations and consolidation of orders, users, phpBB forum posts, etc were numerous and complex, so much so that it would be unreasonable to go into great detail on each front. However, purchased file downloads, and a user migration/consolidation issue presented two of the more interesting migration challenges, so an extended summary of those follow.

Migrating File Downloads

One of the more difficult challenges revolved around the way Ubercart handles purchased file downloads. Under Ubercart, file downloads are granted to users upon purchase, but without association to an order ID. The file download table in Ubercart has a list of all the file downloads granted to users (along with expiration dates, etc), but there’s no link back to an order. Additionally, the order table doesn’t maintain any association with a file download granted to a user. With osCommerce, the file download is associated with an order just like any standard product on an order.

Fire Core software is available for purchase with varying expiration levels. Customers can purchase software updates for 1, 2, 3 years and a lifetime option. Each of these choices represents a “Product Feature” under Ubercart. When a user purchases a file with one of those time periods, they’re purchasing an Ubercart product with a product feature that dictates what file they get access to, how long the download is good for, how many downloads they are allowed and the name of that product feature.

With Ubercart, the product feature component is rather complex and stores these product attributes in a product feature table. The file downloads table then has a field for a product feature so every file download purchased by a user knows whether it was purchased for 1 year, 2 years, etc. This means that the product features had to be created in the Ubercart database before the file downloads table could be populated with users’ purchased files. While the expiration field is an explicit field in the file downloads table, the description of the file download (“1 year of updates”) is stored as part of the product feature, not in the file download table itself.

Under osCommerce, these purchased files are stored with the expiration date of the download, but without any notion of a “Product Feature”, so the only way to know if the download was purchased with “2 years of updates” was to look at the expiration and manually map those expirations to the proper Ubercart Product Features.

The initial migration using the modules outlined above handled the migration of the orders table just fine, but did nothing to bring the users’ file downloads across. At this point, we wrote up some PHP/MySQL to grab the files from the osCommerce database and properly add them to the Ubercart database. This script needed to assign the proper UID as well as the aforementioned mapping to assign the appropriate product feature for the file download.

Consolidating store and forum users

The phpBB2Drupal module worked flawlessly for importing user posts and forum users — even properly handling users that already existed in the Drupal database from the store migration. Many osCommerce customers also had accounts in the phpBB forums, using the same email address. We used the osCommerce migration as our ‘master’ for the users, then performed the phpBB2Drupal migration after.

This created new users where necessary and utilized the existing users when the email address was already in the system. The only problem here was that, for users with accounts on both legacy systems, the “Joined”, or “Member Since” dates were being decided by their osCommerce user account, since that account was the master as far as our Drupal site is concerned. To remedy that, we had to manually loop through the legacy phpBB database and properly overlay the legacy Join dates on top of the user accounts in the new Drupal database. After that, all the Drupal forum user accounts had the right Join dates, helping ensure a more seamless transition for existing forum users when they began using the new site.

Checkout customization


Fire Core had very specific requests for the layout of the checkout page. The legacy osCommerce site utilized a similar checkout page which provided a simplified 3-step flow: 1. Check your Cart 2. Enter Contact Details 3. Select Payment Method

Ubercart natively wants to group the checkout page by some default “panes”, and those didn’t line up with the desired flow. The checkout page needed to be significantly altered both in grouping and order of presentation. Fortunately, Ubercart provides hooks for this very manipulation. Using some standard hook_form_alter action Ubercart’s hook_checkout_pane, we were able to precisely achieve the desired layout. The hook_checkout_pane methods we used essentially boil down to what you can see on Stella’s website, only expanded significantly over what is shown on her site.

Forums


Using the Advanced Forum module and some custom templates we created a forum with a look and feel more in-line with the structure existing users had become used to on the phpBB forum the past site utilized.

Additionally, we added highlighting of moderator posts to help ‘official’ replies have visual separation from those of general users.

Additional Functionality

In addition to the primary functions of the site outlined above, we also seamlessly integrated with Zendesk (Zendesk Remote Authentication Module), securely served purchased file downloads from CloudFront, using the Ubercart Cloudfront Module (with some of our own tweaks), and implemented a number of custom modules to improve the checkout flow and product presentations in general.

Expanding File Downloads

Fire Core needed a way to manually adjust the expirations of purchased files for various reasons, so we wrote a module to give the site admin the ability to search for user downloads by username or email, then manually edit, delete and add file downloads to the user’s account.

Ubercart natively allows admins to add a file download to a user account, but it doesn’t take into consideration the various product features you’ve defined in your store. You can manually grant a user access to a file, and you can set an expiration date on that download, but you can’t assign it the product feature “2 years of updates”. The only practical problem presented by omitting the product feature is that the user won’t see “2 years of updates” presented on their file downloads page. Instead, they’ll only see the file name, and the expiration date. In our case, “2 years of updates” is actually an important part of the purchased product name, so we added the ability for the site admin to properly manually add a file download to a user account with any predefined product features.


File downloads and past orders are presented to users very simply via their account page. Upgrade offers and expiration notices are also conditionally displayed to the user on this page depending on the product features and expirations on their existing purchased downloads.

The site is now serving more pageviews than ever before, and the three unified systems (store, blog, forum) are working together flawlessly.

New book: Drupal 7 Module Development

Drupal 7 Module Development has been published by Packt, just in time for the release of Drupal 7. This book provides in-depth coverage of key elements of Drupal 7 and is designed for professional developers. Every chapter provides fully functional code samples illustrating the APIs and strategies discussed in the chapter. With this foundation, developers can quickly build sophisticated tools on their own by making use of the strategies and techniques exemplified in this book.

If you are a PHP developer or a Drupal user looking to dive into Drupal development then you will find this book an excellent introduction to coding within Drupal. Those with some Drupal experience will also find this an invaluable tool for updating their knowledge about the powerful new features of Drupal 7. Theme developers looking to extend their abilities will find this an accessible introduction to PHP coding within the Drupal environment.

About the book

The co-authors of the book have been collaborating since summer of 2009. We tried to write the book that we wanted, but could not find, when we started working on Drupal 6. That is, we tried to cover some of the more complex topics and bigger changes in the newest version of Drupal.

A tall order, certainly, but the authors are all experienced core developers. A quick review of the list:

  • Matt (mbutcher) Butcher introduces general Drupal concepts and starts you to developing your first module and integrating it to Drupal’s testing suite.
  • John (JohnAlbin) Wilkins examines Drupal’s theming layer and provides detailed coverage of how to integrate your module into Drupal’s theme layer.
  • Greg (heyrocker) Dunlap shows you how to use Drupal’s User Experience (UX) guidelines to build an adminstrative interface. He also discusses the new file and stream handling functions.
  • Larry (Crell) Garfield explores the new Entity and Field systems, showing you how to create new content types.
  • Ken (agentrickard) Rickard explains the permissions system and its security implications, with an entire chapter devoted to Drupal’s node access system.
  • Matt (mfer) Farina shows you how to implement JavaScript in Drupal and how to create an install profile.

This approach allows each author to specialize in a particular Drupal subsytem, providing in-depth examples and analysis of the Drupal internals. To shamelessly quote from Angie (webchick) Byron’s introduction:

The authors of this edition of the book have much more than “merely” a deep understanding of Drupal 7′s internals — in many cases they literally wrote the patches that put those internals into place.

What you will learn from this book?

Both new and experienced Drupal developers should find the book’s depth of coverage essential for learning Drupal 7. While we can’t cover every topic, we take in-depth looks at:

  • The architecture of Drupal.
  • Creating a new Drupal module.
  • Using Drupal’s testing framework.
  • The proper use of theme functions and themeable output.
  • How to leverage Drupal 7′s render system.
  • Providing RTL language support.
  • Mapping Drupal functions to URLs.
  • Creating basic forms with the Form API.
  • Creating administrative pages for your module.
  • Using Drupal 7′s new token system.
  • How to define new entity types.
  • Using fields to store data.
  • Using widgets to hook fields into the Form API.
  • Using formatters to control the display of fields,
  • Drupal’s roles and permissions concepts.
  • Securing sensitive actions with permissions.
  • How to write a node access module.
  • Modifying the behavior of node access modules.
  • How to add JavaScript to pages through Drupal.
  • Working with AJAX and Drupal.
  • Understanding Drupal’s public and private filesystems.
  • Implementing a stream wrapper for custom file handling.
  • Implementing your own image effects for use with Image Styles.
  • Bundling modules and themes in a distribution.

And much, much more. Each chapter includes detailed (and working) code samples to help you master the concepts being discussed.

Why now?

With Drupal 7 not yet released, this is a fair question. There has been some community dissent over the timing of new book releases, and we understand that.

This book was originally planned and scheduled to coincide with Drupal core development. Many of the chapters discuss significant API changes that took place after the book was started. In a few cases, writing the book actually prompted patches to Drupal itself.

What we wanted to do, above all else, is provide developers with a guide they could use to start working in Drupal 7 as soon as it was released. We tried to write a book that anticipated the tough questions that would come up as developers tried to work with Drupal 7. In essence, we think this is the book we would like to have.

Is the book perfect? No book is. We anticipate errata to cover late changes in Drupal APIs. But we had an obligation to get the book out as close to Drupal 7′s release as possible, and so we think this edition will be a great benefit to the Drupal community.

Get 20% off!

If you order the book through the Packt website, you can save 20% off the cover price. Use DrupalModDev20 (case sensitive) when ordering through the official book web page.

Note
: you must be logged in to PacktPub.com for discount code to be applied

Want a Sample?

For a glimpse of the content featured within this book, Packt has provided three free chapter excerpts: