Merge branch 'master' into loops

Conflicts:
	core/lib/Thelia/Core/Template/Loop/Category.php
	core/lib/Thelia/Core/Template/Loop/FeatureValue.php
	core/lib/Thelia/Core/Template/Loop/Folder.php
	core/lib/Thelia/Core/Template/Loop/Product.php
	core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php
	install/faker.php
This commit is contained in:
Etienne Roudeix
2013-08-21 09:19:56 +02:00
3275 changed files with 929970 additions and 274940 deletions

20
documentation/api/files/Model/CartItem.php.txt Normal file → Executable file
View File

@@ -4,7 +4,7 @@ namespace Thelia\Model;
use Propel\Runtime\Connection\ConnectionInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Thelia\Core\Event\CartEvent;
use Thelia\Core\Event\Internal\CartEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Base\CartItem as BaseCartItem;
use Thelia\Model\ConfigQuery;
@@ -23,7 +23,7 @@ class CartItem extends BaseCartItem
if ($this->dispatcher) {
$cartEvent = new CartEvent($this->getCart());
$this->dispatcher->dispatch(TheliaEvents::CART_ADDITEM, $cartEvent);
$this->dispatcher->dispatch(TheliaEvents::AFTER_CARTADDITEM, $cartEvent);
}
}
@@ -32,7 +32,7 @@ class CartItem extends BaseCartItem
if ($this->dispatcher) {
$cartEvent = new CartEvent($this->getCart());
$this->dispatcher->dispatch(TheliaEvents::CART_MODIFYITEM, $cartEvent);
$this->dispatcher->dispatch(TheliaEvents::AFTER_CARTCHANGEITEM, $cartEvent);
}
}
@@ -41,27 +41,25 @@ class CartItem extends BaseCartItem
* @param $value
* @return $this
*/
public function addQuantity($value)
public function updateQuantity($value)
{
$currentQuantity = $this->getQuantity();
$newQuantity = $currentQuantity + $value;
if($newQuantity <= 0)
if($value <= 0)
{
$newQuantity = $currentQuantity;
$value = $currentQuantity;
}
if(ConfigQuery::read("verifyStock", 1) == 1)
{
$productSaleElements = $this->getProductSaleElements();
if($productSaleElements->getQuantity() < $newQuantity) {
$newQuantity = $currentQuantity;
if($productSaleElements->getQuantity() < $value) {
$value = $currentQuantity;
}
}
$this->setQuantity($newQuantity);
$this->setQuantity($value);
return $this;
}