[-] FO : #PSTEST-981 - Minimal quantity not setted correctly on combibination

This commit is contained in:
mDeflotte
2012-03-07 15:13:30 +00:00
parent 776a40e47a
commit 83b3d0dd1c
5 changed files with 9 additions and 5 deletions
@@ -253,7 +253,7 @@
<label>{l s='Minimum quantity:'}</label>
</td>
<td style="padding-bottom:5px;">
<input size="3" maxlength="6" name="minimal_quantity" id="minimal_quantity" type="text" value="{$minimal_quantity}" />
<input size="3" maxlength="6" name="attribute_minimal_quantity" id="attribute_minimal_quantity" type="text" value="{$minimal_quantity}" />
<p>{l s='The minimum quantity to buy this product (set to 1 to disable this feature)'}</p>
</td>
</tr>
@@ -207,7 +207,7 @@
<p class="preference_description">{l s='The minimum quantity to buy this product (set to 1 to disable this feature)'}</p>
</td>
</tr>
{/if}
{/if}
<tr>
<td class="col-left"><label>{l s='Displayed text when in-stock:'}</label></td>
<td style="padding-bottom:5px;">
+3
View File
@@ -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),
@@ -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);
}
+1 -1
View File
@@ -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);