[Handel] [RFC] *::Item::Properties

Christopher H. Laco claco at chrislaco.com
Mon Jan 23 01:08:01 CET 2006

A suggestion has been made to allow Cart and Order to be able to use
multiple item_class classes. The premise is that some items need
different fields from others, fields that aren't quite generic enough to
be used across the board.

While I think this particular approach could turn into a nightmare
pretty quickly, I think I have an alternate plan that could work. I
wanted to get some feedback on it before I started working on it.

Option #1.

In short, two table and classes would be added;
cart_item_properties/Cart::Item::Properties and

Each table would basically consist of the following fields:


Each item would have a new properties collection:

  my $item = Handel::Cart::Item->new({
    sku => 'SKU123'
    quantity => 1,
    properties => {
        name1 => 'value1',
        name2 => 'value2'

  my $item = $cart->items({sku => 'SKU123'});
  my $properties = $item->properties;

  while my $prop = $properties->next {
     print $prop;
     print $prop->value;

Option #2.

This is slightly lower tech. cart_items and order_items would get a new
field called...wait for it.... properties.

In this field, we would simply store a a YAML string with various
name/value pairs. The upside to this approach is that the properties
field can contain anything YAML supports; list, name/value collections,
trees, etc.

Option #3.

Do nothing. Leave this type of thing out of Handel, and leave it up to
people making custom subclasses.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/handel/attachments/20060122/ff8300bb/signature.pgp

More information about the Handel mailing list