Jump to content

Minimal total product quantity in cart


Inform-All

Recommended Posts

Hi!

 

I've changed my prestashop to a point where customers can order decimal quantity of products. This works just perfect, no problems there! :)

 

But when a customer orders just any random decimal quantity below 1, the checkout cart remains empty. So let's say I order two different products of 0,50 (or more) quantity, it works fine. But if I order one product of 0,50, it says my cart is empty. To make it short, if total amount of products in cart is <1 the cart seems to be empty. If total amount of products in cart >1 it works fine!

(I am talking about the 5 step checkout, the Ajax-Cart always works perfect!

 

Thanks for the help in advance :)

Link to comment
Share on other sites

Fixed it for prestashop 1.5.4 :

 

controllers/front/Ordercontroller.php make these changes starting from line 42:

 */
public function init()
{
 global $orderTotal;
 parent::init();
 $this->step = (int)(Tools::getValue('step'));
 if (!$this->nbProducts < 0)
  $this->step = -1; 
 // If some products have disappear
 if (!$this->context->cart->checkQuantities())
 {
  $this->step = 0;
  $this->errors[] = Tools::displayError('An item in your cart is no longer available in this quantity. You cannot proceed with your order until the quantity is adjusted.');
 }
 // Check minimal amount
 $currency = Currency::getCurrency((int)$this->context->cart->id_currency);
 $orderTotal = $this->context->cart->getOrderTotal();
 $minimal_purchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
 if ($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimal_purchase && $this->step > +1)

 

And then go to your payment method module for the last step.

In de case of bankwire modules/bankwire/views/templates/front/payment_executions.tpl

change this on line 34

{if $nbProducts < 0}
<p class="warning">{l s='Your shopping cart is empty.' mod='bankwire'}</p>

 

Hopes this helps people in the future :)

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Hi Bolinga, how did you change prestashop to make decimal quantities of products orderable? Would ygreatly appreciate you sharing :)

thanks in advance.

 

Nevermind found your other post where oyu explain how to, thanks for this. Here's the post for reference if anyone needs it -> http://www.prestashop.com/forums/topic/93968-change-order-quantity-to-a-decimal-value/page-2?do=findComment&comment=1227419

Edited by defuzed (see edit history)
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...