Drupal

How to split Drupal Commerce orders at checkout

This week I needed to design a checkout workflow that, depending on the contents of a users shopping cart, would separate the current cart into two, and allow the user to check each out individually. Drupal Commerce comes with cart and checkout modules, to enable users to add products to a shopping cart, and then to checkout of your store. The commerce_cart module is really designed for a 1:1 user:cart ratio. That being said, it is possible to allow users to have more than one cart.

Looking at Acquia Dev Cloud and Pantheon

Until recently i was hosting my site on the AWS free-tier micro instance. This is a fully self-managed stack and I didn't mind this, it's nice to keep my system administration skills fresh (or a little less rusty). I've gotten busy recently, and wanted an opportunity to look at both Acquia Dev Cloud and Pantheon for Drupal hosting. The following is far less of a comparison than it is a brief synopsis of my experience with each.

Drupal Rules Domain access condition

Notice: This article does not advocate the use of PHP eval(), but it was the fastest way to get done what I needed :)

Yesterday I needed a condition to ensure that a rule executed on one particular domain of a site running Domain access. The Domain module doesn't seem to provide a Rules condition, and a super quick search of Google didn't find one either.

In order to solve my problem I could either write a custom module that makes a Rules condition available, using hook_rules_condition_info(), or use the Execute custom PHP code condition, I chose the easy path.

Tags:

Drupal Rules components and recursion

This morning I created a Drupal Rules module rule set component, which is being triggered with a reaction rule. Some of the rules in the set have actions that will trigger the reaction rule, but recursion isn't happening. This is good, I don't want any recursion.

To be on the safe side I searched to find out why recursion isn't happening.

We can see that in rules_element_invoke_component() recursion is being intentionally prevented.

Tags:

Restricting a custom Drupal Rules action to execute once

Today I needed to apply some custom discounts to orders in Drupal Commerce. The Rules workflow is:

  1. Delete any existing discount line items from the order
  2. Calculate possible discounts and add new discount line items to the order
    1. I'm sure that there are other approaches, but this seemed simple (lol) and most importantly it seemed like it would satisfy my use case.

Tags:

Featurizing Drupal Commerce configuration - Commerce features

I was moving some Drupal Commerce work from a local development environment to an integration and staging server this week, and realized that Commerce really does lack in its ability to have configuration featurized. I found the Commerce features module, which initially seemed like it would be quite helpful. Unfortunately, most of the commerce configuration that I was looking at is not featurizable using this module.

Getting all articles, ordered by title, with EntityFieldQuery

EntityFieldQuery is a class that can be used to... query entities... by field! And, other things too.

Today I needed to get a list of all nodes, of a certain type, ordered by title. One might go to the database for this, but I decided to do things the 'right' way, by leveraging the Drupal 7 entity system.

Using Panels and Page Manager with your eyes closed

As the Drupal Core accessibility maintainer, I from time to time have people ask me about the accessibility of different contributed modules. Several times in the past I've been asked about the accessibility of Panels (where I assume the person means cTools Page Manager as well). Only this week have I had the need to use Panels and Page Manager. This is by no means a thorough review, but my observations as a screen-reader user.

Pages

Subscribe to RSS - Drupal