CommonAdjust — define default settings for a flexible, chained item pricing scheme
CommonAdjust
is used to define the default settings for a flexible,
chained item pricing scheme.
The whole pricing idea and the explanation of CommonAdjust strings can be found under the price glossary entry. Make sure you read it, or you'll have only a limited success with the section called “EXAMPLES”.
Example: The pricing database
Most of the practical setups will use a separate (outboard) database to define pricing-related options. This could be all done in the products database as well, but let's stick to a visually cleaner implementation. (This database is used by other examples above!)
An example pricing database looks like this:
code common q1 q5 q10 XL S red 99-102 10 9 8 1 -0.50 0.75 00-343 2 red 0.75
Example: Adjusting item price based on size
Let's say we had a product, a t-shirt for example, and we wanted to define
a pricing adjustment based on product's size
attribute. The
price field in the
products database should have the following value
to achieve the effect:
10.00, ==size:pricing
You see, the base price of 10.00
will be adjusted
according to the size
attribute. If we had a t-shirt
with SKU 99-102
and size XL
,
then an amount of 1.00
would be added and form a total
price of 11.00
(according to the
pricing table above). The same product in size
S
(small) would have a "bonus" of -0.50
and result in 9.50
total. For any other size, the base
price would stay as-is because no matching column
would be found in pricing.
If we entered the above price specified in the
price field for item
00-343
, then an adjustment of +2
would
be made only for size variant XL
.
Example: Adjusting item price based on size and color
Let's say we had a t-shirt from previous example, and we wanted to define a pricing adjustment based on color attribute (in addition to size which we already implemented). The price field in the products database should have the following value to achieve the effect:
10.00, ==size:pricing, ==color:pricing
You see, the base price of 10.00
will be adjusted
according to both size
and color
attributes. For item SKU 99-102
, additional
0.75
would be added for a specific red
color (according to the pricing table above).
Example: Adjusting item attributes based on a common column
Let's say we had a bunch of t-shirt products and the red
color always added an additional 0.75
to the corresponding
base price.
What we know by now is that to achieve that effect, we could create a column
named red
in the pricing database.
In the same database, we would then add an entry for all t-shirt items
and put a value of 0.75
in the
red field. This approach, however,
is error-prone and of linear complexity — more t-shirt models you have,
more work is needed to catalog them properly.
The solution to this problem is elegant. Instead of defining the
red column, define one column of a
common name (common
itself is one good name for that
column), and add red
as an entry in the database.
Refer to the first example in which we show a sample
pricing database and where we did that (in the last row).
You can then instruct Interchange to search for a row in the table with item color
as key. Here's how to modify the previous example:
10.00, ==size:pricing, ==color:pricing:common
What's more, if you ever wanted to define an adjustment for another color, the only thing you'd have to do would be to add one entry in the pricing database:
blue 0.50
Example: Adjusting item price based on quantity
The price glossary entry explained the format of CommonAdjust strings. To enable quantity based pricing, we need to name the columns that will participate in the process (remember, numerical portions of the column names denote minimal quantity levels). Just in case, we can also specify a default price which will be applied only if the lookup in the pricing database returns blank or zero value. In this example, after the base price gets determined based on quantity, the size and color attributes will proceed with further price adjustment as usual:
pricing:q1,q5,q10:, ;10.00, ==size:pricing, ==color:pricing:common
In the above example, the product (a t-shirt in our example) with SKU
99-102
would have a base price of
8.00
each, if ordered in quantity of 10 or more
(again, according to the pricing table from the
beginning of the section called “EXAMPLES”).
Example: Terminating the price adjustment chain
Let's say we defined a fallback price (the same way as in the example above),
and wanted to terminate the pricing chain (skip any further adjustments
— size- and color-based adjustment in our case) if the fallback price
was applied. The code needed looks almost the same
as above, except that the colon (,
) does
not follow the fallback price:
pricing:q1,q5,q10:, ;10.00 ==size:pricing, ==color:pricing:common
In the above example, the product (a t-shirt in our example) with SKU
99-102
would have a base price of
8.00
each, if ordered in quantity of 10 or more
(again, according to the pricing table from the
beginning of the section called “EXAMPLES”).
Example: Using the "mix-and-match" feature
As mentioned in the price glossary entry, you can have quantities of different items (but which belong to the same product group) added together to determine the appropriate price class. With a pricing table of:
sku price_group q5 q10 q25 os28004 group_a 10 9 8 os28008 group_a 20 18 17
and a CommonAdjust
setting of:
pricing:price_group,q5,q10,q25
the price for six items os28004 would be 9.00
each, and
the price for three items os28008 would be 18.00
each.
(No, this is not a mistake in the text, take another look at the description).