[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] loading carts
****** message to minivend-users from "Bill Randle" <billr@exgate.tek.com> ******
As a followup on my post last night, I finally got it to work thanks
to a pointer from Joachim and more inspection of the UserDB.pm
module.
As a recap, for the archives, I was trying to load the contents of
a cart from one user into the current cart of another user, using
$Vend::Items to represent the new cart.
The solution I came up with:
[mvasp global=1]
<%
no strict;
# with this bit of trickery, we get the cart contents from the
# bidder and copy it to a tempory cart for the owner so that
# the route check code won't complain
my $cartname = "C_" . $Values->{mv_order_number};
my $cart_string = $Values->{bidder_carts};
my $safe = new Safe;
my $ref = $safe->reval($cart_string);
HTML("<br>Bad cart 1\n") if $@;
HTML("<br>Bad cart 2\n") unless ref $ref;
#HTML("<br>saved carts=" . ::uneval($ref));
HTML("<br>Bad cart 3\n") unless ref $ref->{$cartname};
@{$Vend::Items} = @{$ref->{$cartname}};
%>
[/mvasp]
In this case, I had a copy of the carts field from the userdb in
$Values->{bidder_carts}. If need be, it can be obtained directly
from the userdb given the username. E.g.:
my $cart_string = tag_data('userdb', 'carts', $username);
Don't forget to add tables="userdb" to the [mvasp] tag if you do this.
Thanks to those that responded to my plea for help.
-Bill
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list