Jump to content

PierPier

Recommended Posts

Hi all,

I checked around, but I cannot found a solution to this problem even if a lot of people asks about. If I miss the solution please share the link.

 

I need to solve the following issue:

 

I need that my customers buy a minimal number of items to complete the order procedure.

 

There are several shops that need this kind feature. Think for instance to a wineshop that sells 6 or more different bottles per order, but not less than 6 and additionally it has also different items that can be sold one by one.

 

I found this post that fix this problem (for older version of PrestaShop) making some mod in the code, but that mod does not work for newer versions.

 

I hope you can help me!!

 

Thank you all!!!

Link to comment
Share on other sites

Hi Richard,
I'm using PrestaShop 1.4. The minimum quantity in the product page imposes a minimum for that specific product/item, it says: "you have to buy X items of this kind to proceed". My problem is a little different cause it is not per-product, but per-order mininum quantity, this means that your order has to contain X items - in total - thus also of different kind.

Example: you have a Kitcheware Store, you sell dishes, cutlery and tablecloth so you have several types of dishes, cutlery and tablecloth. You do not care how the customer aggregate the items, but you want that he has to buy at least 4 dishes, at least 12 pieces of cutlery and at least 1 tablecloth. So, for instance, if the customer try to buy 2 dishes he cannot finalize the order, but if he try to buy 5 dishes and 1 tablecloth everything is good.

I hope this example explain my issue :-)

Do you know any module that solves this?

 

Modules that i find:

minimal order by groups and minimal product quantity

Link to comment
Share on other sites

really surprising that such an important feature is missing in Prestashop..........we are basically wholesalers and not retailers but still due to absence of this "Min Buy Quantity" feature we are selling one one item. Selling single item is not at all cost effective for us.

 

People here advice to use "min amount feature" but it is useless coz our pricing ranges are wide and moreover we are talking about min quantity to be purchased n not min products to be sold per order.

 

Hope some genius will solve our problem or at least Presta team will work over it.

Link to comment
Share on other sites

Here's a little mod to convert the total order amount minimum to a product quantity minimum (I will show how to modify the core file, you should create an override file if you plan on upgrading your shop).

 

This code is found in /controllers/OrderController.php (5 step checkout), or OrderOpcController.php (express checkout).

 

Current code (taken from PS 1.4.6.2)


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

$minimalPurchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
if (self::$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimalPurchase)
return '<p class="warning">'.Tools::displayError('A minimum purchase total of').' '.Tools::displayPrice($minimalPurchase, $currency).
' '.Tools::displayError('is required in order to validate your order.').'</p>';

 

New Code


/* Check minimal amount */
$minimalPurchase = (float)Configuration::get('PS_PURCHASE_MINIMUM');
if (self::$cart->nbProducts() < $minimalPurchase)
return '<p class="warning">'.Tools::displayError('A minimum purchase total of').' '.$minimalPurchase.
' '.Tools::displayError('Products is required in order to validate your order.').'</p>';

 

I haven't tested, but it should work.

Let us know how it goes.

Link to comment
Share on other sites

Thanks but unless n until it is tested and proven feels bit risky to try it.....

 

 

Here's a little mod to convert the total order amount minimum to a product quantity minimum (I will show how to modify the core file, you should create an override file if you plan on upgrading your shop).

 

This code is found in /controllers/OrderController.php (5 step checkout), or OrderOpcController.php (express checkout).

 

Current code (taken from PS 1.4.6.2)


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

$minimalPurchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
if (self::$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimalPurchase)
return '<p class="warning">'.Tools::displayError('A minimum purchase total of').' '.Tools::displayPrice($minimalPurchase, $currency).
' '.Tools::displayError('is required in order to validate your order.').'</p>';

 

New Code


/* Check minimal amount */
$minimalPurchase = (float)Configuration::get('PS_PURCHASE_MINIMUM');
if (self::$cart->nbProducts() < $minimalPurchase)
return '<p class="warning">'.Tools::displayError('A minimum purchase total of').' '.$minimalPurchase.
' '.Tools::displayError('Products is required in order to validate your order.').'</p>';

 

I haven't tested, but it should work.

Let us know how it goes.

Link to comment
Share on other sites

  • 2 weeks later...

tomerg3,

 

This is only helps if you want to make one product to be purchased at certain amounts, but the main idea here is to make the restriction for category. By doing this you will be able to buy products A, B, C from category Cat1 only of the whole quantity of all products (A, B, C) is a certain amount. In addition, there should be an ability to add different quantity restrictions for different categories.

Link to comment
Share on other sites

but the main idea here is to make the restriction for category

 

I did not see anyone ask about per category. while that is also possible, it requires more specific modification.

Hopefully what I posted can point whoever does need it to be category specific in the right direction...

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
  • 3 months later...

Here's a little mod to convert the total order amount minimum to a product quantity minimum (I will show how to modify the core file, you should create an override file if you plan on upgrading your shop).

 

This code is found in /controllers/OrderController.php (5 step checkout), or OrderOpcController.php (express checkout).

 

Current code (taken from PS 1.4.6.2)

 
/* Check minimal amount */
$currency = Currency::getCurrency((int)self::$cart->id_currency);
 
$minimalPurchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
if (self::$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimalPurchase)
return '<p class="warning">'.Tools::displayError('A minimum purchase total of').' '.Tools::displayPrice($minimalPurchase, $currency).
' '.Tools::displayError('is required in order to validate your order.').'</p>';
New Code


/* Check minimal amount */
$minimalPurchase = (float)Configuration::get('PS_PURCHASE_MINIMUM');
if (self::$cart->nbProducts() < $minimalPurchase)
return '<p class="warning">'.Tools::displayError('A minimum purchase total of').' '.$minimalPurchase.
' '.Tools::displayError('Products is required in order to validate your order.').'</p>';
I haven't tested, but it should work.

Let us know how it goes.

 

 

Sorry to bump a long dead thread, but I'm running 1.4.8.2 for a wholesale site and looking to retain the minimum by value as it exists in presta already....  but i don't see where PS_PURCHASE_MINIMUM can even be declared aside from injecting it into the database myself

Link to comment
Share on other sites

  • 1 year later...

I did not see anyone ask about per category. while that is also possible, it requires more specific modification.

Hopefully what I posted can point whoever does need it to be category specific in the right direction...

 

I know this is old post but I need exactly the minimum value (or quantity) by categories.

You say that is also possibile, could you tell me how?

Thank you.

Luciano

Link to comment
Share on other sites

As above I know its an old post but I also need to be able to restrict orders so they have to order in min quantities.

 

For instance we sell automotive gauges, in two different sizes (52 and 60mm) and 3 different face styles (Black Face, White Face and Clear Face).

There is then 10 different types of gauge for each of those (boost, oil pressure, water temp etc...)

 

Trade customers can order any type of gauge they want BUT the order total has to be a minimum order of 12 gauges.

 

 

If anyone know how I can make it so a customer has to order a minimum of 12 products from a particular category then I could make that work. 

 

 

If anyone can help please let me know!

 

 

Many Thanks

 

Simon

Link to comment
Share on other sites

  • 2 months later...
  • 9 months later...
  • 5 months later...

Hi,

 

I tested the change recommended for tomerg3 and working!!! It was tested in 1.6.1.3

 

Thanks tomerg3

 

Hello,

 

For you to know, i already test this solution in prestashop 1.6, and it's working perfectly validating the Order's total quantity of products.

 

Best regards,

 

Geoaguila

how did you did it? i cannot find /controllers/OrderController.php (5 step checkout), or OrderOpcController.php (express checkout). and cant find the line

Link to comment
Share on other sites

Here's a little mod to convert the total order amount minimum to a product quantity minimum (I will show how to modify the core file, you should create an override file if you plan on upgrading your shop).

 

This code is found in /controllers/OrderController.php (5 step checkout), or OrderOpcController.php (express checkout).

 

Current code (taken from PS 1.4.6.2)

 
/* Check minimal amount */
$currency = Currency::getCurrency((int)self::$cart->id_currency);
 
$minimalPurchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
if (self::$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimalPurchase)
return '<p class="warning">'.Tools::displayError('A minimum purchase total of').' '.Tools::displayPrice($minimalPurchase, $currency).
' '.Tools::displayError('is required in order to validate your order.').'</p>';
New Code


/* Check minimal amount */
$minimalPurchase = (float)Configuration::get('PS_PURCHASE_MINIMUM');
if (self::$cart->nbProducts() < $minimalPurchase)
return '<p class="warning">'.Tools::displayError('A minimum purchase total of').' '.$minimalPurchase.
' '.Tools::displayError('Products is required in order to validate your order.').'</p>';
I haven't tested, but it should work.

Let us know how it goes.

 

how about PS 1.6? Help me please  :(

Link to comment
Share on other sites

  • 3 months 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...