News:

Looking for documentation? Take a look on our wiki

Main Menu

Minimum Purchase Quantity by Shopper group

Started by rayge, June 24, 2015, 13:19:12 PM

Previous topic - Next topic

rayge

I need to set things like Minimum, maximum Purchase Quantity and Purchase Quantity Steps for certain products BUT they need to be restricted to specific shopper groups.

Is there a way to handle this?
I Use: Joomla 3.4.1 & VM 3.0.9

rayge

OK here is what i came up with. in productdetails/default_addtocart.php I Added the following code:
//Product array for items that should use Min/step order globally
$exception_sku_array = array(
'QB12',
);
//$user = JFactory::getUser();
//SET MIN ONLY for WHOLSALE except for specific product skus
$usermodel = VmModel::getModel ('user');
$currentVMuser = $usermodel->getCurrentUser();
$currentVMuser->shopper_groups[] = '0'; //This allows pricing for ALL Shopper groups to appear
$virtuemart_shoppergroup_ids = $currentVMuser->shopper_groups;
$virtuemart_shoppergroup_id_str = implode(',',$virtuemart_shoppergroup_ids);
if(
$virtuemart_shoppergroup_ids[0]!='4' //Replace this with your expected shopper ID
&&
!in_array($this->product->product_sku, $exception_sku_array)
) {
$this->product->min_order_level = '1';
$this->product->step_order_level = '1';
}


i added it before this line:
if ((!empty($this->product->customsChilds)) || (!empty($this->product->customfieldsCart))) { ?>

and it seems to be working how i want.
I Use: Joomla 3.4.1 & VM 3.0.9

rayge

#2
THis isnt working how i had hoped although the FIELD is changed by shopper group, since the ADMIN data shows a minimum quantity it seems to override anything in the front end. there needs to be a session variable or something i can override to handle changing the admin set minimum to 1 instead for retail customers.

has anyone else had to deal with this and what was the solution?

UPDATE: The workaround solution i have come up with is to have 2 products for each product needing to have a specific minimum quantity for each group.. 1 for retail customers and 1 for wholesale.
This SUCKS but it seems to be the best way without having a LOT of code.
I Use: Joomla 3.4.1 & VM 3.0.9

Khaostar

Hi!

Sorry for bumping the post, but I have the exact same need.

I want to have a minimum quantity for some products depending on the shopper group. Actually, I have to create multiple products to do that. That's a pain. And I don't want to do custom hacks.

Does anyone have a solutuon for this? A plugin maybe?

Thanks!

jenkinhill

I have done this using shopper group specific products, but as you say, it does mean cloning & editing each product. I know of no plugin to do this.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

ARTIFIEDWEB

I know that this is an old thread but we have created a plugin that does exactly this.
You can set rules for min purchase quantity, max purchase quantity, purchase step.
You can select which products, manufacturers or categories these rules will apply to.
And you can set these rules for one or more shopper groups.

If anyone is interested, contact me at george[at]artupweb[dot]com
Websites that STAND OUT!
Contact me if you want an amazing upgrade

Leone

#6
An example illustrates the combined use of the minimum purchase and staggered values: The minimum order quantity for the item "Wine Châteauneuf-du-Pape red" is 6 bottles for end customers and the article can be purchased in a staggered 6 bottles. The B2C customer can therefore choose between 6, 12, 18, 24, etc. bottles in your shop. However, B2B customers (e.g. restaurants) can only order the identical item from a minimum purchase of 30 bottles, the staggering for them is 12 bottles. So you can order 36, 42, 54, 66 etc. bottles in your shop.