Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Commit

Permalink
Fix: Can not buy product when inventory preorder quantity is null (#514)
Browse files Browse the repository at this point in the history
  • Loading branch information
AliveMen authored Aug 13, 2020
1 parent b95390b commit cab7ef2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public virtual bool IsSatisfiedBy(long requestedQuantity)
if (result && _product.TrackInventory)
{
result = _product.Inventory != null &&
_product.AvailableQuantity +
(Convert.ToInt32(_product.Inventory.AllowPreorder) * _product.Inventory.PreorderQuantity) +
(Convert.ToInt32(_product.Inventory.AllowBackorder) * _product.Inventory.BackorderQuantity)
>= requestedQuantity;
_product.AvailableQuantity +
(Convert.ToInt32(_product.Inventory.AllowPreorder) * Convert.ToInt32(_product.Inventory.PreorderQuantity)) +
(Convert.ToInt32(_product.Inventory.AllowBackorder) * Convert.ToInt32(_product.Inventory.BackorderQuantity))
>= requestedQuantity;
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public virtual bool IsSatisfiedBy(Product product)
{
result = product.Inventory != null &&
product.AvailableQuantity +
(Convert.ToInt32(product.Inventory.AllowPreorder) * product.Inventory.PreorderQuantity) +
(Convert.ToInt32(product.Inventory.AllowBackorder) * product.Inventory.BackorderQuantity)
(Convert.ToInt32(product.Inventory.AllowPreorder) * Convert.ToInt32(product.Inventory.PreorderQuantity)) +
(Convert.ToInt32(product.Inventory.AllowBackorder) * Convert.ToInt32(product.Inventory.BackorderQuantity))
> 0;
}
return result;
Expand Down

0 comments on commit cab7ef2

Please sign in to comment.