[ic] Change the price on the fly, without CommonAdjust

Ron Phipps interchange-users@lists.akopia.com
Wed Jun 27 17:45:01 2001


> I don't see why putting a UserTag in CommonAdjust wouldn't work here.
> You have all item attributes available in $item -- I have posted UserTag
> access examples many times.

It may have been the search phrase that I used that did not pick up those
postings.  Thank you for posting again, this will go in my bag of tricks.

> > I already have the code that determines the price of the case and what I
> > would like to do is set the price of the case for that particular item
in
> > the cart.  All of the mailing lists items I looked through (516) talked
> > about using CommonAdjust but in those case it was only one level of
> > modifiers (size, color, etc..) and in this case it is two levels (a
modifier
> > of a modifier).  Is it possible to use perl to change the price for a
> > certain cart item after it is added to the cart?  Is it possible to
change
> > the price before it's added to the cart?  If I change the price of the
item
> > will the other subtotal and total fields work properly?
>
> You can always set the mv_price attribute in the item:
>
> [perl]
> foreach my $item (@$Items) {
> # All items are $5.00 in this store!
> $item->{mv_price} = 5;
> }
> return;
> [/perl]

That is what I was looking for, does this assume the item has already been
added to the cart and @$Items is all of the items in the cart?

> To use mv_price, you need to have an atom which is $ (or begins with $).
>
>     CommonAdjust   $ ;pricing:price_group,q2,q5,q10:, ;:price, ==options
>
> will work this way.  And of course it does work with all of the subtotals
> and such, just as all standard methods do.

I will give this a try, it appears that using a usertag and passing the
results to CommonAdjust is the way to go.  I'll use the same approach to
change the description as well so that this item can use the existing
receipt and basket pages without adding additional fields.

Thank you,
-Ron