load_cart — load shopping cart from UserDB
Attribute | Pos. | Req. | Default | Description |
---|---|---|---|---|
nickname | name | Yes | Yes |
Cart specification string. The string is colon-separated, and contains three
fields: the cart name, time of save, and type. Time of save is measured
in seconds since the epoch. Type can be
c (cart) or r (recurring).
|
|
interpolate | 0 | interpolate output? | ||
hide | 0 | Hide the tag return value? |
This tag loads a cart from the UserDB. The loaded cart will be merged with the current one.
Example: Merge a saved cart to the current one
Place the following on an Interchange page:
[load_cart nickname="mycart:990102732:c"]
Interchange 5.9.0:
Source: code/UserTag/load_cart.tag
Lines: 28
# Copyright 2002-2007 Interchange Development Group and others # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. See the LICENSE file for details. # # $Id: load_cart.tag,v 1.5 2007-03-30 23:40:57 pajamian Exp $ UserTag load_cart Order nickname UserTag load_cart AttrAlias name nickname UserTag load_cart Version $Revision: 1.5 $ UserTag load_cart Routine <<EOR sub { my($nickname) = @_; my($jn,$updated,$recurring) = split(':',$nickname); $Tag->userdb({function => 'get_cart', nickname => $nickname, merge => 1}); $Scratch->{just_nickname} = $jn; if($recurring eq 'c') { $Tag->userdb({function => 'delete_cart', nickname => $nickname}); } return ''; } EOR