Jump to content

[SOLVED] More info with "An item in your cart is no longer available"


pmikhey

Recommended Posts

Hi all!

Some of my clients are faced with problem at the checkout - for example, on monday, they added a number of products in the cart, then on friday decided to finish the order but at this moment, some products are no longer available for order (out of stock, for example).

They see the error from OrderController.php (Prestashop 1.5.2):

 

"An item in your cart is no longer available in this quantity, you cannot proceed with your order."

 

But this message does not contain any information on what exactly the product became unavaliable for order.

 

If the products in the cart was more than 3, there is a problem with figuring out - with what exactly products we have a problem?

 

 

If the client will know what products are not available - he can just delete them from cart and continue to order. So, how to display information about what specific products are not available for order from his cart?

 

(sorry for my english, please)

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

Looked at this, and as you can guess requires custom programming, but here is the code that would need to be modified:

 

OrderController.php

 // 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.');
 }

 

Cart.php

public function checkQuantities()
{
 if (Configuration::get('PS_CATALOG_MODE'))
  return false;
 foreach ($this->getProducts() as $product)
  if (!$product['active']|| (!$product['allow_oosp'] && $product['stock_quantity'] < $product['cart_quantity']) || !$product['available_for_order'])
   return false;
 return true;
}

 

Note the function checkQuantities will return false on first cart item not avail for order, i.e. it doesn't continue checking for other items that may not be available.

Link to comment
Share on other sites

Hi all!

Some of my clients are faced with problem at the checkout

....

But this message does not contain any information on what exactly the product became unavaliable for order.

....

If the products in the cart was more than 3, there is a problem with figuring out - with what exactly products we have a problem?

...

If the client will know what products are not available - he can just delete them from cart and continue to order. So, how to display information about what specific products are not available for order from his cart?

 

Hello pmikhey. I've developed a very cool module that will solve your problem. And because it is implemented as a module, it won't require any modification on your PS core (as you surely know, when less modifications/overrides on the core classes you do, the upgrade is easier).

 

If the client will know what products are not available - he can just delete them from cart and continue to order. So, how to display information about what specific products are not available for order from his cart?

 

The module also has an "Automatic adjustment" button. ;)

 

You can find it here:

Cart Details

 

I hope you find it useful.

 

Best Regards,

 

Axel

------------------

Check also this cool module (must have) :

LoginAsCustomer for PS1.5

  • Like 2
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...