[ic] Setting basket fields (description, title, etc...)

Ron Phipps interchange-users@lists.akopia.com
Wed Jul 4 14:02:00 2001


----- Original Message -----
From: "Mike Heins" <mikeh@minivend.com>
> Quoting Ron Phipps (rphipps@reliant-solutions.com):
> > I have the need to dynamically change the title and price of an item in
the
> > cart.  I have tried using the following code:
> >
> > [perl]
> >   foreach my $item (@$Items) {
> >    if ($item->{'code'} eq $Scratch->{sku})
> >
> >     $item->{mv_price} = $Scratch->{case_sub};
> >     $item->{'title'} = "blah blah blah";
> >    }
> >   }
> >   return;
> >  [/perl]
> >
> > The price is set correctly - [item-subtotal] returns the correct value.
> > The title is not set to "blah blah blah"
> > [item-field price] does not show the correct price even though
> > [item-subtotal] is computed correctly.
> >
> > Any idea's why the mv_price would be set correctly,  but the title would
> > not?  How can I set [item-field price] to show the correct value as
well?
>
> You can't unless it is an on-the-fly item, or at least it has no value in
> the "title" field in the database.

What I'm trying to accomplish is to send in either the description or title
which includes the options they have selected.  The reason that I can not
just edit every page that shows the item to include [item-modifier a]
[item-modifier b] [item-modifier c] [item-modifier d] is because there is an
unknown number of options that is generated from the DB.  This allows the
owner of the site to add or remove an option easily without having to modify
the db or any pages.

Would you recommend that I leave the title field blank and store the title
in another field.  Then when the item is placed in the basket concat the
other title field with all the options to make up the title field to be
shown on the basket, checkout, receipt, etc...  pages?

> You *can* access what you set with:
>
>     [either][item-modifier title][or][item-field title][/either]
>

For some reason [item-modifier title] is not evaluating on the page, but
I'll figure that out.  Does this mean if I set the title like I had before
that [item-field title] will display what is stored in the database and
[item-modifier title] will display what I set in the Perl code?

> And [item-price] should return the right thing.

That worked!  Can you explain the difference between [item-field price] and
[item-price]?

Thank you,
-Ron