[ic] products database

Jerry interchange-users@interchange.redhat.com
Tue Feb 26 10:46:01 2002


> From: interchange-users-admin@interchange.redhat.com
> [mailto:interchange-users-admin@interchange.redhat.com]On Behalf Of
> Andreas Kotowicz
> Subject: [ic] products database
>
>
> hi,
>
> ic expects the products database to have a specific header. for example,
> it wants you to have a sku, description, price... field.
> lets assume, i have a database that has its field named 1,2,3,4,5...
> is there a way to say maybe in catalog.cfg which field corresponds to
> the one ic expects? so i can still use the ic default tags without
> having to tell each time what field i mean.
>
> second question:
> lets say i have different prices for different "kind" of customers in my
> products.txt (like in the foundation demo done with dealer). how can i
> assign a price field to a type of customer?
>
> thanks,
> andreas

Can't think of thing that would help with your first problem. We just
change the column names and import. Seemed to always be the easiest
solution.

The second question has been asked a couple of time in the last couple of
weeks. I think the solution is posted in the archives, but here is what we
do, all in one place.

We use LOCALE to set the price for each type of customer.
In the userdb we added a column called "rate" which defines
what type of customer. This, for us, is either empty or contains "wsale" or
"dsale"
indicating wholesale or distributor buyer.

We setup a empty 3 column locate.txt database with:
code	wsale	dsale

In catalog.cfg we added or modified the locale setup wtih these lines.
Note this would be for US currency. You might need to modify the picture
stuff.

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 "$ ###,###,###.##"


# Locale          en_US LC_CTYPE C
LocaleDatabase  locale

Now, in the products database, add columns for your
wholesale and distributor prices. We called ours
wholesale and distributor. These contain the proper prices
for those buyers.

Lastly, when a user logs in, they are forwarded to a page
that contains the following code to setup their pricing.
This, I'm sure, could be cleaned up a bit, but it works
for us.

[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]

That's it. You could have as many as you wanted, just expand this.
Hope this helps...

Jerry Uphoff