[ic] different cart, different price

John Allman interchange-users@icdevgroup.org
Mon Oct 7 12:55:01 2002


Ed LaFrance wrote:

> At 04:46 PM 10/07/2002 +0100, you wrote:
>
>> Hi - I have a situation now where  i have two shopping baskets, one 
>> for orders coming from a catalog (a physical catalog like a magazine) 
>> and one for orders coming in from the website as usual. The codes in 
>> the catalog (from here on assume when i say catalog i mean the actual 
>> magazine type thing) are different from the sku's in the product 
>> table so i'm intending to have a little perl code in a variable (lets 
>> call this variable translate) to look up a table in the database and 
>> translate from catalog code to sku. I then would have something like 
>> <input type=hidden name=mv_click value=translate> in my form for 
>> ordering. i'm hoping this makes sense so far.
>>
>> problem is that the products listed in the catalog might have 
>> slightly different prices to those on the live website (if, for 
>> example the prices on the website were changed). so my plan is to 
>> have an extra field in this "catalog code to sku translation table" 
>> with the price listed in it. now the problem arises that when i get 
>> to the shopping basket page i need to know the catalog code in order 
>> to get the correct price, but i've already translated it into an sku 
>> to place the order.
>>
>> i'm thinking of adding the catalog code for each order into a perl 
>> array which will be stored as a scratch variable. Then when i'm 
>> iterating through the products in the basket, i can keep a count and 
>> look at each corresponding catalog code in turn and use this to look 
>> up the appropriate price for the current item. does this sound like a 
>> sensible way to do things? i also briefly considered storing the 
>> price in a cgi variable - but somebody could abuse this reasonably 
>> easily and claim whatever price they wanted for a product.
>>
>> If anyone can offer me any advice or make any comments on the 
>> approach i've proposed i'd much appreciate it.
>>
>> thanks
>>
>> John
>
>
> One way you could do this is to simply set mv_price for those items 
> which were ordered from the print catalog. I'm fairly sure that the 
> CommonAdjust chain in the foundation demo includes a reference to 
> mv_price (if not, you can add it).
>
> For security reasons, you probably want to do this in an mv_click or a 
> [perl] block, rather than with a hidden form var.
>
> - Ed L.

:) thank god i asked! that's a much much better idea. thanks!

John