Merge branch 'master' into tax
This commit is contained in:
@@ -69,7 +69,8 @@ class Cart extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
|
||||
if ($append && $cartItem !== null) {
|
||||
$this->updateQuantity($cartItem, $quantity);
|
||||
$cartItem->addQuantity($quantity)
|
||||
->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,9 @@ class DefinePropel
|
||||
"dsn" => $connection["dsn"],
|
||||
"user" => $connection["user"],
|
||||
"password" => $connection["password"],
|
||||
"classname" => $connection["classname"]
|
||||
"classname" => $connection["classname"],
|
||||
'options' => array(
|
||||
\PDO::MYSQL_ATTR_INIT_COMMAND => array('value' =>'SET NAMES \'UTF8\''))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class CartController extends BaseFrontController
|
||||
$cartEvent->setQuantity($this->getRequest()->get("quantity"));
|
||||
|
||||
try {
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::CART_UPDATEITEM, $cartEvent);
|
||||
$this->dispatch(TheliaEvents::CART_UPDATEITEM, $cartEvent);
|
||||
|
||||
$this->redirectSuccess();
|
||||
} catch (PropelException $e) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ URL: http://www.thelia.net
|
||||
<nav class="navbar-collapse collapse nav-main" role="navigation" aria-label="{intl l="Main Navigation"}">
|
||||
{nocache}
|
||||
<ul class="nav navbar-nav navbar-cart navbar-right">
|
||||
{loop type="auth" name="customer_info_block" roles="CUSTOMER" context="front"}
|
||||
{loop type="auth" name="customer_info_block" role="CUSTOMER" context="front"}
|
||||
<li><a href="{url path="/logout"}" class="logout">{intl l="Log out!"}</a></li>
|
||||
<li><a href="{url path="/account"}" class="account">{intl l="My Account"}</a></li>
|
||||
{/loop}
|
||||
|
||||
Reference in New Issue
Block a user