Our site www.viart.com site is operated by latest Viart Shop 5 with default Clear design
ViArt User's Guide (Version 3.6)
Please, see the list of all new features and fixed bugs that were made to all ViArt PHP Shopping Cart releases from version 2.1.1 up to the latest 3.5 version.
5.1. Quantity Control
5.1. Quantity Control
Prev Index Next

Overview

By default every product in ViArt Shop has quantity control. Quantity Control settings are located in Products > Products Settings > 'Appearance' tab. Here you can regulate how Qty will be displayed on products listing page, on products details page and on basket.

Quantity Control settings

There are 4 choices available:

  • None- means there won't be displayed the Qty option on this page.
  • Label - means the Qty control will be displayed in the form of a static, uneditable value. The value of the label will equal the minimum allowed quantity of this product (be default it is '1').
  • ListBox - means the Qty control will be in the form of a drop down box. Please note, by default user is proposed to select quantity from 1 to 10 however you can change these quantity values individually per product in Products > Top > Edit Product (see section 4.5.5).
  • TextBox - means user has to type the desired quantity of the product in a text box.

FAQ

How to change default quantity control amount?

You can increase the number of allowed values, for example from 10 to 15 (e.g. 1, 2, 3, 4 ...15) by editing a "set_quantity_control" function within includes/shopping_cart.php - open this file and change the quantity amount in the below string:
$increment_limit = 9;
where 9 is the maximum amount of a product you allowed your clients to add to the shopping cart +1. Therefore for the example above you'll need to set $increment_limit = 14;

Is it possible to have such values in Qty control as 1, 5, 15, 30 etc.?

No, by default with the help of Quantity Increment field (see section 4.5.5) you can increase quantity control only on a measured amount, for example on '5' (5, 10, 15, 20 ...) or '15' (15, 30, 45, 60 ...) but not first on '4' then on '10' etc.

Examples

How to set the quantity 5, 10, 15, 20, 25 for all products at once?

Open 'shopping_cart.php' script and change the "set_quantity_control" function like this:

function set_quantity_control($quantity_limit, $stock_level, $control_type, $min_quantity = 5, 
$max_quantity = "25", $quantity_increment = 1)
	{
		global $settings, $t;
		$quantity_control = "";
		if (!$min_quantity) { $min_quantity = 5; }
		if (!$quantity_limit || $stock_level > $min_quantity) {
			if ($quantity_increment < 1) { $quantity_increment = 5; }
			
 if (strtoupper($control_type) == "LISTBOX") {
				$increment_limit = 4;

How to set qty for all products as 1, 10, 100?

Find in the 'includes' folder 'shopping_cart.php' script and comment out the below string like this:

//for ($i = $min_quantity; $i <= $show_max_quantity; $i = $i + $quantity_increment) {

Then right below this line add the following string:

for($i=1;$i<=100;$i=$i*10){

How can I set my own minimum quantity so for example the quantity will be 5, 25, 50, 75, 100?

You will need to edit 'shopping_cart.php' to make this possible. Find the following line:

$quantity_control .= "<option value=\"" . $i ."\">" . $i . "</option>";

and replace it with:
if ($i == $min_quantity) {
	if ($quantity_increment > 1) {
		$quantity_control .= "<option value=\"" . $i ."\">" . $i . "</option>";
		$i = $quantity_increment;
		$quantity_control .= "<option value=\"" . $i ."\">" . $i . "</option>";
	} else {
		$quantity_control .= "<option value=\"" . $i ."\">" . $i . "</option>";
	}

} else {
	$quantity_control .= "";
}
After this small change you can set in Products > Top > Edit Product (see section 4.5.5) Minimum Quantity as '5', Maximum Quantity as '100' and Quantity Increment as '25' and the quantity for this product will be 5, 25, 50, 75, 100.
Prev Index Next