[ic] CommonAdjust without any common sense?

Ed LaFrance edl@newmediaems.com
Wed, 11 Apr 2001 16:45:25 -0700


At 12:55 PM 04/11/2001 -0700, you wrote:
>I have an unusual twist regarding CommonAdjust and could use some
>advise.
>
>One of my IC sites is used for B2B between distributors and the
>factory.  The distributor agreements have just recently been changed so
>that if they choose to 'broker' product, they do not receive their
>distributor discount.
>
>In a nut shell, there are two limits: For a line item to receive proper
>quantity discounting, they must order 10 or more (not a problem) but for
>any of the items (regardless if a line may qualify for a quantity break)
>on the order to be discounted, the total order must equal or exceed
>$2000 which means that if the order is $1999.99, any potential line item
>discounts are null and void.
>
>Two gotcha's that I see immediately is that if I suppress CommonAdjust
>until the order reaches $2k and then allow it to do its stuff, this will
>bring the net order below $2k and create an ugly cycle.  If I allow line
>items to discount and then to an 'order total' test at the end and it
>fails the $2k limit, when it removes the line item discounts it could
>blow over $2k, again creating an ugly cycle.
>
>The other aspect that I have not received confirmation on, but I believe
>they want to see the discounted price and then at the time of placing
>the order if the order does not qualify, then to reprice the order
>before committing it.
>
>This seems a bit ugly and comments or input would be appreciated.

You could try something like this:

1. Set up your pricing file:

code    q10
item1   5.00
item2   3.50
...etc

2. Capture the 'raw' total of your cart contents (there may even be a tag 
for this by now):

[set raw_total][/set]
[item-list]
[calc]$Scratch->{raw_total} += ([item-quantity] * [item-field price])[/calc]
[/item-list]

3. Check the raw total to see if the order qualifies, and if so, set 
another scratch variable:

[if scratch raw_total >= 2000]
         [set broker_price]pricing:q10[/set]
[else]
         [set broker_price][/set]
[/else]
[/if]

4. Set up your catalog.cfg to use the broker_price value (actually you 
would do this first, but the logic is easier to follow if I show you at the 
end):

PriceField   no_price
CommonAdjust '[scratch broker_price]', ;products:price

The scratch variable no_price will point IC to the broker quantity pricing 
entries in the pricing table only when the un-discounted total of the order 
meets the minimum, and since that number is culled from straight list 
pricing, an broker reduction will not disqualify it.

NOTE:  I did not test this particular code, but I do this kind of thing 
frequently, so it should work for you.

Good Luck!

- Ed L.


===============================================================
**** Virtual Hosting w/private IC Installation, $65/month! ****
---------------------------------------------------------------
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================