[ic] Multiple Pricing

Bernino Lind interchange-users@interchange.redhat.com
Wed Oct 17 15:01:01 2001


Thanks a bunch for the code.

Im getting a clear picture now: IC simply just Rocks!

I think I will go for your code, and add some extra calc, to do a transition
from one currency to another.

(is it really so, that no one have IC shops with multiple currencies ?)

I couldnt find documentation on the profile directive - anyone knows where
to get it ?

//Nino

-----Original Message-----
From: interchange-users-admin@interchange.redhat.com
[mailto:interchange-users-admin@interchange.redhat.com]On Behalf Of
Jerry
Sent: 17. oktober 2001 19:49
To: interchange-users@interchange.redhat.com
Subject: RE: [ic] Multiple Pricing



> Perhaps you could post some example code ?

Sure, but I'm sure Mike Heins' solution is probably better
than mine. Looking this over again now after a couple of
years, this could be cleaned up alot by using a little
perl instead of mv tags. Not one to mess with success though
on a lower traffic site... it'll stay this way for now.

I added a field to the userdb database called "rate" to hold
the locale information. In the products database I added
two additional price columns called "wholesale" and "distributor".
These fields obviously would hold the prices for those users. In the
userdb you'll need to manually set rate to either, in our case,
wsale or dsale.Just leave it blank for a default of retail pricing.
I setup a dropdown with meta in the admin section to set each user.

In catalog.cfg I added these lines:

PriceField price
Locale en_US PriceField price
Locale wsale PriceField wholesale
Locale dsale PriceField distributor
Locale en_US price_picture "$ ###,###,###.##"
Locale wsale price_picture "$ ###,###,###.##"
Locale dsale price_picture "$ ###,###,###.##"

At the top of the index.html page directly
below the <body> tag, I added:

[if session logged_in]
[set name="proper_pricing" interpolate=1][data base="userdb" field="rate"
key="[data session username]"][/set]
[set name="proper_locale" interpolate=1][data base="userdb" field="rate"
key="[data session username]"][/set]
[else]
[set proper_pricing]en_US[/set]
[set proper_locale]en_US[/set]
[/else]
[/if]
[if type=explicit
compare="[calc] '[scratch mv_currency]' ne '[scratch proper_locale]'[/calc]"
]
[setlocale locale="[scratch proper_pricing]" currency="[scratch
proper_pricing]" persist=1]
[/if]

We force people back to the index page after login so the locale is
set properly. This works fine on a ver 4.6 store, but I don't see why
it wouldn't work in 4.8. When I do find the time to move this one into
ver 4.8, I'll probably use the "profile" directive as Mike suggested
as I would think it's much cleaner than this. I'd seriously look at that
first, but you wanted my code, so here it is.

Jerry

_______________________________________________
interchange-users mailing list
interchange-users@interchange.redhat.com
http://interchange.redhat.com/mailman/listinfo/interchange-users