LemonStand under the covers

February 2nd, 2010 in Micro Blog

I’ve been working on t-shirt shop for a client this month using LemonStand. I’m several hours into it now, and am really impressed with how complete the tool is, especially considering that it’s still in beta.

Templates in LemonStand are simple PHP code, driven by a set of clearly documented objects, pages, templates, and partials. There are objects for the Store, Products, the Cart, and so on, which are automatically available where you need them (and easy to make available in spots where they wouldn’t normally be). I was especially happy to see that the templates used PHP (instead of another layer of translation), and am finding the partials especially handy for adding bits of Ajax magic and other reusables to the site.

The pages, templates, and partials use PHP as it was intended to be used, allowing you to use both the LemonStand API and any other PHP tool available at runtime. This makes for a great deal of flexibility with no need to learn yet another template language. A few examples:

Inline tags

<?= h($this->page->title) ?>

Rendering partials

<?php
    $products = $category->list_products()->find_all();
    $this->render_partial('product_list',
               array('products' => $products));
?>

Showing product details

<?php
    foreach ($products as $product) { 
        $class = $product->on_sale ? 'sale' : '';
?>
<li class="<?= $class ?>">
<a href="<?= $product->page_url('/product') ?>">
    <img  
        src="<?= $product->image_url(0, 125, 'auto'); ?>" 
        alt="<?=  $product->page_url('') ?>" />
    </a>
    <h3><?=  h($product->name) ?></h3>
    <p>$<?= h($product->price) ?></p>
</li>

<?php } ?>

The template editor is the nicest I’ve seen in a web application. LemonStand includes a solid text control that includes highlighting, keyboard shortcuts, including command+s for save, command+z for undo, and other editor niceties. The editor can even be toggled to fill the browser page, which makes template development downright productive.

But editing templates is more than just about the template language and editor, the surrounding tools are powerful and the help system is surprisingly complete for a beta product. There are built in tools for single-step shopping carts, including Ajax bits to help you build advanced stores for smaller clients.

Editing for clients

Code editing is nice for us webmonkeys, but what about our clients? Lemonstand includes an editable page type, useful for FAQs, help pages, and other things that are not directly related to inventory. The store management tools are easily understood by non-techies (at least for my current clients), as are the editable content pages. I worry about the backend and my clients take care of the inventory, orders, and things related to their business.

Managing inventory is obvious too, and includes a very complete set of tools. Products are part of categories, related items, and groups. Products have attributes, extras, and options, along with the crucial elements like price, SKUs, images, descriptions, and so on. The tools allow clients to manage the definitions of their products, their inventory, ordering, any payments in the system. But more about these as I launch my first store.

Conclusion

LemonStand is a solid base for building online stores for nearly any size of client. It’s a productive tool for building themes and for managing the store itself, and it includes tools for building advanced features that are not available in many of the competing cart applications.