Sorting of products in Drupal Commerce Add To Cart form Sorting of products in Drupal Commerce Add To Cart form

Posted by mradcliffe on 2014.06.11 @ 14:49

Filed under:

This is a quick post regarding the sort order of option elements in the Drupal Commerce Add to Cart form as part of Product Reference fields.

I was confused as to how this was sorting. It does not sort by the Product title. It does not sort by the Product entity identifier. On my development site, the options seemed to be sorting by SKU.

There were a couple options to look into: [more...]

Rules-provided entity variables: Where are my field properties? Rules-provided entity variables: Where are my field properties?

Posted by mradcliffe on 2013.02.19 @ 16:08

Filed under:

At times I am confused by behavior in the powerful Rules module. Sometimes Rules data selectors for entities have their fields listed and sometimes they do not. I did not find documentation about this behavior.

So I dug through code… [more...]

Drupal Queue API example: enqueue in form submit handler, dequeue when cron runs Drupal Queue API example: enqueue in form submit handler, dequeue when cron runs

Posted by jstrecker on 2012.03.14 @ 22:39

Filed under:

Need to store up some items and process them en masse in a cron job? That’s a perfect use case for the Queue API (for Drupal 7+) or the drupal_queue module (the backport for Drupal 6).

Concrete example: One of our consulting clients was using a synchronous webservice for their retail store locator. We needed to create a form where store owners could change whether they’re listed in the store locator. When a store owner submits the form, should she have to wait around while our site sends her change to the store locator webservice? We didn’t think so. So we decided to use Drupal’s Queue API, which lets us save up all the store owners’ changes and send them to the webservice in a batch.

Here’s a simple example of adding items to a queue in a form submit handler and processing them in the next cron run. [more...]

ctools Modals and Vertical Tabs ctools Modals and Vertical Tabs

Posted by mradcliffe on 2011.12.21 @ 23:49

Filed under:

The Chaos tool suite (ctools) is collection of useful methods intended to help Drupal developers create complex interfaces without duplicating too much effort.

Drupal 7 introduced a new Form API element: Vertical Tabs. When you set a parent element as this Form API type, then any child elements that are of type fieldset are displayed as vertical tabs instead of as in the traditional fieldset. Unfortunately for us developers, the documentation does not provide an example of how to use Vertical Tabs properly, but with some trial and error you can do it.

However, this new Vertical Tab Form API element doesn’t work in modal multistep wizard forms created with ctools. [more...]

Hacking Open Atrium: adding Features within the Contexts of your Spaces Hacking Open Atrium: adding Features within the Contexts of your Spaces

Posted by smokris on 2011.12.05 @ 19:02

Filed under:

Last Saturday at DrupalCamp Ohio, I presented an introduction to the basic concepts behind the Open Atrium Drupal install profile, and a demonstration of how to create custom Open Atrium Features. [more...]

PHP's __autoload() function is Deprecated: Use spl_autoload_register() Instead. PHP's __autoload() function is Deprecated: Use spl_autoload_register() Instead.

Posted by smokris on 2008.04.20 @ 11:11

Filed under:

PHP logoPHP 5’s spl_autoload_register() function has been around since late 2005, yet documentation on it is still pretty sparse.

spl_autoload_register() does basically the same thing as __autoload(), but — instead of being a callback defined in the global namespace (reminds me of ON ERROR GOTO in BASIC) — it allows you to add your autoload handler onto the end of a chain of callbacks. Useful if you don’t want to clobber everyone else’s autoload code.

More info here.

Interactive Argyle Generator

Posted by bbinkovitz on 2007.04.05 @ 22:42

Filed under:

So, last weekend I decided to learn PHP. I went through a tutorial, orchestrated a lovely rendition of “hello, world!”, and then decided I needed a more challenging project.

So I made an Interactive Argyle Generator.

You can see the current version of it here.