remove unused use statement
This commit is contained in:
@@ -29,21 +29,14 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Core\Event\CartEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\HttpFoundation\Session\Session;
|
||||
use Thelia\Form\CartAdd;
|
||||
use Thelia\Model\ProductPrice;
|
||||
use Thelia\Model\ProductPriceQuery;
|
||||
use Thelia\Model\CartItem;
|
||||
use Thelia\Model\CartItemQuery;
|
||||
use Thelia\Model\CartQuery;
|
||||
use Thelia\Model\Cart as CartModel;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\Customer;
|
||||
use Thelia\Action\Exception\FormValidationException;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Class Cart where all actions are manage like adding, modifying or delete items.
|
||||
@@ -75,12 +68,12 @@ class Cart extends BaseAction implements EventSubscriberInterface
|
||||
*/
|
||||
public function addArticle(ActionEvent $event)
|
||||
{
|
||||
$request = $event->getRequest();
|
||||
$request = $event->getRequest();
|
||||
|
||||
try {
|
||||
$cartAdd = $this->getAddCartForm($request);
|
||||
try {
|
||||
$cartAdd = $this->getAddCartForm($request);
|
||||
|
||||
$form = $this->validateForm($cartAdd);
|
||||
$form = $this->validateForm($cartAdd);
|
||||
|
||||
$cart = $this->getCart($request);
|
||||
$newness = $form->get("newness")->getData();
|
||||
@@ -92,8 +85,7 @@ class Cart extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
$cartItem = $this->findItem($cart->getId(), $productId, $productSaleElementsId);
|
||||
|
||||
if($cartItem === null || $newness)
|
||||
{
|
||||
if ($cartItem === null || $newness) {
|
||||
$productPrice = ProductPriceQuery::create()
|
||||
->filterByProductSaleElementsId($productSaleElementsId)
|
||||
->findOne()
|
||||
@@ -102,19 +94,17 @@ class Cart extends BaseAction implements EventSubscriberInterface
|
||||
$this->addItem($cart, $productId, $productSaleElementsId, $quantity, $productPrice);
|
||||
}
|
||||
|
||||
if($append && $cartItem !== null) {
|
||||
if ($append && $cartItem !== null) {
|
||||
$this->updateQuantity($cartItem, $quantity);
|
||||
}
|
||||
|
||||
|
||||
$this->redirect($cartAdd->getSuccessUrl($request->getUriAddingParameters(array("addCart" => 1))));
|
||||
} catch (PropelException $e) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Failed to add item to cart with message : %s", $e->getMessage()));
|
||||
$message = "Failed to add this article to your cart, please try again";
|
||||
}
|
||||
catch(FormValidationException $e) {
|
||||
} catch (FormValidationException $e) {
|
||||
|
||||
$message = $e->getMessage();
|
||||
$message = $e->getMessage();
|
||||
}
|
||||
|
||||
// The form has errors, propagate it.
|
||||
@@ -170,7 +160,6 @@ class Cart extends BaseAction implements EventSubscriberInterface
|
||||
return $cartAdd;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Delete specify article present into cart
|
||||
@@ -207,7 +196,7 @@ class Cart extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
$request = $event->getRequest();
|
||||
|
||||
if(null !== $cartItemId = $request->get("cartItem") && null !== $quantity = $request->get("quantity")) {
|
||||
if (null !== $cartItemId = $request->get("cartItem") && null !== $quantity = $request->get("quantity")) {
|
||||
|
||||
try {
|
||||
$cart = $this->getCart($request);
|
||||
@@ -217,7 +206,7 @@ class Cart extends BaseAction implements EventSubscriberInterface
|
||||
->filterById($cartItemId)
|
||||
->findOne();
|
||||
|
||||
if($cartItem) {
|
||||
if ($cartItem) {
|
||||
$this->updateQuantity($cartItem, $quantity);
|
||||
}
|
||||
} catch (PropelException $e) {
|
||||
@@ -256,5 +245,4 @@ class Cart extends BaseAction implements EventSubscriberInterface
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user