1.7. Multiple Shopping Carts
Interchange allows you to define and maintain multiple shopping carts. One shopping cart -- main, by name -- is defined when the user session starts. If the user orders item M1212 with the following tag:
[order code=M1212 cart=layaway] Order this item! </a>
the order will be placed in the cart named layaway. However, by default you won't see the just-ordered item on the basket page. That is because the default shopping basket displays the contents of the 'main' cart only. So copy the default basket page (pages/ord/basket.html in the demo) to a new file, insert a [cart layaway] tag, and specify it as the target page in your [order] tag:
[order code=M1212 cart=layaway page=ord/lay_basket] Order this item! </a>
Now the contents of the layaway cart will be displayed. Most of the ITL tags that are fundamental to cart display accept a 'cartname' option, allowing you to specify which cart to be used:
[cart cartname]
-
A 'sticky' setting of the default cart name to use for all subsequent cart-related tags. Convenient, but you must remember to use [cart main] to get back to the primary cart! As an alternative, you can specify the desired cart as a parameter of the other tags. These are not sticky, referencing the specified cart only for the instance in which they are called:
[item-list cartname]...[/item-list]
-
Iterates over the items in the specified cart - tags like [item-quantity] and [item-price] will be evaluated accordingly;
[nitems cartname]
-
Returns the total number of items in the specified cart;
[subtotal cartname]
-
Returns the monetary subtotal for the contents of specified cart;
[shipping cartname], [handling cartname], [salestax cartname], [total-cost cartname]
-
You get the idea. It is worth noting that tags which summarize cart contents do not need to be in used concert, or in conjunction with an [item-list]. For instance, you can display just the grand total for a cart on the sidebar or bottom of each page, using [total-cost] by itself, if you wish.
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]"> <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>
If you need to utilize an alternative item price in conjunction with the use of a custom cart, see the section on PRODUCT PRICING for pricing methods and strategies.