Due to the problems i ran in to with the virtual stock, I came to the conculsion that size.stock was updated to soon.( for me it was )
so I took alook at cart.php and stats.php and i saw that size.stock was updated as soon as costumers added a product in their carts.
When the costumers leave the site before the order was placed the stock was updated but nothing sold.
This way some products where -250 on stock......
Now I've implanted a function into stats.php witch is called upon when the order did take place.....
I also deleted the size update queries(3 of them) in cart.php so that function isn't working anymore.
this is what I added into stats.php( just behind the statistics update query) to get it working:
$itemID_res = db_query("select ID from item where number=$item_number") or db_die();
$itemID_row = db_fetch_row($itemID_res);
$itemID = $itemID_row[0];
$stock_res = db_query("select stock,expiration from size where itemID=$itemID") or db_die();
$stock_row = db_fetch_row($stock_res);
$newstock = $stock_row[0] - $quantity;
$size_res = db_query("update size set stock=$newstock WHERE itemID=$itemID") or die(mysql_error());
Best regards,
Jeroen
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Due to the problems i ran in to with the virtual stock, I came to the conculsion that size.stock was updated to soon.( for me it was )
so I took alook at cart.php and stats.php and i saw that size.stock was updated as soon as costumers added a product in their carts.
When the costumers leave the site before the order was placed the stock was updated but nothing sold.
This way some products where -250 on stock......
Now I've implanted a function into stats.php witch is called upon when the order did take place.....
I also deleted the size update queries(3 of them) in cart.php so that function isn't working anymore.
this is what I added into stats.php( just behind the statistics update query) to get it working:
$itemID_res = db_query("select ID from item where number=$item_number") or db_die();
$itemID_row = db_fetch_row($itemID_res);
$itemID = $itemID_row[0];
$stock_res = db_query("select stock,expiration from size where itemID=$itemID") or db_die();
$stock_row = db_fetch_row($stock_res);
$newstock = $stock_row[0] - $quantity;
$size_res = db_query("update size set stock=$newstock WHERE itemID=$itemID") or die(mysql_error());
Best regards,
Jeroen
May be okay so far, but everyone who wish to use this, should read my comment under http://sourceforge.net/tracker/index.php?func=detail&aid=817936&group_id=39285&atid=424794
Greetings,
Andreas.