Jump to content

Minimum quantity total products. PS1.4


Yoriel79

Recommended Posts

Hi.

In OrderController.php (around line 56 ) I have replace

this

       /* Check minimal amount */
       $currency = Currency::getCurrency((int)self::$cart->id_currency);

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

       if ($orderTotal < $minimalPurchase)
       {
           $this->step = 0;
           $this->errors[] = Tools::displayError('A minimum purchase total of').' '.Tools::displayPrice($minimalPurchase, $currency).
           ' '.Tools::displayError('is required in order to validate your order.');
       }




by

       /* Check minimal amount */
       $currency = Currency::getCurrency((int)self::$cart->id_currency);

       $nbProds = self::$cart->getnbProducts();
       $minimalPurchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'));

       if ($nbProds < $minimalPurchase)
       {
           $this->step = 0;
           $this->errors[] = Tools::displayError('A minimum purchase total of').' '.Tools::displayPrice($minimalPurchase, $currency).
           ' '.Tools::displayError('is required in order to validate your order.');
       }



It works! but if I activate the debug mode in confing.inc.php, my website get me the following message,

"Warning: Missing argument 1 for CartCore::getNbProducts(), called in /Applications/MAMP/htdocs/prestashop/controllers/OrderController.php on line 59 and defined in /Applications/MAMP/htdocs/prestashop/classes/Cart.php on line 448"

What is the problem? What can I do?

Sorry for my english,

Thanks.

Link to comment
Share on other sites

Its works!!!
Thank you very much.

Finally I replaced

       /* Check minimal amount */
       $currency = Currency::getCurrency((int)self::$cart->id_currency);

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

       if ($orderTotal < $minimalPurchase)
       {
           $this->step = 0;
           $this->errors[] = Tools::displayError('A minimum purchase total of').' '.Tools::displayPrice($minimalPurchase, $currency).
           ' '.Tools::displayError('is required in order to validate your order.');
       }



for

       /* Check minimal amount */
       $nbProds = self::$cart->nbProducts();
       $minimalPurchase = Configuration::get('PS_PURCHASE_MINIMUM');

       if ($nbProds < $minimalPurchase)
       {
           $this->step = 0;
           $this->errors[] = Tools::displayError('A minimum purchase of').' '.Tools::displayError($minimalPurchase).
           ' '.Tools::displayError('products is required in order to validate your order.');
       }



Thank you.

Link to comment
Share on other sites

  • 7 months later...
  • 1 month later...
  • 1 year 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...