diff --git a/admin-dev/themes/default/template/controllers/products/combinations.tpl b/admin-dev/themes/default/template/controllers/products/combinations.tpl index 43f96261e..61979e926 100644 --- a/admin-dev/themes/default/template/controllers/products/combinations.tpl +++ b/admin-dev/themes/default/template/controllers/products/combinations.tpl @@ -253,7 +253,7 @@ - +

{l s='The minimum quantity to buy this product (set to 1 to disable this feature)'}

diff --git a/admin-dev/themes/default/template/controllers/products/quantities.tpl b/admin-dev/themes/default/template/controllers/products/quantities.tpl index a4dffb18b..cd1fff1c3 100644 --- a/admin-dev/themes/default/template/controllers/products/quantities.tpl +++ b/admin-dev/themes/default/template/controllers/products/quantities.tpl @@ -207,7 +207,7 @@

{l s='The minimum quantity to buy this product (set to 1 to disable this feature)'}

- {/if} + {/if} diff --git a/classes/Combination.php b/classes/Combination.php index e2a408c4f..bb6c55094 100644 --- a/classes/Combination.php +++ b/classes/Combination.php @@ -44,6 +44,8 @@ class CombinationCore extends ObjectModel public $price; public $ecotax; + + public $minimal_quantity = 1; public $quantity; @@ -69,6 +71,7 @@ class CombinationCore extends ObjectModel 'ecotax' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'size' => 20), 'quantity' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'size' => 10), 'weight' => array('type' => self::TYPE_INT, 'validate' => 'isFloat'), + 'minimal_quantity' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'default_on' => array('type' => self::TYPE_INT, 'validate' => 'isBool'), 'available_date' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat'), 'reference' => array('type' => self::TYPE_STRING, 'size' => 32), diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 566dd9812..88a7db2a5 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -615,7 +615,7 @@ class AdminProductsControllerCore extends AdminController Tools::getValue('attribute_default'), Tools::getValue('attribute_location'), Tools::getValue('attribute_upc'), - Tools::getValue('minimal_quantity'), + Tools::getValue('attribute_minimal_quantity'), Tools::getValue('available_date_attribute')); Hook::exec('actionProductAttributeUpdate', array('id_product_attribute' => (int)$id_product_attribute)); @@ -648,7 +648,8 @@ class AdminProductsControllerCore extends AdminController Tools::getValue('attribute_ean13'), Tools::getValue('attribute_default'), Tools::getValue('attribute_location'), - Tools::getValue('attribute_upc') + Tools::getValue('attribute_upc'), + Tools::getValue('attribute_minimal_quantity') ); $this->updateDownloadProduct($product, 0, $id_product_attribute); } diff --git a/controllers/front/CartController.php b/controllers/front/CartController.php index 44b4ea2e6..bcdf1eb31 100644 --- a/controllers/front/CartController.php +++ b/controllers/front/CartController.php @@ -225,7 +225,7 @@ class CartControllerCore extends FrontController { // If product has attribute, minimal quantity is set with minimal quantity of attribute $minimal_quantity = ($this->id_product_attribute) ? Attribute::getAttributeMinimalQty($this->id_product_attribute) : $product->minimal_quantity; - $this->errors[] = Tools::displayError('You must add').' '.$minimal_quantity.' '.Tools::displayError('Minimum quantity'); + $this->errors[] = Tools::displayError('You must add', false).' '.$minimal_quantity.' '.Tools::displayError('Minimum quantity', false); } else if (!$updateQuantity) $this->errors[] = Tools::displayError('You already have the maximum quantity available for this product.', false);