<%args> item category <%python scope="init"> import shoppingcontroller # cache the contents of the component, keyed off of item name. # component will be executed at most every 120 seconds for a given # item. if m.cache_self(key=item.name, cache_expiretime=120): return <& breadcrumb.myc, category = category &>
<&| forms.myc:form, action='cart/' &>
<& common.myc:item_image, item=item &>
<% item.name %>
<% item.price %>
% if item.variants is not None: % for key, list in item.variants.iteritems(): %
<% key %>: # the call to create the select box of item variants # is a little involved, which led me to cache this component <& forms.myc:select, name='variant_' + key, options=[(v.name, "%s%s" % (v.name, m.scomp('common.myc:price', price = v.price))) for v in list.values()] &>
%

Add to Cart: <& forms.myc:text, size=2, name="qty", value="1" &> item(s) <& forms.myc:submit, value="go" &>
Back to category '<% category.description %>'