Basic QwikPrice Calculations MKB - 0068 Follow
The following 3 examples are meant to give the beginner a basic overview of QwikPrice.
QwikPrice is often used to calculate items such as price and weight, but can also be used to calculate and perform other calculations such as tax, and shipping.
Example 1
This form will include a Menu field (for quantity) and a Qwikprice field (for total price).
In plain English this example shows, "The total price equals the quantity times 0.01"
Form View
NOTE: Notice below that in this example we are formatting our total price as a dollar amount using the function dollar(expression). See a list of all available functions at the bottom of this post.
Edit View
Notice in the Quantity field we've added a @=# to the back of each line. This is not shown to the customer. You must have a "behind the scenes" value for each possible selection so that we can easily reference them later on in the "IF" statements.
Example 2
The form will include a Menu field (for quantity) and a Qwikprice field (for weight).
In plain English this example shows, "If the quantity selected is ### then the weight is ###"
Form View
Edit View
In plain english, the weight formula below reads, "If Quantity equal 0, then Weight equals 0 OR if Quantity is 100 than Weight equals 0.2 OR if the Quantity is 250 that the Weight equals 0.5 etc. Be sure to end the formula with a 0 which tells the system the formula is complete.
NOTE: This example can be easily used for calculating a dollar amount instead of a weight by wrapping the entire formula between dollar(paste-entire-formula-here). See a list of all available functions at the bottom of this post.
Example 3
This example will be based on 2 conditions, color and quantity.
This form will include 2 menu fields (color and quantity) and 1 QwikPrice field (price)
In plain English this example shows, "If the envelope type selected is ### and the quantity is ### then the total is ###"
Form View
Remember: we must set a "behind the scenes value" for all items in the menu list.
Edit View
Functions
Replace expression with a field or formula.
cent - Rounds a number to 2 decimal places.---cent(expression)
Math.round - Rounds to a whole number.---Math.round(expression)
Math.floor - Rounds to largest previous whole number.---Math.floor(expression)
Math.ceil - Rounds to smallest next whole number.---Math.ceil(expression)
thousands - Formats number with commas.---thousands(expression)
dollar - Formats number with $ and commas.---dollar(expression)
pound - Formats number with £ and commas.---pound(expression)
percent - Formats number as a percent using % symbol.---percent(expression)
Note: Do NOT combine the dollar(), pound(), cent(), or thousands() functions.
Additionally, while using QwikPrice you can set this equal to a string (text) rather than just numbers.
There are several uses for this, for example, the Web2Plan integration of displaying information to the person ordering.
Results of the code above