Ordering Rule Formulas

Size: px
Start display at page:

Download "Ordering Rule Formulas"

Transcription

1 Ordering Rule Formulas Creating and Utilizing Ordering Rule Formulas. Ordering rule formulas allow you to use functions such as round, range, division, and others, to create unique order rules to satisfy regional and national tax laws, offer shipping discounts, and a myriad of other possibilities. This tutorial presents the concepts and steps needed to create unique ordering rules with formulas. The tutorial is organized in the following manner: First, you will learn about the components of a formula, namely, numbers, operators, variables, and functions. Then, you will learn where you may enter unique ordering rule formulas within the Store Builder and how to test their functionality. Finally, you will see various examples and illustrations of different formulas to give you ideas of formula possibilities. IMPORTANT NOTE! If you have not studied Printable Tutorial 7.0, please do so now. By studying the tutorial you will gain the foundation to which this tutorial builds upon. The vast majority of merchants will only need the standard ordering rules presented in Printable Tutorial 7.0. Formula Components Formula calculations consist of several components, including: numbers, operators, variables, and functions. The following section briefly describes each component and how it is utilized in the calculations. (See Fig 1 for an illustration of the formula components.) Fig 1: Formula Components Function Variable Numbers Function Variable Operator Numbers Numbers Numbers can be either integer numbers or decimal numbers. You can enter any number in a formula. For example: 1, 9, 10.95, 2.5, etc, are integer and decimal numbers. Copyright Stores Online, Inc. Rev

2 Operators Mathematical operators include: addition (+), subtraction (-), multiplication (*), and division (/). You can use any mathematical operator. You can also use parenthesis '( )' to set the order of operations (i.e. 3 * (2 + 5) ). Variables There are three variables you can use to calculate your costs: quantity, weight, and $$ amount (there are several stages of $$ amount through the ordering process). Numitems: This is the number of items ordered. This value is calculated by adding all the quantities on the order form. Weight: This is total weight of the order. To have the total weight calculated you must enter the weight of your products in the products menu database. Subtotal: This is the subtotal of the items ordered. This variable is calculated by multiplying all the unit quantities against unit prices and then summing the amounts. Subtotaltax: This is the taxable portion of the subtotal. Subtotalnontax: This is the non-taxable portion of the subtotal. Formtotal: This is the total of all the prices associated with form elements (i.e. editable, decision and date and time elements). Formtotaltax: This is the taxable portion of the formtotal. Fromtotalnontax: This is the non-taxable portion of the formtotal. Total: This is the running total at the time the business rule is processed. Totaltax: This is the taxable portion of the total. Functions There are several functions you can use to help calculate your shipping costs or discounts. Each function requires parameters, which can be fixed numbers, variables, operators, or additional functions. abs (x) Absolute Value This function only takes the parameter and returns the absolute value of that parameter. Example. abs(-10.95) will return div (x, y) Integer Division This function only takes two parameters and returns the integer value when dividing the two parameters. Example. div(100, 6) will return 16. Normally 100 / 6 = This function only returns the integer part of the division operation; 16 in this example. max (x, y, z,...) Maximum This function takes any number of parameters and returns the maximum value of all the parameters. Example. max(numitems, 20, weight, 6) will return 20 Copyright Stores Online, Inc. 2

3 min (x, y, z,...) Minimum This function takes any number of parameters and returns the minimum value of all the parameters. Example. min(numitems, 20, weight, 6) will return 6 range (variable, r 1, v 1,... r n, v n, default) Range This function compares the first parameter (variable) to a series of range values (r 1, r 2,... r n ) and returns the corresponding value for that range (v 1, v 2,... v n ). If none of the range values (r 1, r 2,... r n ) meet the criteria of the first parameter (variable) then the last parameter (default) is returned. The comparison of the first parameter and each range value is done using the less than (<) operator (i.e. if variable < r 1 then return v 1, if variable < r 2 then return v 2, etc.) Example. range(numitems, 2, 100, 4, 150, 6, 200, 250). The following table demonstrates the return value, added as a tax or shipping cost, based on differing amounts of total items ordered: numitems (variable) value (v 1, v 2,... v n ) comments If a customer ordered two items, the value of $ would be returned (or added to the total cost) If a customer orders over 6 items, the default value, $ , is added to the total cost). incrange (variable, r 1, v 1,... r n, v n, default) Inclusive Range This function compares the first parameter (variable) to a series of range values (r 1, r 2,... r n ) and returns the corresponding value for that range (v 1, v 2,... v n ). If none of the range values (r 1, r 2,... r n ) meet the criteria of the first parameter (variable) then the last parameter (default) is returned. The difference between this function and the range function is that this function compares the first parameter and each range value using less than or equal (<=) logic (i.e. if variable <= r 1 then return v 1, if variable <= r 2 then return v 2, etc.) Example. incrange(numitems, 2, 100, 4, 150, 6, 200, 250). The following table demonstrates the return value, added as a tax or shipping cost, based on differing amounts of total items ordered: Copyright Stores Online, Inc. 3

4 numitems (variable) value (v 1, v 2,... v n ) comments If a customer ordered two items, the value of $ would be returned (or added to the total price) If a customer orders over 6 items, the default value, $ , is added as the tax or shipping cost. Round (x, y) Round up or down In this formula, (x) is a number, such as a taxable percentage, and (y) is the decimal place to which you want to round, such as $1.00, $.10, or $.01 (these are whole, tenth, and hundredth decimal places, respectively, and are represented by the numerals 0, 1, and 2 within the formula). Example. round(subtotal * , 2). Now let s say a customer orders one product to which this order rule applies, costing $ The Store Builder will input this subtotal into the tax rule calculation as: $18.53 * = $ The $ tax will then be rounded to the hundredth, resulting in $1.57 tax. Floor (x, y) Force rounding down This function is similar to the Round function, in that (x) is a number, such as a taxable percentage, and (y) is the decimal place to which you want to round, such as $1.00, $.10, or $.01 (these are whole, tenth, and hundredth decimal places, respectively, and are represented by the numerals 0,1, and 2 within the formula). However, this function will round down according to the chosen decimal place ( y value). Example. floor(subtotal * , 2). Now let s say a customer orders one product to which this order rule applies, costing $ The Store Builder will input this subtotal into the tax rule calculation as: $18.53 * = $ The $ tax will then be rounded down to the hundredth, resulting in $1.56 tax. Ceiling (x, y) Force rounding up This function is also similar to the Round function, in that (x) is a number, such as a taxable percentage, and (y) is the decimal place to which you want to round, such as $1.00, $.10, or $.01 (these are whole, tenth, and hundredth decimal places, respectively, and are represented by the numerals 0,1, Copyright Stores Online, Inc. 4

5 and 2 within the formula). However, this function will round up according to the chosen decimal place ( y value). Example. ceiling(subtotal * , 2). Now let s say a customer orders one product to which this order rule applies, costing $ The Store Builder will input this subtotal into the tax rule calculation as: $18.53 * = $ The $ tax will then be rounded up to the hundredth, resulting in $1.57 tax. Formula Implementation Let's Do It: Add A Formula To The Ordering Rule Go to the Ordering Rules menu, and select the Edit button of the price set to which you wish to add a formula (See Fig 2). Fig 2: Edit Button of Ordering Rule Next, select the gray Shipping, Handling & Taxes tab. IMPORTANT NOTE! You may add a formula by two different methods: You may create a new rule containing the formula or you may add the formula to an existing rule. To execute the former option, follow all of the proceeding steps. If you wish to add a formula to an existing rule, skip the following two Standard Option ( ) steps, and continue with the Select the grey step. Then select the Add Rule button (See Fig 3). Fig 3: Add Rule Button You may now give the new rule a name and select the type of rule within the gray General tab. Select the gray Calculations tab, then select the Calculations To Add pull-down menu, and select the Formula option. Click the Add Calculation button (See Fig 4). Fig 4: Calculation To Add Pull-Down Menu Copyright Stores Online, Inc. 5

6 The Store Builder will then display a field where you may enter the unique formula (See Fig 5). Fig 5: Calculation To Add Pull-Down Menu Type the unique formula within this field and select the Done button (See Fig 6). Fig 6: Formula Field and Done Button Testing Your Rules Once you have added a formula to the ordering rule, the Store Builder allows you test its functionality. Let's Do It: Testing Your Ordering Rule Formula Go to the Ordering Rules menu, and select the Edit button of the price set containing the calculations you wish to test (See Fig 7). Fig 7: Edit Button of Ordering Rule Next, select the gray Shipping, Handling & Taxes tab. Then select the Test Rules button (See Fig 8). Fig 8: Test Rules Button Copyright Stores Online, Inc. 6

7 Enter values in the appropriate field which will allow your rules to function. For example, if your rule uses the subtotal variable, type in a sample subtotal, or if your rule uses the total number of items as the variable, type in a sample number, and so on. Then select the Recalculate button (See Fig 9). After you select the Recalculate button, the test rules results will be displayed below the variable fields. Fig 9: Order Rules Testing Page Formula Examples and Illustrations The following examples are to illustrate the possibilities of the ordering rule formula and offer a sample of different formulas. Example #1 Rounding for tax rules. Let s say you must tax at a rate of 8.45% of the subtotal and you must round to the nearest dime (tenth decimal place). In the formula box you would type in this formula: round(subtotal * , 1) Copyright Stores Online, Inc. 7

8 Now let s say a customer orders one product to which this order rule applies, costing $ The Store Builder will input this subtotal into the tax rule calculation as: $ * = $ The $ tax will then be rounded to the hundredth, resulting in $1. 60 tax added to the customer s order form. Example #2 Rounding up for tax rules. Let s say you must tax at a rate of 6.25% of the subtotal and you must round up to the nearest penny (hundredth decimal place) according to State tax laws. In the formula box you would type in this formula: ceiling(subtotal * , 2) Now let s say a customer orders five products to which this order rule applies, costing $5. 35 each. The Store Builder will input this subtotal into the tax rule calculation as: $ * = $ The $ tax will then be rounded up to the hundredth, resulting in $1.68 tax. Example #3 Division for shipments. Let s say you ship 4 units per box for a particular product and you charge a flat rate of $5. 00 / box. In the formula box you would type in this formula: div(numitems + 3, 4) * 5 Now let s say a customer orders 13 units of this particular product, the Store Builder will use this number within the formula as follows: ((13 + 3) / 4) * $5. 00 This will result in the customer paying $ for shipping charges and receiving 4 boxes of products: 3 boxes with 4 products and 1 box with 1 product. Example #4 Division for free products. Let s say you want to give away free 1 out of 8 for a particular product (buy 7, get the 8 th free). In the formula box you would type in this formula: div(numitems, 8) * This formula assumes you have selected this particular product in the condition list and the product cost is $ Now let s say a customer orders 16 units of this particular product, the Store Builder will use this number within the formula as follows: (16 / 8) * This will result in the customer receiving a $7. 00 discount for the items (or receiving two units of this product for free). Copyright Stores Online, Inc. 8

9 Example #5 Include Range for shipping costs. Let s say you charge an incremental shipping rate of $ for 3 pounds, $ for 6 pounds, $ for 9 pounds, and $ for 12 pounds. In the formula box you would type in this formula: incrange(weight, 3, 35, 6, 57, 9, 76, 12, 91) Now let s say a customer orders products having a total weight of 8 pounds, the Store Builder will use this weight within the formula as follows: 8<9, and therefore add $ This will result in shipping charges of $ added to the order form. Example #6 Range for shipping costs. Let s say you charge an initial shipping rate of $8. 00 for order subtotals under $59. 99, and any subtotal above $ receives a 7% shipping rate. In the formula box you would type in this formula: range(subtotal, 60, 8, 0.07*subtotal) Now let s say a customer orders products having a subtotal of $ , the Store Builder will use this subtotal within the formula as follows: $ > 60, therefore * 0.07 = $7. 35 This will result in shipping charges of $7. 35 added to the order form. Example #7 Including Range Weight. To calculate the shipping as a percentage of the subtotal, with a base shipping cost of $4. 00, you would use the following formula: (incrange(weight, 1,.1, 5,.15, 10,.18,.2) * subtotal) + 4 Weight (weight) Shipping (% of subtotal) 1 kg 10% up to and including 5 kg 15% up to and including 10 kg 18% More than 10 kg 20% Now let s say a customer orders products having a total weight of 8 kg and a subtotal of $ The Store Builder will use this total within the formula as follows: 8 < 10, therefore, $ * 0.18 = $ This will result in shipping charges of $ added to the order form. Copyright Stores Online, Inc. 9

10 Example #8 Range Subtotal. Let s say you want to add $4. 00 to orders less than $ and 8% to orders with a subtotal of $ and up.. In the formula box you would type in this formula: range(subtotal,49.99,4,.08*subtotal) Subtotal Shipping ($$ amount) $49.99 and less $ and over 8 % Example #9 Including Range Subtotal. The following formula will add a 5% discount to orders with a subtotal between $ and , and 10% discount to orders $ and up: incrange(subtotal, 19.99, 0, 49.99, -.05, -.10) * subtotal Subtotal ($$ amount) Discount (% of subtotal) $20.00 to % and over 10% Example #10 Range Subtotal. The following formula will add a 10% discount if the subtotal is $ or over: range(subtotal,50.00,0, -.10) * subtotal Now let s say a customer orders products having a subtotal of $98. 00, the Store Builder will use this subtotal within the formula as follows (remember, if the variable is larger than the prescribed range values, the default value (in this case -.10) will be returned): -.10 * = $ This will result in a discount of $9. 80, off of the subtotal. Example #11 Maximum Subtotal. This formula will allow you to set a minimum order amount. This example illustrates a $ minimum order amount: max(20-subtotal,0) For example, let s say a customer orders products having a subtotal of $13. 00, Store Builder will use this subtotal within the formula as follows: ( , 0) Because 7 is greater than zero, $7. 00 will be added to $ satisfying the $ minimum order amount. Copyright Stores Online, Inc. 10

11 Summing It Up The Store Builder Ordering Rule Formulas have limitless possibilities. However, if the above procedures, steps, and examples are unclear to you, read through the tutorial again and take time to go through the steps to create and test your own formulas. Your familiarity of formulas will increase and you will find that formulas are easy to create allowing for dynamic calculations within your ordering rules. In addition to this tutorial, read over Printable Tutorial 7.0 to gain a broad perspective of which rules will work best for your site. Copyright Stores Online, Inc. 11