# Calculating Price from Attributes Plugin Guide

With “Calculating Price from Attributes Plugin” the store owner can define complex formula using product’s attributes price values, product’s attributes weight values and static values to dynamically calculate the price of the product depending on the product’s attributes chosen by the customer. The following is a quick guide for the plugin and at the end is the link for the DEMO VERSION.

By enabling the plugin, if a formula has been defined by the store owner for a product, the mentioned product’s price would be calculated by the formula and if a product does not have a defined formula, then the product’s price would be determined by the store’s default methods. After enabling the plugin, the store owner defines and relate different attributes with different values to the product. The store owner can define the “static values” from admin panel > plugins > Formula Static Values. Store owner can use these static values in their formula (only 10 static values can be defined, from s1 to s10). After defining attributes and static values, the store owner can define the formula by using the “Formula” tab in the product’s edit detail page. A list of available variables is shown under the formula field. The store owner can define the formula using the mathematical operators (+, -, *, /, %) and “IF” statement using the “IF((Condition), (True Part), (False Part))”structures. With “IF” statements the store owner can make complex formulas like IF((a11>a12), (a11*10), (a12-2)).

As a result, the product’s price value would be dynamically calculated by the defined formula depending on the customer’s attribute choosing. The fowling is a list of supported operators and functions and examples as to how to use them in the formulas.

 Operator Usage Example + Addition a11+a12 - Subtraction a11-a12 * Multiplication a11*a12 / Division a11/a12 % Modulus a11%a12 < Lesser than IF ((a11 Gtreater than IF ((a11 Not equal IF ((a11<>a12), a1, a2) <= Lesser than OR equal IF ((a11<=a12), a1, a2) >= Grater than OR equal IF ((a11>=a12), a1, a2) AND Returnes true if both statements are true IF (((a11>10) AND (a12<5)), a1, a2) OR Returns true if one of the statements is true IF (((a11>10) OR (a12<5)), a1, a2) NOT Returnes true if statement is flase IF ((NOT (a11 = 10)), a1, a2) IN Variable is in the values IF (((a11) IN (10, 14, 20)), a1, a2) LIKE Variable matches a pattern IF(((Convert(a11, 'System.String')) LIKE ('1%')), a4, a7) IS [NOT] NULL - IF(((a11) IS [NOT] NULL), a1, a2)

 Function Usage Example IF IF statment IF((a11), a1, a2) CONVERT Converts a variable type to another Convert(total, 'System.Int32')

A demo version of this plugin is available. Please use the information below to enter the admin panel and review the formula settings.