Merge branch 'master' into tax

This commit is contained in:
Etienne Roudeix
2013-10-22 20:20:40 +02:00
5 changed files with 27 additions and 7 deletions

View File

@@ -60,14 +60,31 @@ class CartItem extends BaseCartItem
}
}
$this->addQuantity($value);
$this->setQuantity($value);
return $this;
}
public function addQuantity($quantity)
public function addQuantity($value)
{
$this->setQuantity($this->getQuantity() + $quantity);
$currentQuantity = $this->getQuantity();
$newQuantity = $currentQuantity + $value;
if($value <= 0)
{
$value = $currentQuantity;
}
if(ConfigQuery::read("verifyStock", 1) == 1)
{
$productSaleElements = $this->getProductSaleElements();
if($productSaleElements->getQuantity() < $newQuantity) {
$newQuantity = $currentQuantity;
}
}
$this->setQuantity($newQuantity);
return $this;
}