Cart enhancemenets - add product from base_category, update all quantities

Create issue
Issue #108 new
Former user created an issue

This patch adds the following:

1) A "buy this product" button for each product in templates/base_category.html. Product is added with quantity of 1, view redirected to cart.

2) An alternative cart template (templates/base_cart-alternate.html) demonstrating: - text-input fields for quantity editing - "update cart" button - edits quantities for all items, deletes items with quantity 0 - cart-wide form (all cart items contained in a single form) - "remove" buttons modified to work inside the cart-wide form

3) New view methods in satchmo.shop.views.cart: add_from_list (to support 1), add_from_list_ajax (same for ajax, untested), update_cart (to support 2). All new views create a modified POST dict and then call the original cart editing views - this way actual cart manipulation code is not duplicated.

4) New entries in satchmo,shop.urls for the new cart actions.

Notes:

a) There is no update_cart_ajax view to complement update_cart. Returning and updating the entire cart display in JS is non-trivial enough that it should probably be discussed first.

b) I created base_cart-alternate.html because I didn't want to override Bruce's cart features - his uses individual forms for performing quantity updates on each row, which is a good option to keep around. I'm not sure how to make the alternative cart template available - suggestions welcome.

Reported by itai

Comments (3)

  1. Former user Account Deleted

    I'm less familiar with the satchmo tests than with the code I've hacked into, but I'll look at that.

    As for explanations, I'm not sure where they should go in the docs... the customization section is just an overview, there's no existing place to describe specific templates. Any suggestions?

  2. Chris Moffitt repo owner

    Good point about the docs.

    If you create the docs in ReStructured text format, we'll be sure to find a good place to integrate them.

  3. Chris Moffitt repo owner

    We need to also keep in mind documentation for this feature. I'm ok with creating an alternate cart view however we need to make sure it's easy for developers to understand each and why we have 2 choices.

    Also, I'm not sure if this is going to change any of the unit tests. We should probably double check that.

  4. Log in to comment