function uc_stock_level in Ubercart 6.2
Same name and namespace in other branches
- 8.4 uc_stock/uc_stock.module \uc_stock_level()
- 5 uc_stock/uc_stock.module \uc_stock_level()
- 7.3 uc_stock/uc_stock.module \uc_stock_level()
Gets the stock level of a particular product SKU.
Parameters
$sku: The Ubercart product SKU of the stock level to return.
Return value
The SKU's stock level, or FALSE if not active.
2 calls to uc_stock_level()
- UbercartStockTestCase::testProductStock in uc_stock/
uc_stock.test - UbercartStockTestCase::testStockDecrement in uc_stock/
uc_stock.test
File
- uc_stock/
uc_stock.module, line 305
Code
function uc_stock_level($sku) {
$stock = db_fetch_object(db_query("SELECT active, stock FROM {uc_product_stock} WHERE sku = '%s'", $sku));
if ($stock && $stock->active) {
return $stock->stock;
}
return FALSE;
}