TEST MODE
Show details for 3 _ Tier Pricing Script Example

3 _ Tier Pricing Script Example

This Product

This example demonstrates the tiered pricing capability of the generic pricing script.

By enabling tier pricing, the administrator can ensure that different prices can be utilised depending on the quantity of a product ordered.

For example, purchasing 1 of product configuration A(1) and B(3) may be a different price per unit than purchasing 10 or 50. Tier pricing allows us to factor in this change in price based on quantity.

Pricing script configuration

{
    "filePath": "TieredPricingScriptExample.csv",
    "quantityColumnName": "Quantity",
    "useTierPrice": true
}

Pricing Script CSV

A B Quantity Price
1 1 1 2
2 1 1 3
3 1 1 4
1 2 1 3
2 2 1 4
3 2 1 5
1 3 1 4
2 3 1 5
3 3 1 6
1 1 10 1.6
2 1 10 2.4
3 1 10 3.2
1 2 10 2.4
2 2 10 3.2
3 2 10 4
1 3 10 3.2
2 3 10 4
3 3 10 4.8
1 1 50 1.2
2 1 50 1.8
3 1 50 2.4
1 2 50 1.8
2 2 50 2.4
3 2 50 3
1 3 50 2.4
2 3 50 3
3 3 50 3.6
A *
B *
£2.00
Config qty column name Quantity
Config qty useTierPrice true
Attributes length 2
Attribute name: A with value: 1
Attribute name: B with value: 1
Cached attributes length: 2
filename = TieredPricingScriptExample.csv
columns initialized: A,B,Quantity,Price
get csv price
Checking row matching for columnName = A row value= 1
columnName = A attrValue= 1 temp= 1
Checking row matching for columnName = B row value= 1
columnName = B attrValue= 1 temp= 1
Checking row matching for columnName = Quantity row value= 1
Checking row matching for columnName = Price row value= 2
Row: (1,1,1,2) with index: 1 is matching: true
Using tier price
Checking row matching for columnName = A row value= 2
columnName = A attrValue= 1 temp= 2
row dont match temp=2 attrvalue=1
Row: (2,1,1,3) with index: 2 is matching: false
Checking row matching for columnName = A row value= 3
columnName = A attrValue= 1 temp= 3
row dont match temp=3 attrvalue=1
Row: (3,1,1,4) with index: 3 is matching: false
Checking row matching for columnName = A row value= 1
columnName = A attrValue= 1 temp= 1
Checking row matching for columnName = B row value= 2
columnName = B attrValue= 1 temp= 2
row dont match temp=2 attrvalue=1
Row: (1,2,1,3) with index: 4 is matching: false
Checking row matching for columnName = A row value= 2
columnName = A attrValue= 1 temp= 2
row dont match temp=2 attrvalue=1
Row: (2,2,1,4) with index: 5 is matching: false
Checking row matching for columnName = A row value= 3
columnName = A attrValue= 1 temp= 3
row dont match temp=3 attrvalue=1
Row: (3,2,1,5) with index: 6 is matching: false
Checking row matching for columnName = A row value= 1
columnName = A attrValue= 1 temp= 1
Checking row matching for columnName = B row value= 3
columnName = B attrValue= 1 temp= 3
row dont match temp=3 attrvalue=1
Row: (1,3,1,4) with index: 7 is matching: false
Checking row matching for columnName = A row value= 2
columnName = A attrValue= 1 temp= 2
row dont match temp=2 attrvalue=1
Row: (2,3,1,5) with index: 8 is matching: false
Checking row matching for columnName = A row value= 3
columnName = A attrValue= 1 temp= 3
row dont match temp=3 attrvalue=1
Row: (3,3,1,6) with index: 9 is matching: false
Checking row matching for columnName = A row value= 1
columnName = A attrValue= 1 temp= 1
Checking row matching for columnName = B row value= 1
columnName = B attrValue= 1 temp= 1
Checking row matching for columnName = Quantity row value= 10
Checking row matching for columnName = Price row value= 1.6
Row: (1,1,10,1.6) with index: 10 is matching: true
Using tier price
Checking row matching for columnName = A row value= 2
columnName = A attrValue= 1 temp= 2
row dont match temp=2 attrvalue=1
Row: (2,1,10,2.4) with index: 11 is matching: false
Checking row matching for columnName = A row value= 3
columnName = A attrValue= 1 temp= 3
row dont match temp=3 attrvalue=1
Row: (3,1,10,3.2) with index: 12 is matching: false
Checking row matching for columnName = A row value= 1
columnName = A attrValue= 1 temp= 1
Checking row matching for columnName = B row value= 2
columnName = B attrValue= 1 temp= 2
row dont match temp=2 attrvalue=1
Row: (1,2,10,2.4) with index: 13 is matching: false
Checking row matching for columnName = A row value= 2
columnName = A attrValue= 1 temp= 2
row dont match temp=2 attrvalue=1
Row: (2,2,10,3.2) with index: 14 is matching: false
Checking row matching for columnName = A row value= 3
columnName = A attrValue= 1 temp= 3
row dont match temp=3 attrvalue=1
Row: (3,2,10,4) with index: 15 is matching: false
Checking row matching for columnName = A row value= 1
columnName = A attrValue= 1 temp= 1
Checking row matching for columnName = B row value= 3
columnName = B attrValue= 1 temp= 3
row dont match temp=3 attrvalue=1
Row: (1,3,10,3.2) with index: 16 is matching: false
Checking row matching for columnName = A row value= 2
columnName = A attrValue= 1 temp= 2
row dont match temp=2 attrvalue=1
Row: (2,3,10,4) with index: 17 is matching: false
Checking row matching for columnName = A row value= 3
columnName = A attrValue= 1 temp= 3
row dont match temp=3 attrvalue=1
Row: (3,3,10,4.8) with index: 18 is matching: false
Checking row matching for columnName = A row value= 1
columnName = A attrValue= 1 temp= 1
Checking row matching for columnName = B row value= 1
columnName = B attrValue= 1 temp= 1
Checking row matching for columnName = Quantity row value= 50
Checking row matching for columnName = Price row value= 1.2
Row: (1,1,50,1.2) with index: 19 is matching: true
Using tier price
Checking row matching for columnName = A row value= 2
columnName = A attrValue= 1 temp= 2
row dont match temp=2 attrvalue=1
Row: (2,1,50,1.8) with index: 20 is matching: false
Checking row matching for columnName = A row value= 3
columnName = A attrValue= 1 temp= 3
row dont match temp=3 attrvalue=1
Row: (3,1,50,2.4) with index: 21 is matching: false
Checking row matching for columnName = A row value= 1
columnName = A attrValue= 1 temp= 1
Checking row matching for columnName = B row value= 2
columnName = B attrValue= 1 temp= 2
row dont match temp=2 attrvalue=1
Row: (1,2,50,1.8) with index: 22 is matching: false
Checking row matching for columnName = A row value= 2
columnName = A attrValue= 1 temp= 2
row dont match temp=2 attrvalue=1
Row: (2,2,50,2.4) with index: 23 is matching: false
Checking row matching for columnName = A row value= 3
columnName = A attrValue= 1 temp= 3
row dont match temp=3 attrvalue=1
Row: (3,2,50,3) with index: 24 is matching: false
Checking row matching for columnName = A row value= 1
columnName = A attrValue= 1 temp= 1
Checking row matching for columnName = B row value= 3
columnName = B attrValue= 1 temp= 3
row dont match temp=3 attrvalue=1
Row: (1,3,50,2.4) with index: 25 is matching: false
Checking row matching for columnName = A row value= 2
columnName = A attrValue= 1 temp= 2
row dont match temp=2 attrvalue=1
Row: (2,3,50,3) with index: 26 is matching: false
Checking row matching for columnName = A row value= 3
columnName = A attrValue= 1 temp= 3
row dont match temp=3 attrvalue=1
Row: (3,3,50,3.6) with index: 27 is matching: false
Matching rows: 3
Quantity Column Index: 2
Checking: 1,1,1,2
Found a valid tier: 1,1,1,2
Checking: 1,1,10,1.6
Finish search
price column index=3
price from row = 2
set attributes from csv length = 0
set item properties from csv length = 0
product cost column index=-1
unit price = 2