[ic] Can the price be editted in the cart??? - What Is Wrong Now?

Ed LaFrance interchange-users@lists.akopia.com
Tue Jul 24 12:05:00 2001


At 01:14 AM 07/24/2001 -0500, you wrote:
>Dan and Everyone Else,
>
>I need to change the price of [item-price] before it is displayed in the
>cart. This will need to be done by my sales reps since they modify prices on
>the phone. From what I can tell, Interchange will not let me manipulate
>[item-price].
>
>I added the following to the top of the cart component file to try to change
>[item-price]:
>
>[perl]
>my $price = "100.00";
>my $this_sku = "os28108";
>undef $cart;
>
>my $cart = $Carts->{main};
>foreach my $item (@$cart){
>      if ($this_sku eq $item->{'code'}){
>          $item->{'mv_price'} = $price;
>      }
>}
>[/perl]
>
>when i check $item->{'mv_price'} it is set to 100.00, but when i check the
>sku's price, it won't change. what can i do to correct this and in what file
>do i make the necessary changes?
>
>Thanks,
>
>Jason Osborne

A similar discussion about eclectic pricing schemes happened on this list a 
while ago.  CommonAdjust is still the best handler for this, in my 
opinion.  The CommonAdjust string can contain an IC Usertag, which gives 
you the means to calculate an item price by just about any conceivable 
criteria.  Mike Heins provided a nice example:

http://developer2.akopia.com/archive/interchange-users/2001/msg05636.html


In your case it could be a simple as:

UserTag customprice <<EOS
   sub {
         my $c_price = 'customprice_' . $item->{code};
         return $Values->{$c_price};
   }
EOS


Then add it to CommonAdjust in catalog.cfg:

CommonAdjust '[customprice]' #rest of existing string goes here


And add a form element for modifying the price:

<form action="[process-target]" method=post>
<input type=hidden name=mv_todo value=refresh>
<input type=hidden name=mv_nextpage value=@@MV_PAGE@@>
[item-list]
Custom price:
<input  type=text
         name="customprice_[item-code]"
         value="[value name="customprice_[item-code]"]"
         size=8>
[/item-list]
<input type=submit value="Update Prices">
</form>

...The custom price would only be applied for items in the cart.

- Ed L.





===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================