Hello,
The "product out of stock" is shown when product stock is under "stock threshold limit" but stock is not 0 (and, them, it can not be possible to add this product to the shopping cart).
Tell me if you need futher information
Regards

Comments

manos_ws’s picture

I have notice the same effect with the 6.x-1.0 release, That's why I reverted to rc9.

I have Ubercart Stock Manager With Attributes installed, I don't think its relevant thou.

regards,

ManosK
http://websynergy.gr/

manos_ws’s picture

I tracked down the problem to the uc_modules_add_to_cart.php

on line 51

$sql = "SELECT nid FROM {uc_product_stock} WHERE sku = '%s' AND nid = '%s' AND threshold > stock ";

I replaced it with

$sql = "SELECT nid FROM {uc_product_stock} WHERE sku = '%s' AND nid = '%s' AND  stock < 0 ";

and it worked.

1. Could the developer tell why it has " threshold > stock " in his sql statement

2. I did allot of sql in uni some years back and from the top of my head I should put " stock > 0" and not " stock < 0" as I have written. But "stock > 0 " doesn't work.

ManosK
http://websynergy.gr/

henrijs.seso’s picture

same here

henrijs.seso’s picture

#2 works. must be fixed asap. threshold > stock does not make any sense at all. threshold is used to warn store owner of stocks getting low, nothing to do with ajax cart.

henrijs.seso’s picture

actually stock < 0 should be stock <= 0 since you are out of stock as soon as you hit 0

erik seifert’s picture

Status: Active » Fixed

Thx. Will be in next release

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

carlitus’s picture

The query

$sql = "SELECT nid FROM {uc_product_stock} WHERE sku = '%s' AND nid = '%s' AND  stock < 0 ";

doesn't look if the stock is active. I've add a active = 1;

$sql = "SELECT nid FROM {uc_product_stock} WHERE sku = '%s' AND nid = '%s' AND  stock < 0  AND active = 1";
petergus’s picture

<= 0 wasnt working on mine (actually it was but it just stopped suddenly after using bulk stock updates if that had something to do with weirdly)

changed it to < 0 and its working. however, that doesnt detect if it is actually out of stock anymore.

any ideas?

petergus’s picture

Status: Closed (fixed) » Needs review

i am reopening this issue with the above comments.

however, i notice the original poster said the error mentioned threshold level.
all of my stock items have threshold of 0 and out of stock message does not mention threshold, just stock level, even though i have tried on both 0 stock and filled stock items.

when using < 0 then it doesn't recognize stock level, adds everything.

VanessaM’s picture

I am experiencing the same problem.

I checked uc_modules_add_to_cart.php and the sql is as follows:
$sql = "SELECT nid FROM {uc_product_stock} WHERE sku = '%s' AND nid = '%s' AND active = 1 AND stock <= 0";

the threshold is 5 for the product, I have 11 in stock and when I try to add 7 items I get an error message saying that there are only 6 items left in the cart

I have the latest version of Ubercart ajax cart installed: 6.x-2.0-rc3

please help.

tunic’s picture

Status: Needs review » Postponed (maintainer needs more info)

I need more info on this issue. I've enabled Ubercart stock module, set up some stock for some productos (with and without attributes) and I coudn't reproduce the bug.

Are you using any other modules than standard stock module for Ubercart?

VanessaM’s picture

I am using the following modules to handle stock:
Bulk stock updater 6.x-1.2
stock manager with attributes 6.x-1.x-dev
Product Power Tools 6.x-1.12

tunic’s picture

Status: Postponed (maintainer needs more info) » Needs review
tunic’s picture

Version: 6.x-1.0 » 6.x-2.x-dev
stewart.adam’s picture

Status: Needs review » Fixed

The stock checking which uc_ajax_cart did was out of place; uc_ajax_cart fails gracefully when there is an error and informs the user via the popup-message.

I have removed the stock checking hook from the latest dev release and this should be implemented instead in a module dedicated to stock management, for example uc_out_of_stock. When it flags that a product cannot be added to the cart, uc_ajax_cart should pick it up and relay the error to the user.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.