Our New Übercart-based Store

UbercartA little over a year ago, as we were putting the finishing touches on the Lullabot Learning Series, we needed a quick-and-easy way to sell our video downloads and DVDs. We took a look at several of the options out there and Matt ended up stumbling across Shopify, who's tag-line is "E-commerce made easy". Their solution is fully hosted and they claim "setup within minutes". And sure enough, within mere minutes Matt had set up a working site. Within a few hours, it had a Lullabot logo and mostly worked the way we wanted. It took us another day or two to wire it up to our shipping warehouse, and to Fetch, the company which we used for our digital downloads. Overall, it was a quick-and-painless solution.

It served us well for over a year. But we really wanted more out of our store. We wanted better integration with our main site. We wanted to be able to offer coupons and special offers to people on our mailing list. We wanted to be able to create discounted product bundles. And we wanted options like affiliate links and Amazon-style ratings and reviews. And to be completely honest, we were a little embarrassed that we weren't using a Drupal-based solution. So over the past month, we've been toiling away at a brand new Übercart-based store site. And today, we're proud to announce that store.lullabot.com is all-Drupal all-the-time! It did not take us mere minutes to set up. But it's much more configurable, modular, and flexible than our Shopify site.

Incidentally, we'll be celebrating the Independence Day weekend by sending out some deep discount coupons to our mailing list. If you're not already subscribed, hurry up and get on the mailing list to get coupons, special offers, and the inside scoop on upcoming workshops and video tutorial releases... here's a hint: we know a thing or two about Übercart now!

The Great Pretender: Making your data act like a field

These days, almost every major Drupal site is using CCK, the module that lets you add custom fields to any content type. Among other things, CCK lets administrators rearrange a node type's contents using a simple drag and drop interface. In the past, this only worked for fields that CCK itself managed. If you worked with a custom module that altered a node's content, it was up to you to manage its position in the node content.

Now, though, it's possible for any module to tie into CCK's field management page to control the positioning of custom content. The key is hook_content_extra_fields(), and in this article we'll show you how to use it.

Drupocalypse Now (or, dangerous integer handling in drupal_write_record)

A couple of weeks ago, Twitter started circulating news about the upcoming Twitpocalypse. The easy 'default' storage format numbers in many programming languages and databases is the 'signed integer.' It's usually capable of representing values from -2,147,483,647 to +2,147,483,647. As fate would have it, the number of Twitter messages in existence was nearing that limit, and any developers who'd built software that stored tweets would encounter errors unless they started using larger number formats to store Twitter IDs.

Drupal's Twitter module (which James Walker and I co-maintain) had that problem: it archived Twitter statuses in the database, and it saved the Twitter IDs as signed integers. We released an update several weeks ago that changed the database column to an "unsigned bigint," capable of holding numbers as high as 18,446,744,073,709,551,615. Disaster averted!

Not Quite

When the big day arrived and Twitter Status ID 2,147,483,647 was finally posted, we started getting sporadic bug reports from users despite the fix we'd put in place. Even Sony Music, one of Lullabot's Twitter-using clients, got reports from their artists. Chris Daughtry's tweets weren't updating on his web site, and social media starvation was starting to set in. Time for some debugging!

Views Distinct / Node Access Problems

I've been battling a core bug that creates problems when you use node access systems like Organic Groups and try to create views that are limited to distinct nodes. When you are using a node access system and you set 'distinct' to 'true' in any node view, you get ugly ugly error messages like:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT(node.nid), node_data_field_date.field_date_value AS node_data_field_' at line 1 query: SELECT COUNT(*) FROM (SELECT DISTINCT(node.nid) AS DISTINCT(node.nid), node_data_field_date.field_date_value AS node_data_field_date_field_date_value FROM node node LEFT JOIN term_node term_node ON node.vid = term_node.vid INNER JOIN term_data term_data ON term_node.tid = term_data.tid LEFT JOIN content_field_date node_data_field_date ON node.vid = node_data_field_date.vid WHERE (node.status <> 0) AND (node.type in ('event')) AND (term_data.name = 'children') ORDER BY node_data_field_date_field_date_value ASC ) count_alias

Yuck!!

This is actually a core bug, see http://drupal.org/node/284392. Core's db_rewrite_sql() will rewrite the query from DISTINCT(node.nid) AS nid to an incorrect query of DISTINCT(node.nid) AS DISTINCT(node.nid). This invalid query will cause a fatal error keeping the query from executing.

Announcing Our Latest Video: Advanced Theming for Drupal

Advanced Theming cover We're proud to announce the fifth video in the Lullabot Learning Series. Advanced Theming for Drupal, which picks up where the Drupal Theming Basics video lets off.

Here's the description:
The Lullabot Learning Series continues with an in-depth look at the advanced features of Drupal's theming system. In this 2-hour video Nate Haug, Jeff Robbins, and James Walker explain how to completely control the HTML markup Drupal generates. You'll learn how to modify and add variables sent to Drupal's template files and how to use the Theme Developer Tool to simplify the task of working with and navigating Drupal's complex theme system.

The video includes a crash course through PHP, then dives into advanced theming concepts with practical examples such as: how to theme forms, how to cleanly expose information to the theme system, and how to empower your site administrators by making certain parts of the theme available to them for customization. Lastly, the team covers security best practices on shows how to best sanitize user-submitted data and prevent security exploits.

This video completely implements our freely available 960 Robots theme, and gives you the tools you need to make your Drupal site no longer look like a Drupal site.

You can read the full description on store.lullabot.com.

In the following free sample chapter from the video, Nate Haug gives an overview of the template.php file and sets the stage for the specific examples that are provided throughout the course of the video:

The download version of Advanced Theming for Drupal is available right now in our store. You can find out more information and see another sample video that gives an overview of everything that's covered.

Lullabot Going to Drupal Design Camp In Boston This Weekend

On Saturday, following this week's Drupal theming workshop in Providence, we'll be driving the 40 miles up route-95 to Drupal Design Camp Boston. We're sponsoring the event and I will be keynoting on Saturday with a talk about "Why Drupal Is Like Drupal Is", giving a designer-centric look at both the benefits of using Drupal trying to justify the difficulties.

The event is free and we're encouraging our workshop attendees to make the trip as well. Whether you're a web designer interested in learning about Drupal or you've already drank the Kool-Aid and just want to spend more time talking about things like CSS, semantic markup, grid systems, complimentary colors, and why there's no Drupal plugin for Dreamweaver, this is the event for you!

5-Step Drupal Distributions

Distribution? Eh? What's That?

We all love Drupal because it can do anything from a simple personal blog, to a complex social networking site with all the trimmings, and more! Of course, there's a lot of work that goes into making a really polished Drupal site, not the least of which is lots and lots of configuration: deciding which modules to use, enabling them all (and all of their dependencies), setting up your basic CCK types and views, configuring all of the settings on your site just so, and sometimes adding bits of glue code to make it all flow smoothly.

In version 5, Drupal added Installation Profiles (sometimes also confusingly called distribution profiles) to its list of features. An installation profile is basically nothing more than a list of required modules and a variety of configuration code which gets performed during installation to give Drupal a bit more oomph out of the box.

A "distribution" of Drupal is one or more installation profiles included with Drupal itself and all of the required modules. Distributions can either be offered as a convenience to site builders by bundling together frequently used components, such as Acquia Drupal, or they can be used to offer a version of Drupal specifically targeted to a unique use case, such as Open Publish. Dries has some heavy things to think about for anyone interested in getting into the distribution business, so I'll pause for a moment while you go and read that link.

Back? Great! So you've decided you want to share your ultimate Drupal site for whatever reason, and you want to do it in the fastest way possible. Then this article is for you!

Drupal Theming: The Code Behind the Videos

One of the best ways that we've found to learn Drupal is to look at a finished site. Drupal's out-of-the-box experience doesn't really show its full potential. In our latest Drupal theming videos, we needed to build a complete website in order to provide content to "fill out" the theme being built. Once we finished that site, we thought that video viewers and others might like to be able get access and try it out for themselves. So we've done two things with the code:

  1. We've uploaded the code and database to http://960robots.lullabot.com to act as a demonstration of the 960 Robots theme the we built in the videos. This is more for people to look at the front end and HTML output. We've disabled commenting and account registrations in order to keep the site in tact.
  2. We've also bundled up all of the code (modules, core files, etc) along with the database dump and created a installation profile which you can download here and install just like you would install Drupal core.
  3. UPDATE: We've also made available the original HTML template files with associated javascript & images so that you can follow along with the Theming Basics video.

Is This The Long-Awaited Lullabot Drupal Distribution?

Announcing Our Latest Video: Theming Basics for Drupal

Theming Basics cover We're proud to announce the fourth video in the Lullabot Learning Series. Theming Basics for Drupal covers, as you might guess, all of the basics of Drupal theming. Here's the description:

The Lullabot Learning Series continues with a hands-on look at Drupal's theming system. In this 2 hour and 44 minute long in-depth video guide, Nate Haug, Jeff Robbins, and James Walker explain the steps for translating a web design into a Drupal theme. The video explains Drupal's design vernacular, concepts, and special needs. The team shows how to associate the proper CSS & Javascript files, add all of the necessary regions, and control the HTML output through page and node-specific templates. You'll learn about the best tools and strategies for controling the look and feel of your Drupal website. This video covers the basics of Drupal theming. Drupal's more complex theming topics are covered in the Advanced Theming video (to be released soon) which pairs with this video and finishes the complete implementation of the 960 Robots theme used in both videos.

Read the full description on store.lullabot.com.

In this free sample chapter from the video, Jeff Robbins demonstrates the Devel module's Theme Developer tool:

The download version of Theming Basics for Drupal costs $75 is available right now in our store.

Free Drupal CCK & Views Video Chapters

We've had many requests for sample videos from the Lullabot Learning Series. We decided to post an entire chapter from each video. We tried to pick a chapter that was full of useful information on its own and we placed them on both YouTube and Blip, so feel free to spread them around and embed them on your favorite web page.

Hope you enjoy these videos!

Learning CCK for Drupal

Learning CCK DVD In Learning CCK, Jeff Eaton, Nate Haug, and James Walker show everything from CCK basics such as adding and displaying fields to more advanced topics such as CCK’s database storage mechanisms, field-level permissions, and how to theme CCK’s output. Each chapter of this video builds upon the last as the team builds and configures the content types for a university job board. This video pairs well with Learning Views, which continues this job board project through to completion.

Chapter 3: Adding a CCK field

Syndicate content