Hello,
I have products with several combinations, each one has a minimum quantity and I just can increment by a multiple of the minimum quantity of such combination.
What I want is that when I choose a certain combination with a minimal quantity, I increment of the minimum quantity of the default combination.
For example:
Default :
400g white cloth, min qty 10 => multiple of 10
Others :
400g red cloth, min qty 100 = > multiple of 10
Instead of taking the minimum value of this product, it will be replaced by the value of the product with the default combination.
It is certainly possible to save the minimum value of the default combination when the page is loaded, and then, once you choose a combination, parameters are added to the url, the minimum value is updated, but not page charged.
I already have changed a part of my code to increment of a multiple of such quantity combination with this code :
// In processChangeProductInCart() of CartController
// collisage par qte min
if ((int)$this->id_product_attribute)
$minimal_quantity = Attribute::getAttributeMinimalQty($this->id_product_attribute);
else
$minimal_quantity = $product->minimal_quantity;
if ($this->qty % $minimal_quantity != 0)
{
$this->errors[] = Tools::displayError('You can only only add this item to your cart with a quantity multiple of ').' '.$minimal_quantity;
}
// fin col par qte min
// must be added after this
// If no errors, process product addition
if (!$this->errors && $mode == 'add')
{
// and before
// Add cart if no cart found
if (!$this->context->cart->id)
{
Someone to tell me if it seems possible?
Thank you for helping me.