[ic] Wish list

Jerry interchange-users@interchange.redhat.com
Mon Feb 25 09:50:01 2002


> From: eddie
> To: interchange-users
> Sent: Monday, February 25, 2002 2:59 PM
> Subject: Wish list
>
>
> Hi everybody,
> I'm using version 4.6.5 of Interchange and I would like to implement a
> wishlist!
> Is there something similar allready done, or can anyone tell me how to do
> it?
> Thank you!

Just add an option to the save cart function on the basket page
to save a cart with a value of "wishlist". We use a drop down option
so it gets saved with the correct value.

Create a page called getlist.html with this code in it:

<center>
<font face="arial, verdana, helvetica" siz="3">
Enter the USERNAME of the person who's wish list you would like to
view.<p>&nbsp;

    <FORM ACTION="[process ]" METHOD=POST>
    <INPUT TYPE=hidden NAME=mv_todo  VALUE=return>
	<INPUT TYPE=hidden NAME=mv_nextpage VALUE="wishlist">
	<INPUT TYPE=hidden NAME=mv_session_id VALUE="[data session id]">

    <TABLE CELLSPACING=0 CELLPADDING=0 WIDTH=200 align="center">
    <TR><TD ALIGN=center><font face="arial, verdana, helvetica"
size="-1">Username</font></TD>
    </TR>
    <TR><TD ALIGN=center><INPUT NAME=username SIZE=10></TD></tr>
	<tr>
        <TD align=center><input type=submit value="submit">
        </TD></TR>
    </TABLE>

    </FORM>

</center>


Create another page called wishlist.html to display the results
using the usertag below:

whishlist.html

<center>
Wishlist for: [value username]  [scratch username]<p>

[wish-list username="[value username]" cart_string="wishlist"]

</center>

In your catalog.cfg file. Add the following usertag and
restart your catalog.

UserTag wish-list Order username
UserTag wish-list Routine <<EOR
sub {
        my($username) = @_;
        my $cart_string;
        package Vend::Interpolate;
        return 'No wish list'
                unless $cart_string = tag_data('userdb', 'carts',
$username);
        my $safe = new Safe;
        my $ref = $safe->reval($cart_string);
        return "Bad cart save." if $@;
        return "Bad cart save." unless ref $ref;
        my $list = $ref->{wishlist};
        my $item;
        my $out = '';
        foreach $item (@$list) {
                $out .= "Code: $item->{code}<BR>";
                $out .= "Item: ";
                $out .= tag_data('products','description', $item->{code});
                $out .= "<a href=$item->{code}>&nbsp;Details</a>";
                $out .= "<P>";
        }
        return 'Nothing in wish list.' unless $out;
        return $out;
}
EOR

You will of course need to add whatever header and footer stuff you
are using in YOUR catalog files to the html files before you copy the
to your pages directory.

Then your people can go the the getlist page, type in the username
of the person who's wish list they'd like to view and it will
be displayed.

We haven't bothered to come up with a way to remove an item from the
list if its been purchased and haven't really seen a need for that.

This should get you going...

Jerry Uphoff