|
| Hello,
I have posted several messages to this newsgroup requesting advice on
setting up pricing so that different member groups can be assigned to
different price lists. Since there does not seem to be any clear
documentation and I did not get any suggestions on how to set this up
I am posting what I did.
The goal: Allow a user to log into a store and view a catalog. The
user should be presented with a price list that they are assigned to.
Several price lists will be available but a user will only quality for
one price list.
The software: WebSphere Commerce 5.4 Professional Edition
The solution:
At first I tried using the MGPTRDPSCN table to link a member group to
a trading position container. This table is listed as depreciated in
the WCS 5.4 documentation but the newsgroup postings on the web only
discussed using the MGPTRDPSCN table. I also was unable to find any
documentation from IBM on using the nondepreciated tables TRADING,
TERMCOND, and PARTICIPNT. Using the MGPTRDPSCN and related tables I
was able to get getCalculatedPrice() to work. This allowed me to log
into the store as a user and display the prices for the price list
that they were assigned to. However, when I added an item to the
basket using OrderItemAdd the price would be incorrect. It would
always be the lowest price from all of the trading position
containers. This was because OrderItemAdd uses
getCalculatedContractPrice() which does not seem to restrict using
member groups but rather uses the TERMCOND table to restrict usage.
I then tried populating the TRADING, TERMCOND, and PARTICIPNT tables
so that getCalculatedContractPrice() would work. The relevant (only
those required to restrict price lists to a member group) tables that
got this to work for me are: TRADING, CONTRACT, TERMCOND, PARTICIPNT,
MEMBER, MBRGRP, MBRGRPMBR, TRADEPOSCN, TDPSCNCNTR, and STOREMBRGP.
I had to add two TERMCOND records and set the TCSUBTYPE_ID to
PriceTCCustomPriceList. The TRADING_ID field should be whatever you
use for the default contract for your store (contract.contract_id is a
foreign key to trading.trading_id). The BIGINTFIELD1 field refers to
the trading position container.
I then added two records to the PARTICIPNT table. The TERMCOND_ID
should be used to link the PARTICIPNT record to the TERMCOND record.
The TRADING_ID should be null. The MEMBER_ID field should contain the
member or member group that you want to restrict access for.
One of the problems that I had when getting this solution working was
that I had existing records in the POLICY table which I had added when
trying to get getCalculatedPrice to work. I removed them along with
the POLICYDESC and POLICYCMD recods that I had created.
Hope this helps someone.
John
|
|