All in the <head>

– Ponderings & code by Drew McLellan –

– Live from The Internets since 2003 –

About

How To Create 100 Unique MOO MiniCards

22 October 2009

A few weeks back, the nice people at MOO got in touch because they’d seen some of the MiniCards we’d produced to help promote Perch, and thought we might make an interesting case study to go along with their new range of MiniCards that enable you to upload images for both the front and back. You can read the case study over at the MOO blog, and whilst it was fun to get a sneak preview of a new product from one of my favourite companies, that’s not what this post is about.

What was interesting about our cards was that each card carries a unique, single-use discount code. The way MiniCards work is that you can upload a bunch of images to go on the front, but the back of each card is the same. So while most people upload a small handful of photos from Flickr and end up with a few cards with each, to get 100 unique cards per batch we were faced with generating and uploading 100 unique images to go on the front.

The first stage of the problem was generating unique codes. The Perch checkout system has an option for discount codes, but this needed to be adapted to allow for single-use codes rather than general, time limited codes. It’s our own custom system, so that was easy to do, and so I set about writing a quick command-line PHP script to generate unique discount codes and put them into the database. So our codes were sorted – what about all those images.

MOO card with placeholder text

I’m a long time Adobe Fireworks user, and Fireworks has this great little tool called the Data-Driven Graphics Wizard. This is probably based likened to Mail Merge for graphics. You create a template graphics file with placeholders in it (stuff like {name}, {address} and so on), and then provide a data source with fields that match your placeholders. The merge process outputs a folder full of unique images using the document’s Save for Web settings.

The only downside is that the data source Fireworks needs is an XML file. User expectation would be that CSV would be the tool for the job here, but XML is what it wants, so I updated my discount code generation script to output an XML doc with all the codes at the end of each batch. The output looked something like this:

<xml>
 <row><code>ABC123EF</code ></row>
 <row><code>ABC123EG</code ></row>
 ...
</xml>

Each row only had one field called ‘code’. This meant I needed to create my graphic with {code} placeholder text for where I wanted the discount code to sit. I hit go, and out came 100 unique images to upload to MOO.

Admittedly, the process at MOO isn’t optimised for uploading 100 unique images per batch of 100 MiniCards, so that part of the process was a little laborious, but that’s really my own fault. It’d be great if, for example, MOO had the option to upload a single ZIP of images.

But that’s all there is to it. I hope that’s useful to someone. By the way, the above discount codes aren’t real, but you can use the code WOOHOO1.2 until tomorrow (23rd Oct 2009) for a 20% discount off the new version of Perch. The update is free to existing customers.

- Drew McLellan

Comments

Textile Help

Photographs

Work With Me

edgeofmyseat.com logo

At edgeofmyseat.com we build custom content management systems, ecommerce solutions and develop web apps.

Recent Links

Affiliation

  • Web Standards Project
  • Britpack
  • 24 ways

About Drew McLellan

Photo of Drew McLellan

Drew McLellan (@drewm) has been hacking on the web since around 1996 following an unfortunate incident with a margarine tub. Since then he’s spread himself between both front- and back-end development projects, and now is Director and Senior Web Developer at edgeofmyseat.com in Maidenhead, UK (GEO: 51.5217, -0.7177). Prior to this, Drew was a Web Developer for Yahoo!, and before that primarily worked as a technical lead within design and branding agencies for clients such as Nissan, Goodyear Dunlop, Siemens/Bosch, Cadburys, ICI Dulux and Virgin.net. Somewhere along the way, Drew managed to get himself embroiled with Dreamweaver and was made an early Macromedia Evangelist for that product. This lead to book deals, public appearances, fame, glory, and his eventual downfall.

Picking himself up again, Drew is now a strong advocate for best practises, and stood as Group Lead for The Web Standards Project 2006-08. He has had articles published by A List Apart, Adobe, and O’Reilly Media’s XML.com, mostly due to mistaken identity. Drew is a proponent of the lower-case semantic web, and is currently expending energies in the direction of the microformats movement, with particular interests in making parsers an off-the-shelf commodity and developing simple UI conventions. He writes here at all in the head and, with a little help from his friends, at 24 ways.