Jump to content

Set minimum order (purchase) for customers group prestashop 1.6


vucumbra

Recommended Posts

Maybe someone need this edit

 

in /controllers/front/OrderController.php

 

edit around 67 line from:

$orderTotal = $this->context->cart->getOrderTotal();
        $minimal_purchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);

to

$orderTotal = $this->context->cart->getOrderTotal();
        $minimal_purchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
        
        //Edit by VuCumBra
        $customer = new Customer((int)(self::$cookie->id_customer));
		$groupes = $customer->getGroups();
		if ($groupes[0]==3)
		{
                    $minimal_purchase=300;	
		}

Just change the id group 

if ($groupes[0]==3)

and the minimim amount

$minimal_purchase=300;

 

 

Hope this help :)

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

Yes you are right veckia sorry

i have used in_array it's correct now?

//Edit by VuCumBra
        $customer = new Customer((int)(self::$cookie->id_customer));
		$groupes = $customer->getGroups();
                
                if (in_array("4", $groupes)) {
                    $minimal_purchase=0;
                }
                else
                {
                    $minimal_purchase=300;	
		} 
Edited by vucumbra (see edit history)
Link to comment
Share on other sites

  • 2 years later...

Hi,
In PS 1.6.1.14  I've changed 

      

 $orderTotal = $this->context->cart->getOrderTotal();
        $minimal_purchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);

to
       

        $orderTotal = $this->context->cart->getOrderTotal();
        $minimal_purchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
         $customer = new Customer((int)(self::$cookie->id_customer));
        $groupes = $customer->getGroups();
                
                if (in_array("48", $groupes)) {
                    $minimal_purchase=50;
                }
                else
                {
                    $minimal_purchase=0;    
        } 



where "48" is the ID for a custom group that should have the limitation of a minimum purchase of 50 pieces.

Nothning happens.
I've also tryed to put it as an ovveride in /override/controllers/front (and I've deleted /cache/class_index.php).

What behavior should I expect instead?
A warning text?

 

Link to comment
Share on other sites

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...