News:

Support the VirtueMart project and become a member

Main Menu

Cart Quantity Step

Started by mmp, July 06, 2015, 14:45:14 PM

Previous topic - Next topic

mmp

Hello,

I would like to know if there is a way that you can set the shopping cart to need quantities in multiples of 4 but not 4 of a spastic item but 4 of any item. Is there any way that this can be done?

Thanks

John2400

Hi ,
not sure of the "spastic" item mentioned.

Of cause you could look here - http://extensions.virtuemart.net/products/quantity-related-price-calculation-detail

* or are you after that the customer must buy 4 items - any items but must buy 4 before the purchase goes through.

* or use the option shown in the image attached

* or are you after selling 4 items ( and maybe you develop a package or 4 things and only sell that way)

* sorry if I misunderstood

mmp

#2
HI John

ok so say that my client is selling 20 different bottles of wine, and they package said bottles in a box, but the box can only take 4 at a time ok. for the client to ship 1 or 3 or 6 or 13 would be difficult, so they want it that customers are only able to buy in multiples of 4 so they can buy 4 of any bottle of wine does not need to be the same bottle can be different, but they must buy 4, 8, 12, 16, 20 and so forth. does that make it a bit more clear on what i would like to do? is there a way to do this? adding 4 to the product steps does not really help as then a customer will need to buy 4 of one type of wine.

Hope this now makes sense.

John2400

I know this might sound silly but most stores just say..

4 of any kind .. we only ship in multiples of 4 .( yes I understand what you want to do)

or set a price minimum on the cart ..

http://extensions.virtuemart.net/products/quantity-related-price-calculation-detail

this extension allows you to play with lost of options in Multiples..


mmp

Hi John

At the moment the client is not willing to pay for an aditional module for the store, so this is not an option at the moment.
Can you maybe then help me out with the best way to have a notification pop up once the customer goes into the cart that will allow me to state there that we only shit in multiples of 4.

Thanks

AH

You can sort of do this using the existing shipping method - however it would be cumbersome if your shipping values vary by destinations - but it will work without any plugin or coding

Just set a number of methods up

And set the Minimum number of products and Maximum number of products to be the package sizes

so - 4-4
8-8
16-16
20-20

etc

When a user goes to the cart without the matching number of products you will see the message that no shippingmethods match

Change this message to be more explanatory regarding quantities in the cart





Regards
A

Joomla 3.10.11
php 8.0

AH

If you wanted to code to make it easier

You can change plugins/vmshipment/weight_countries/weight_countries.php

And modify the function below:-


/**
* @param $cart
* @param $method
* @return bool
*/
private function _nbproductsCond ($cart, $method) {

if (empty($method->nbproducts_start) and empty($method->nbproducts_stop)) {
//vmdebug('_nbproductsCond',$method);
return true;
}

$nbproducts = 0;
foreach ($cart->products as $product) {
$nbproducts += $product->quantity;
}

if ($nbproducts) {

$nbproducts_cond = $this->testRange($nbproducts,$method,'nbproducts_start','nbproducts_stop','products quantity');

} else {
$nbproducts_cond = false;
}

return $nbproducts_cond;
}




Returning "false" based on your requirements

You could even use the value from the Minimum number of products parameter as the input to the calculation - if you wanted more flexibility - rather than hard coding
Regards
A

Joomla 3.10.11
php 8.0