Site maintenance: Tuesday 17 Nov, from 10:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / General Questions / Overselling of product, negative stock

Overselling of product, negative stock

Locked

Started by deb on 20 Jan 2007, 3:22 PM · Views: 5,405

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
20 Jan 2007, 3:22 PM
#1
deb avatar

deb

New Zenner

Join Date:
Jul 2006
Posts:
72
Plugin Contributions:
0

Overselling of product, negative stock

Hi,

I've checked the forums for the answer found two posts but no answer.

Got an order today and customer was able to order more than we have in stock. Which is strange because yesterday when I placed an order if something was out of stock I could not order that quantity or at least it gave me a warning to adjust the quantity.

Is there a patch, fix or module to prevent overselling from happening? Thanks :)

20 Jan 2007, 3:31 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Overselling of product, negative stock

If you got this warning earlier then your settings must be correct.....

Can you provide a url to see this??

Zen-Venom Get Bitten

20 Jan 2007, 3:40 PM
#3
deb avatar

deb

New Zenner

Join Date:
Jul 2006
Posts:
72
Plugin Contributions:
0

Re: Overselling of product, negative stock

Thanks, sure.

http://www.cropaddict.com/shop/

Zen has taken it out of stock now but allowed her to purchase 28 over the quantity. Not sure how that was possible.

I tested this am and get this message which she should have gotten also:

Products marked with *** are out of stock.
Items not in stock will be placed on backorder.

But I'd like to adjust it and prevent oversells since only a few items will be restocked.

20 Jan 2007, 3:51 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Overselling of product, negative stock

You currently have this indicated -

Products marked with *** are out of stock.
Items not in stock will be placed on backorder.
Try checking what your setting is for: admin > config > stock > Allow Checkout
If set to true = Allow customer to checkout even if there is insufficient stock

Set to false and see if this changes this ability

Zen-Venom Get Bitten

20 Jan 2007, 3:56 PM
#5
deb avatar

deb

New Zenner

Join Date:
Jul 2006
Posts:
72
Plugin Contributions:
0

Re: Overselling of product, negative stock

I found it! :)

I needed to Configuration Stock Allow Checkout to false so that backorders are not possible. :)

20 Jan 2007, 3:57 PM
#6
deb avatar

deb

New Zenner

Join Date:
Jul 2006
Posts:
72
Plugin Contributions:
0

Re: Overselling of product, negative stock

LOL I played around and found it before I read your last post. Thanks Kobra!

You guys are the best! :D

20 Apr 2009, 5:29 PM
#7
augustlately avatar

augustlately

New Zenner

Join Date:
Mar 2007
Posts:
7
Plugin Contributions:
0

Re: Overselling of product, negative stock

This happened to me recently even though my admin was set to do NOT allow checkout.

How did this happen? Do I need faster SSL or something?

30 Jun 2009, 10:19 AM
#8
the_darkhorse avatar

the_darkhorse

New Zenner

Join Date:
Jan 2006
Posts:
16
Plugin Contributions:
0

Re: Overselling of product, negative stock

continues to happen to me too. Seems no one knows how to fix it. It's a shame because it is ruining an otherwise good piece of software.

1 Jul 2009, 12:17 PM
#9
augustlately avatar

augustlately

New Zenner

Join Date:
Mar 2007
Posts:
7
Plugin Contributions:
0

Re: Overselling of product, negative stock

I was told that it was because the payment option I use (paypal) allows a time where zen-cart does not have the order marked as paid for until the customer is returned from paypal, so it will allow others to purchase the same items in that time frame.

What we need is an option to tell zen-cart to take inventory out at the moment the customer is taken to paypal, not after they've paid.

I have tried to think of a way to work around this. I thought to allow the check/MO option, but rename it to "send me a paypal invoice" but really, I don't want to have to invoice every customer and then wait for them to pay.

3 Sep 2009, 1:58 AM
#10
schunard avatar

schunard

New Zenner

Join Date:
Mar 2008
Posts:
3
Plugin Contributions:
0

Re: Overselling of product, negative stock

Any solution for this yet? We recently had an exclusive item that sold out in less than 4 minutes. By the time I had pulled the plug on the item, it had sold 3 units over what we had, leaving a -3 in the back end. :no:

3 Sep 2009, 3:19 AM
#11
kiddo avatar

kiddo

Totally Zenned

Join Date:
Jul 2006
Location:
SF Bay Area
Posts:
837
Plugin Contributions:
1

Re: Overselling of product, negative stock

I recall having to make a fix for both Google and PayPal to prevent allowing overselling.

it was something like :

  // Stock Check - kiddo hack
  if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
	  $products = $_SESSION['cart']->get_products();
	  for ($i=0, $n=sizeof($products); $i<$n; $i++) {
	  
		unset($attributes);
		if(is_array($products[$i]['attributes'])){
			$attributes = $products[$i]['attributes'];
			} else {
				$attributes = '';
			}
	  
	  
  	  if (zen_check_stock($products[$i]['id'], $products[$i]['quantity'],$attributes)) {
	  header("location: http://www.YOUR-DOMAIN.com/index.php?main_page=shopping_cart");
	  exit();

    	  
      }
    }

added to ipn_main_handler.php

The fix for google checkout was similar.

I think this was also to make compatible with stock-by-attributes mod.

See if this gives a clue.

7 Sep 2010, 1:16 PM
#12
andyjb avatar

andyjb

New Zenner

Join Date:
Sep 2010
Location:
Cork, Ireland
Posts:
1
Plugin Contributions:
0

Re: Overselling of product, negative stock

Hi,
I'm using v1.3.9f and I've no major customisations, just a few CSS tweeks.

I've set the admin flag to prevent selling out of stock items, but it's happening for products that have attributes set up eg Product 'X' stock qty is 10. I select 8 'X' on 1st order line. I then select a 2nd line for product 'X' with greater qty than stock level should allow and I can finalise the sale.

Its leaving me with negative stock.

Anyone have any ideas?

Cheers
Andy

23 Sep 2010, 11:41 AM
#13
p1lot avatar

p1lot

New Zenner

Join Date:
May 2009
Posts:
69
Plugin Contributions:
0

Re: Overselling of product, negative stock

if you use PP express, that's how i fixed it in 139f. It's just an additonal check for Attributes (Stock by Attributes mod).

  // Stock Check to prevent checkout if cart contents rules violations exist
  if ( STOCK_CHECK == 'true' && STOCK_ALLOW_CHECKOUT != 'true' && isset($_SESSION['cart']) ) {
    $products = $_SESSION['cart']->get_products();
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
    
    
      /* Stock by Attributes Check 1 / 2 */
      unset($attributes);
      if(is_array($products[$i]['attributes'])){
          $attributes = $products[$i]['attributes'];
      } else {
          $attributes = '';
      }
      
    
      if (zen_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
        zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
        break;
      }
      
      
      /* Stock by Attributes Check 2 / 2 */
      if (zen_check_stock($products[$i]['id'], $products[$i]['quantity'], $attributes)) {
        zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
        break;
      }

      
    }
  }

Basically just kiddo's version from above but I used zen_redirect and break instead of header and exit.

1 Nov 2010, 12:25 PM
#14
bendlikewillow avatar

bendlikewillow

New Zenner

Join Date:
Jun 2008
Posts:
35
Plugin Contributions:
0

Re: Overselling of product, negative stock

Hi there - this problem's cropped up on our site as we've just put Paypal back on after installing Stock by Attributes mod which has been working fine with Sagepay payments method, only now our site's allowing minus stock to be sold.

I have tried inserting both examples of code into the file ipn_main_handler.php.

With P1lot's code the sale still goes through despite minus stock and with kiddo's code I get errors.

Is there a particular place this code should be inserted in the script as I've tried it at the beginning and in various points to no effect. Our store is site version 1.3.8a, haven't upgraded as the site's extremely busy and to be honest I can't face it right now - any help appreciated! - best regards Mick