src/Sulu/Bundle/Sales/OrderBundle/Cart/CartManager.php
public function addProduct($data, $user = null, $locale = null)
    {
        //TODO: locale
        // get cart
        $cart = $this->getUserCart($user, $locale, null, true);
        // define user-id
        $userId = $user ? $user->getId() : null;

        $item = $this->orderManager->addItem($data, $locale, $userId, $cart);

        $this->validateIfItemProductActive($item->getEntity());

        $this->orderManager->updateApiEntity($cart, $locale);

        return $cart;
    }
public function addProduct($data, $user = null, $locale = null)
    {
        //TODO: locale
        // get cart
        $cart = $this->getUserCart($user, $locale, null, true);
        // define user-id
        $userId = $user ? $user->getId() : null;

        $item = $this->orderManager->addItem($data, $locale, $userId, $cart);

        $this->validateIfItemProductActive($item->getEntity());

        $this->orderManager->updateApiEntity($cart, $locale);

        return $cart;
    }
public function addProduct ( $ data , $ user = null , $ locale = null ) { //TODO: locale // get cart $ cart = $ this -> getUserCart ( $ user , $ locale , null , true ) ; // define user-id $ userId = $ user ? $ user -> getId ( ) : null ; $ item = $ this -> orderManager -> addItem ( $ data , $ locale , $ userId , $ cart ) ; $ this -> validateIfItemProductActive ( $ item -> getEntity ( ) ) ; $ this -> orderManager -> updateApiEntity ( $ cart , $ locale ) ; return $ cart ; }
Adds a product to cart

@param array $data
@param UserInterface|null $user
@param string|null $locale

@return null|Order
Adds a product to cart