Drupal CMS is great for almost any website and eCommerce is not an exception. These days, you can find multiple Drupal modules that can accomplish this task, but we will focus only on one of them: Drupal Commerce. This module is Technology Space Bridge's choice due to its superiority in comparison to other eCommerce modules. We will also have a look at other supplementary modules that you'll require in order to make your online store alive.

Why Drupal Commerce?
Basically, because it has a lot of features and it is highly customizable. The great idea behind Drupal Commerce is to provide powerful online store back-end and give webmaster freedom to choose the way data will be presented to the user. When many other online stores (including ones for other CMSs) just offer you several display styles (e.i. 2/3/4 column grid) and just allow you to hide/display/rearrange product fields, Drupal Commerce provides mechanism to use Drupal CMS and its modules to do that. And the choice is really wide here: any number of columns, any types of pagination, random products, unlimited categorization and whatever manipulation with it (i.e. show two latest items in category, N number of random category items, category items sorted the way you like, etc.). Then, you need filtering? No problem. Would you like faceted search or regular filtering, sir? Actually, all you may need.

Drupal Commerce can be extended by about a hundred of other modules that is also a great benefit too. There is a verity that begins from small pieces of functionality to pretty large extensions that for example handle full payment cycle.

Where to begin
First you need to install and configure Drupal CMS and its main modules. If you wish, you can review a blog post Drupal 7 must-have modules before start.

Next, install Drupal Commerce module. Right now, the latest stable version is 7.x-1.11. Drupal Commerce gives you two installation options: from scratch and with Commerce Kickstart. First option is pretty self-explanatory, it just installs the module and that's it. This option is good for experienced webmasters who want to build online store exactly the way they want and what's most important know how to do that. Commerce Kickstart on other hand is a package containing sample eStore data and configuration. In other words it is a ready-made online store that you can install in one click. Commerce Kickstart is a great way to learn Drupal Commerce. Apart of configuration you can study, there is a set of Drupal Commerce related modules that are good to know if you wish to enhance your store. This option is handy for people who are new to Drupal Commerce and want to have a working example to learn on.

Additional modules you might need
Drupal Commerce is a great module, but usually insufficient when installed on its own. The list of helpful Drupal Commerce extensions follows:

  • Commerce Stock. This module allows you to set quantity of your products. In addition it sets rules how stock is deducted, increased and displayed. For more details, please check "Stock management" section below.
  • Commerce Shipping. Shipping module is an API for other modules providing specific shipping services. For example, if you need UPS integration you'll need to install Commerce Shipping and only then UPS module. For more details, please check "Shipping" section below.
  • Commerce AutoSKU. In inventory management, every product must have a unique identifier. One of the identification systems used worldwide is SKU (stock keeping unit). Drupal Commerce requires to set a SKU per product. This is painful process when done manually. But when Commerce AutoSKU used, SKU code will be automatically generated for you using configurable pattern (i.e. category-product_size-product_color-product_id-product_name).
  • Commerce Addressbook. This module saves billing address user enters during checkout and allows to select it from drop down on next purchase. Great way to avoid unnecessary typing by your customers.
  • Commerce Backoffice. This is an enhancement to Drupal Commerce's administration interface. It simplifies work of store keeper a lot (especially for larger stores).
  • Countries. This module allows you to manage countries list. But what's important, apart of regular management you gain ability to add fields. That's a great benefit for some eCommerce solutions, as you can attach additional attributes (i.e. extra costs, discounts, internal data, etc.) to each country.

Product types
Next important topic is product type configuration. Product type is a set of properties your product has. Basically you define: my product have properties:

  • Color. Possible values: red, blue, etc.
  • Size. Possible values: S, M, etc.
  • On Sale. Possible values: yes, no.
  • Category. Possible values: hats, belts, etc.
  • And as many others as you want: gender, featuring, new arrival, unlimited categories, stock, weight, dimensions, etc.

You can have multiple product types when needed. Each will be some kind of a template your products will be created based on. Modifying product type automatically effects all its products.

Stock management
If you sell tangible goods you need Commerce Stock module for sure. It adds Stock field to your product type what allows you to set quantity for each of your products. Moreover, when installed and enabled this module creates rules (workflows) that control products' stock. To be more specific, these rules reduce item's stock level when this item is purchased, do not allow to purchase more products than available, show "out of stock" and similar messages, etc. And thanks to Drupal all these rules are customizable. For instance, you can deduct stock when item is added to the cart instead of on checkout completion.

There is no single payment module for Drupal Commerce, you should install module specific to payment gateway of your choice. As an example we going to take PayPal. This is probably the most used payment gateway/processor in the world and it's great that its module available for Drupal.

So, you download, install and enable PayPal module as any other. Just spend some time finding out what exactly PayPal module you need, as there are several: PayPal WPS, Payflow Link, PayPal Payments Advanced and so on. Usually module depends on the type of account you have with PayPal and the way you want to accept payments (on-site/off-site, etc.). After that you need to go to Store >> Configuration >> Payment methods, find your newly installed PayPal and configure it by entering you account information and setting some preferences.

When you need shipping you should always start with Commerce Shipping module that is an API required by other more specific shipping modules. Among these modules are: Flat rate, DHL, UPS, FeDex, Canada Post and others.

Important thing to note is that all these modules are quote services. They provide quotes not full integration. So, when you add Canada Post module your customers will be able to see how much shipping will cost, but you are still the one who will go to Canada Post's website and will initiate shipment manually.

Also there is sometimes a discrepancy between shipping costs in quotes obtained through API and real costs. It's difficult to determine why exactly this happens, but most probably because API is much more primitive then the other part of the system. Test module well before pushing it to production.

Tax module is coming with the default Drupal Commerce package. It is pretty easy to configure. First you define tax types (i.e. sales tax, VAT). Next you create taxes. This is done with the help of Rules module, so you may be interested looking at it before setting taxes.

Alright, when you create a tax corresponding rule is created. You can edit these rules and set conditions to setup taxes according to your business needs. For example, you can configure different taxes per country, province, user, order or anything else you prefer.

Depend on tax type, taxes will be included into product price or added as a separate row in your cart.

When it comes to product filtering, there are two main options here: regular filtering and faceted search. Regular filtering setup is pretty straightforward. You can use Views with exposed filters for this task. When you require faceted search everything becomes more sophisticated. Let me give a short brief. Faceted search is a "drill-down" approach when you filter data once, then you filter further within data subset you got after first filtering, then within the subset you got after second filtering and so on until you reach what you search for (or until no more further filtering possible). In contrast with regular filtering, your filters will change with each iteration. You will be offered only filters that are applicable to the subset you're currently working with. Because of this, you won't have situation when you select a category and see "Sorry, no records are matching you query".

Let's have a look what we need to accomplish faceted search task:

  1. If you're new to faceted search, please read documentation to understand the concept first. This will help you to configure it correctly and to avoid issues later on.
  2. Install Search API module.
  3. Configure Search API: add server, add index, define fields to be indexed, sorts and other settings that can be found in module documentation and on the Web.
  4. Install Facet API module.
  5. If needed, install related modules (i.e. Search API Ranges) that extend basic Search API functionality.
  6. Set up Views to render your content. Be sure, you select search index instead of content itself for the Show setting!
  7. Setup indexing via CRON job and optionally via Rules module. Second option is good for online stores where products have to appear immediately after product is added, without waiting for the next CRON.

On the high level your store will work the following way: you create content, content is indexed by Search API, Search API is integrated with Views, so your index is rendered to customer, customer uses Facet API and Search API filters to drill down into the displayed data.

Be extra careful with indexing part. Even if content is created it won't be displayed to users until it is indexed. And indexing usually happens in limited batches (configured according to server load) and on CRON execution that may happen, for example, once a day only. Make sure your management/business owner and business users are aware of this concept before you implement it.

Try to stick to regular filtering if there is no real need for faceted search.

Multilingual support
Translating your eCommerce isn't too easy. Mainly because different parts of your site are handled by different translation modules. Here is the list of main modules you can use to translate your online store:

  • Entity Translation: allows translating Drupal entities
  • String Translation (part of Internationalization module's package): user-defined strings translation
  • Menu Translation (part of Internationalization module's package)
  • Entity Translation Menu
  • Taxonomy Translation (part of Internationalization module's package)
  • Multilingual blocks (part of Internationalization module's package)
  • Synchronize translations: allows to share field values among translations (i.e. images, numerical values)
  • (optional) Language Switcher Dropdown module in conjunction with Language Icons module: dropdown-based language switcher with an option to include country flags