public function login(array $user, array $cart)
    {
        $result = array();
        $this->hook->attach('cart.login.before', $user, $cart, $result, $this);

        if (!empty($result)) {
            return (array) $result;
        }

        if (!$this->config->get('cart_login_merge', 0)) {
            $this->cart->delete(array('user_id' => $user['user_id']));
        }

        if (!empty($cart['items'])) {
            foreach ($cart['items'] as $item) {
                $this->cart->update($item['cart_id'], array('user_id' => $user['user_id']));
            }
        }

        $this->cart->deleteCookie();
        $result = $this->getResultLogin($user);

        $this->hook->attach('cart.login.after', $user, $cart, $result, $this);
        return (array) $result;
    }
public function login(array $user, array $cart)
    {
        $result = array();
        $this->hook->attach('cart.login.before', $user, $cart, $result, $this);

        if (!empty($result)) {
            return (array) $result;
        }

        if (!$this->config->get('cart_login_merge', 0)) {
            $this->cart->delete(array('user_id' => $user['user_id']));
        }

        if (!empty($cart['items'])) {
            foreach ($cart['items'] as $item) {
                $this->cart->update($item['cart_id'], array('user_id' => $user['user_id']));
            }
        }

        $this->cart->deleteCookie();
        $result = $this->getResultLogin($user);

        $this->hook->attach('cart.login.after', $user, $cart, $result, $this);
        return (array) $result;
    }
public function login ( array $ user , array $ cart ) { $ result = array ( ) ; $ this -> hook -> attach ( 'cart.login.before' , $ user , $ cart , $ result , $ this ) ; if ( ! empty ( $ result ) ) { return ( array ) $ result ; } if ( ! $ this -> config -> get ( 'cart_login_merge' , 0 ) ) { $ this -> cart -> delete ( array ( 'user_id' => $ user [ 'user_id' ] ) ) ; } if ( ! empty ( $ cart [ 'items' ] ) ) { foreach ( $ cart [ 'items' ] as $ item ) { $ this -> cart -> update ( $ item [ 'cart_id' ] , array ( 'user_id' => $ user [ 'user_id' ] ) ) ; } } $ this -> cart -> deleteCookie ( ) ; $ result = $ this -> getResultLogin ( $ user ) ; $ this -> hook -> attach ( 'cart.login.after' , $ user , $ cart , $ result , $ this ) ; return ( array ) $ result ; }
Performs all needed tasks when customer is logging in during checkout
@param array $user
@param array $cart
@return array
Performs all needed tasks when customer is logging in during checkout