Multiple Shopping Carts

### Index Up << >>

## Multiple Shopping Carts

You can maintain multiple shopping carts with MiniVend (2.02 and above). One shopping cart -- main, by name -- is defined when the user session starts. If the user orders item M1212 with the following tag:

        [order M1212 layaway] Order this item! [/order]

the order will be placed in the cart named layaway. However, by default you won't see what you want! That is because the default shopping basket page won't display the cart you are thinking it will -- it will show the main cart. So copy the default cart (pages/ord/basket.html in the demos) to a new file, insert a `[cart layaway]` tag, and submit it as a MiniVend page name addendum to the cart name:

        [order M1212 layaway/lay_basket] Order this item! [/order]

Now the contents of the layaway cart will be displayed. If you need to display a different price, you will have to emulate the `[subtotal]`, `[item-price]`, `[item-subtotal]`, etc. fields with `[item-list]`, `[calc]`, and `[currency]` tags. This snippet emulates the item-price tag for a different price field layaway-price:

        [currency] [item-field layaway-price] [/currency]

An item subtotal:

        [currency]
            [calc]
                [item-field layaway-price] * [item-quantity]
            [/calc]
        [/currency]

A cart subtotal, using the item-list tag:

        [currency]
            [calc]
                [item-list layaway]
                ([item-field layaway-price] * [item-quantity]) +
                [/item-list]
                0
            [/calc]
        [/currency]

The zero is needed because of the trailing plus sign left by the iterative `[item-list]` tag.

Shipping and the `[nitems]` tag will still work properly with a different price.

You can also order items from a form, using the `mv_order_item`, mv_cartname, and optional `mv_order_quantity` variables.

     <FORM METHOD=POST ACTION="[process-order]">
     <input type=checkbox name="mv_order_item" value="M3243"> Item M3243
     <input name="mv_order_quantity" value="1"> Quantity
     <input type=hidden name="mv_cartname" value="layaway">
     <input type=hidden name="mv_doit" value="refresh">
     <input type=submit name="mv_junk" value="Place on Layaway Now!">
     </FORM>

### Index Up << >>