View Single Post
  #2  
Old 06-08-2009, 07:30 PM
 
birdman birdman is offline
 

Member
  
Join Date: Jan 2007
Location: Sydney, Australia
Posts: 13
 

Default Re: Strange Out Of Stock Behavior on Products page

Okay, so I think I've found where I can fix this strange behavior but am wondering if anyone can think of any adverse consequences of doing this.

In include/search.php there is the following code:
Code:
$in_cart = 0; if (!empty($cart['products']) && is_array($cart['products'])) { # Modify product's quantity based the cart data foreach ($cart['products'] as $cv) { if ($cv['productid'] == $v['productid'] && intval($v['variantid']) == intval($cv['variantid'])) $in_cart += $cv['amount']; } $products[$k]['in_cart'] = $in_cart; $products[$k]['avail'] -= $in_cart; if ($products[$k]['avail'] < 0) { $products[$k]['avail'] = 0; } }

When I comment out the line:
Code:
$products[$k]['avail'] -= $in_cart;
like so:
Code:
//$products[$k]['avail'] -= $in_cart;

then it prevents the behavior I'm talking about.

Can anyone think of any other consequences of doing this?
__________________
birdman
X-Cart Gold 4.1.8
Unix FreeBSD | MySQL 4.1.22 | PHP 5.2.10
Reply With Quote