changed the cart & cart views a little, minor backward-incompatibility

2 views
Skip to first unread message

Bruce Kroeze

unread,
Aug 3, 2007, 5:03:19 PM8/3/07
to satchm...@googlegroups.com
Prepping for 0.5, I just committed a changeset which needs a little heads-up from me:

- the base_cart view no longer uses variables named "all_items" or "total."  Instead you can just iterate over the variable "cart" to get at cartitems, and you can use cart.total for the total.  If you simply replace the word "all_items" with "cart" and "total" with "cart.total" in your custom templates, you'll be good to go.

- Based on earlier discussion I've changed the GET method of removing cart items.  No more using /cart/{{ id }}/remove/, since that is vulnerable to browser pre-caching.  Instead you call the satchmo_cart_remove view with a POST form containing a "cartitem" id to remove.  See how it is done in the new base_cart.html for an example.

- Added the ability to update quantities of cart items.

- Updated the base_cart.html template to use all these changes.

- Added AJAX methods for the add and remove methods as well, but these aren't used in the base templates since we haven't really integrated javascript into that yet.

+Bruce Kroeze

Itai Tavor

unread,
Aug 3, 2007, 7:11:12 PM8/3/07
to satchm...@googlegroups.com
> - Added the ability to update quantities of cart items.

Good work Bruce, you beat me to it... I made the same change in my
site but didn't get a change to fold it back into satchmo.

I did it a bit different - an input field for quantity and an "update
cart" button (pretty much the "standard" way, I suppose).

Can you explain your motivation for using a fixed list of quantities?
I wonder which way would be preferable to most users.

Itai

Bruce Kroeze

unread,
Aug 3, 2007, 7:27:09 PM8/3/07
to satchm...@googlegroups.com
I basically think that most people won't use the base_cart.html.  They'll be skinning it in various ways and are unlikely to use it as-is.  I was just demoing how you might use a fixed list.  

No big deal to me to remove it.

That does make me wonder whether my assumption is correct.  Here's my logic/assumptions in more detail:

1) Our developer-users are using Satchmo because they want more of a framework than a packaged solution.

2) One of the most restrictive parts of ZenCart and the ilk is their straightjacketed templates.  They are so burdened down with spaggheti code to handle every little option that they get almost un-editable.  In contrast our templates are light and clean, partly by ignoring edge-cases.  We can ignore edge-cases because it is so easy to modify/override templates for your own use.

3) Even if the dev isn't going to modify views and such, he or she is very likely to write custom templates for the store.

I'd love to hear reports about how people are using or planning to use Satchmo.  It will help me write better, more usable code and templates.  At the moment, I am writing under the assumption that most of our templates are best used as examples.

Please keep in mind that I am a developer on Satchmo, but I do not speak for the team.  I could be very off base in my assumptions about the intended use.

Thanks,
Bruce Kroeze

Chris Moffitt

unread,
Aug 4, 2007, 9:59:08 PM8/4/07
to satchm...@googlegroups.com
 

Please keep in mind that I am a developer on Satchmo, but I do not speak for the team.  I could be very off base in my assumptions about the intended use.

I think your assumptions ring true & remember the "team" of developers is pretty small so your voice carries a lot of weight.  Like I said, you seem to be spot on so far.

-Chris


Itai Tavor

unread,
Aug 4, 2007, 10:35:07 PM8/4/07
to satchm...@googlegroups.com
All very valid points. Thanks for clarifying your focus.

The choice of what UI to include for changing quantities in the cart
is obviously not at all critical then...

Just one thing though - if you wanted to implement input boxes for
quantities and an "update cart" button, besides customizing the
template you'd also need to add a view that will process the update
for all the cart items. Do you think it might be a good idea to
provide this view in satchmo, even if it's not used in the standard
template? That would keep the options open for users who can make
their own templates but not extend satchmo at the python level.

There's another example for this... I added "buy this product" links
to each product in the category listing template, and that feature
also required a new view. So currently my site has its own shop app
which adds these views. We could make these options available to all
users by folding the new views into satchmo.shop.cart.views and maybe
adding sample templates somwhere to show their use.

What do you think?

Itai

Bruce Kroeze

unread,
Aug 5, 2007, 12:40:09 AM8/5/07
to satchm...@googlegroups.com
I'd like to have those views.

Itai Tavor

unread,
Aug 5, 2007, 1:35:21 AM8/5/07
to satchm...@googlegroups.com
Cool, I'll build sample usage into the default templates and submit a
patch.

Itai Tavor

unread,
Aug 5, 2007, 2:50:52 AM8/5/07
to satchm...@googlegroups.com
Done.

I'm starting to think that django is too easy to work with... it
takes longer to report on patches than to make them. There's got to
be a catch somewhere.

Reply all
Reply to author
Forward
0 new messages