Jump to content

Multiple of the default product quantity of combinations


omhesgwsopmjg

Recommended Posts

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.

Edited by toeuvray (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...
  • 6 months later...
  • 1 year later...
  • 10 months later...

solution is here:

minimum product quantity module that accepts only defined values (multiplied like 5,10,15,20 or 10,20,30,40,50 or 50,100,150,200 etc.)

 

Hi Vekia

 

Your module seems be the one I'm looking for unfortunately the demo site you propose doesn't seems to have this module installed :(

 

Is the module compatible with multiple store ?

 

Thanks

Link to comment
Share on other sites

  • 4 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...