[ic] The best How-To? An Approach for Displaying all Quantity Pricing Breaks

Barry Treahy, Jr. interchange-users@icdevgroup.org
Tue Aug 20 20:48:01 2002


Jonathan Clark wrote:

>>I'm looking for the best 'How-To' approach on this, not necessarily
>>asking for the coded details, though I would certainly not look a gift
>>horse in the mouth...
>>
>>Our new pricing system now has five pricing tiers whose quantity
>>discount structure, which consists of 15 quantity breaks, is linked to
>>each product.  Because each of our products have assigned one of these
>>five different discount tiers, I had decided to create a table that has
>>the tier codes along with the quantity code and the discount percentage
>>for that quantity.  When a customer is viewing the flypage, I will have
>>an additional link where by they can view the quantity pricing for that
>>product, the question is what would be the best approach?
>>
>>Since I already have the SKU, and therefore the tire code, I would like
>>to pull the appropriate row from the tier table and walk the columns,
>>without hardcoding each column in a loop, and present for each quantity
>>break the discounted price...
>>
>>In the past, with a single tier code, I did it manually with ITL and
>>HTML, and it was ugly and hard to maintain, so I suspect that I'll be
>>best off doing this all with talbes and embedded Perl but the looping
>>and walking through the columns of a record, can that be done?  At least
>>if I know it is possible, then I can forge ahead with figuring out the
>>how....
>>    
>>
>
>Maybe the qty pricing usertag at
>http://www.interchange.rtfm.info/downloads/usertags/ will be of help. This
>was posted to the user list some time ago by Ron Phipps, I think I also
>posted one previous to that.
>  
>
Thanks Jonathan.  What I need to do is a tad more complex that just an 
alternate pricing table.

Take the following Scenario:

SKU A has a price TIER A and a base price of $10
SKU B has a price TIER A and a base price of $20
SKU C has a price TIER B and a base price of $15
SKU D has a price TIER C and a base price of $30

Price TIER A has the following quantity discounts, Q1=0%, Q10=6%, 
Q25=12%, Q50=18%, Q100=25%
Price TIER B has the following quantity discounts, Q1=0%, Q10=5%, 
Q25=10%, Q50=14%, Q100=18%
Price TIER C has the following quantity discounts, Q1=0%, Q10=4%, 
Q25=8%, Q50=12%, Q100=15%

Obviously these are all hypothetical SKU's and TIER's but you get the 
idea and each are loaded into their products and tiers table, the 
products table which everyone is familiar with, with a additional TIER 
column, and then a tier table which consists of the same primary keyed 
column called TIER and then Q1 through Q25000 quantity break columns 
with the appropriate disacount for each tier and quantity column.

Ultimately, what I want to end up doing is taking the [item-code] value 
from the flypage, creating a secondary flypage which using the tier code 
and then pulling the record from the tier table, presenting for that SKU 
what the 1-9 price, 10-24 price, 25-49 price, and so on buy looping the 
tier row for each column...  Lastly, I'll create a tag that the 
CommonAdjust can use to properly pull and calculate the proper price 
based on quantity and tiering.

So, that's where I'm at and looking that the example URL you did 
provide, I have some ideas now on how to access the tables within Perl 
but what isn't clear is how to do it without hard coding the number of 
columns to parse.  For example, is it possible to pull the 'header' 
record of the table that provides the name of the columns that  can 
parse for names and also to count...

Is that a clearer picture of the dragon I'm attempting to slay?  At a 
minimum, if someone knows of some good reference points that illustrate 
examples of IC table referencing and manipulation, without SQL, that I 
can learn from that would be awesome...

Barry

-- 

Barry Treahy, Jr  *  Midwest Microwave  *  Vice President & CIO 

E-mail: Treahy@mmaz.com * Phone: 480/314-1320 * FAX: 480/661-7028