I wrote a function to check item quantities when ever someone tries to
update quanities from either the basket or an invoice. It works just great
with the basket. On the inventory though it returns 0 regardless of the
actuall quantity. I am starting to go crossed eyed and am hoping that this
is just something stupid that someone who has not been sitting here all day
will see easy enough.
In each UPDATE_BASKET and UPDATE_INVOICE_SKU I changed the first bit of the
set quantities loop like this
//loop over each line item
for(reset($inputBasket); $key = key($inputBasket); next($inputBasket))
{
//clean input data
$key = (integer)$key;
$inputBasket[$key] = (integer)$inputBasket[$key];
$sku_qty = inventory_qty($key);
$sku_qty_total = $sku_qty["Available"] + $sku_qty["Reserve"];
if(($inputBasket[$key] > MAX_QUANTITY)||($inputBasket[$key] >
$sku_qty_total))
{
...
and inventory_qty() goes like this
function inventory_qty($sku_ID){
global $DatabaseLink;
global $ACTION;
if($ACTION = "UPDATE_BASKET"){
//get quanity available for this SKU
$Query = "SELECT i.Available, i.Reserve, i.Backorder ";
$Query .= "FROM inventory i, session_sku ss ";
$Query .= "WHERE ss.ID = $sku_ID ";
$Query .= "AND i.SKU = ss.SKU ";
}elseif{$ACTION = "UPDATE_INVOICE_SKU"){
//get quanity available for this SKU
$Query = "SELECT i.Available, i.Reserve, i.Backorder ";
$Query .= "FROM inventory i, invoice_sku is ";
$Query .= "WHERE is.ID = $sku_ID ";
$Query .= "AND is.SKU = i.SKU ";
}
$DatabaseResult = mysql_query($Query, $DatabaseLink);
while($DatabaseRow = mysql_fetch_object($DatabaseResult))
{
$sku_qty["Available"] = $DatabaseRow->Available;
$sku_qty["Reserve"] = $DatabaseRow->Reserve;
$sku_qty["Backorder"] = $DatabaseRow->Backorder;
}
return($sku_qty);
}
Instinctivly I am sure the $Query for UPDATE_INVOICE_SKU must be wrong if it
returns qty 0 but I am not seeing what it is I have screwed up. Any help
would bring me joy. I am betting I am over looking the obvious.
Thanks,
Chuck
-------------------------------------------------
Chuck Gartland || [EMAIL PROTECTED]
Project 27 || www.project27.com
1836 Palm Avenue || 808 465-1381
Pearl City, HI 96782 || GMT -10:00 hours
-------------------------------------------------
_______________________________________________
FreeTrade-dev mailing list
[EMAIL PROTECTED]
http://share.whichever.com/mailman/listinfo/freetrade-dev