# Quantity Plugin

### Some notes to the virtuemart calculation rules system in general

It is quite easy to stumble over the calculation rule system, when you are not used to it. The power of the calculation systems is in its variety of combinations. The most interesting attributes to combine are usually the product categories and the shoppergroups. Consider that you can use unpublished product categories, to layout an hidden structure about your products and to create with it a fine grained calculation.

Lets assume you have a lot different products, from different manufacturers, but mostly of 3 different distributors. Lets assume the quantity discount depends mainly by the category and the distributor. Then add for each distributor a category and set it to unpublished. Then you can add this category to your product. It is not visible in the Frontend, but the rules are working with it.

The same with sizes. Lets assume you sell beer. In germany we have as package size 6, 12, and 20. Of course you like it when the people by “even” numbers. So you can create three rules, combine it with the quantity =6, =12 and, =20 and connect it to a category size6, size12, size20. Add these categories then to your products.

For more information about the rule system please read http://docs.virtuemart.net/manual/17-products-menu/30-taxes-and-calculation-rules.html

### Installation

- Install the plugin with the Joomla Extension Manager
- Enable the plugin named iStraxx Quantity with the Plug-in Manager

How to use it

- Go in VirtueMart administration, choose the menu
*Products*>*Taxes and Calculations rules*. - Create a new rule. At the bottom of the page, the new calculation options are displayed.

### Amount Condition

When you use the min/max option or the table, then this field is usually empty. You can enter a value with "=" or % to define different modes.

- "=" means that the rule is only used, when the ordered amount is exactly the entered one. For example =5 is valid only when the product quantity is 5.
- "%" is used for a modulo. This means that every quantity dividable by the entered value is valid for the rule. For example use %6 to give a discount for "six packs".

When you use the min/max limit, then you can create a table. The overwrite value is used then.

### EXAMPLE 1: Create a discount of 2% for each 6 packs

- Create a rule with "Type of Arithmetic Operation" = "Price modifier after tax"
- Use as Math Operation "-%"
- Use as Value 2
- Amount Condition Modus= %6

EXAMPLE 2: create a discount of 2% for each 6 packs and quantity > 15

- Create a rule with "Type of Arithmetic Operation" = "Price modifier after tax"
- Use as Math Operation "-%"
- Use as Value 2
- Amount Condition Modus= %6
- Set min to 15

When you use Amount Condition %5 and one row for the table with min=6 max=15 and no overwrite value, then only the quantities 10,15 are discounted by 2%.

Lets assume you set for the Amount Condition nothing and you add a table like this:

min = 5, max = 20, no overwrite value

min = 21, max = 50, overwrite value =5

min = 50, max = , overwrite value = 10

Then every quantity from 5-20 is discounted by 2% and from 21 to 50 discounted by 5% and more than 50 by 10%

Use “Add a min/max limit” to add a new row.

### How to display the resulting quantity diagram in Product details

If you use "Rule per product" you can display a discount table on product details. Activate via checkbox to display.

Note: when your rule does not start with min = 0: insert dummy line min = 1, max = 1 it will not be shown and rule will load properly.

Depending on your settings you can display several table variants:

### How to combine quantities of categories and/or variants

You can combine quantities of different products. Just use "Consider categories and manufacturers for the value" and or "Combine childs/Variants".

### FAQ:

**Q:** I get a message like:

vmError: vmTable loadTable 'xx.yy_virtuemart_calc_plg_istraxx_quantity' doesn't exist SQL=SELECT `yy_virtuemart_calc_plg_istraxx_quantity`.* FROM `yy_virtuemart_calc_plg_istraxx_quantity` WHERE yy_virtuemart_calc_plg_istraxx_quantity.`virtuemart_calc_id` = "zzz"

**A:** this just means that you need to store some calculation rule one time, the missing table is then created.

**Q:** My rule is set up correctly but neither the price changes nor the quantity table appears, what to do?

**A:**Ensure the calculation rules are assigned properly to product, browse the administration product details and check calculation rules and tax rules to be set as "

*apply default rules*" and "

*apply generic rules*"