[ic] CommonAdjust

Jonathan Clark jonc@webmaint.com
Sun, 15 Apr 2001 00:54:45 +0100


> It's just that all of the docs that I have looked at, in giving a
> usage of CommonAdjust refer me to 'Chain Pricing' which does not appear
> to exist.)-:
>

Looking at the code (Mike will correct me if I'm wrong) 'Chain Pricing' is
the pricing system that you can set up with the CommonAdjust directive. (the
item_price routine gets its price from chain_cost )

>
> JC>>can you tell us what you are trying to acheive?
>
> Thank you!
>
> Apples:
>
> SKU: AP-S	Small are $1.00 each
> 		A bag of 18 are $0.75 each
> 		A case of 4 bags, 72 apples are $0.50 each
>
> SKU: AP-M	Medium are $1.50 each
> 		A bag of 24 are $1.25 each
> 		A case of 4 bags, 96 apples are $1.00 each
>
> SKU: AP-L	Large are $2.00 each
> 		A bag of 16 are $1.75 each
> 		A case of 3 bags, 48 apples are $1.50 each
>
> Oranges:
>
> SKU: OR-S	Small are $0.50 each
> 		A bag of 15 are $0.45 each
> 		A case of 5 bags, 75 oranges are $0.35 each
>
> SKU: OR-M	Medium are $0.75 each
> 		A bag of 20 are $0.65 each
> 		A case of 4 bags, 80 oranges are $0.50 each
>
> SKU: OR-L	Large are $1.00 each
> 		A bag of 12 are $0.75 each
> 		A case of 6 bags, 72 oranges are $0.50 each
>
The normal way to do this would be to have your pricing table with fields
corresponding to the quantities.
The problem with your pricing structure is that the price breaks are not
consistent.

pricing table:
sku	q12	q15	q16	q18	q20	q24	q48	q72	q75	q80	q96
AP-S				0.75				0.50
AP-M						1.25					1
etc...

PriceField	nonexistant_field
CommonAdjust   pricing:q12,q15,q16,q18,q20,q48,q72,q75,q80,q96: ;:price

This commonadjust setting says (starting at the right)
 get the price from the price field in the products table.
 if there is one, replace it with the price from the pricing table field
which corresponds (<=) to the qty specified in the tag, or in the basket.

but there must be a better way if you can't predict what the breaks will be.

Maybe a pricing table which has the structure:

sku   break1 price1  break2  price2  break3  price3
AP-S  18     0.75	   72      0.50
etc.

and a usertag which does the clever stuff referenced in:

CommonAdjust   [lookup-price] ;:price


Jonathan
Webmaint.