Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magento 2.4.5 compatibility - unable to login when a new customer does not have addresses #133

Open
gianstraf opened this issue Dec 29, 2022 · 1 comment

Comments

@gianstraf
Copy link

Dear support,
we meet a problem with the version 6.0.0 on Magento 2.4.5 with these conditions:

  • new customer that not exist yet on Magento db, but exists on Gigya service
  • page customer/account/loging

After the customer attempt to logging in (after he has typed username and password into the gigya screenset), no customer is created on magento db and an error occourrs on the frontend. The customer is redirected into the customer/account/register page.

The cause seems be that the customer, hasn't yet addresses when attempt to login and class Gigya/GigyaIM/Model/MagentoCustomerFieldsUpdater.php, method setAccountValues attempt to read a default billing address that does not exist yet on db (customer is created into a mysql transaction but rollbacked later):

See

$magentoBillingAddressId = $account->getDefaultBilling();

$magentoBillingAddressId = $account->getDefaultBilling();
        try {
            $magentoBillingAddress = $this->addressRepository->getById($magentoBillingAddressId);
        } catch (\Exception $ex) {
            $this->logger->error($ex->__toString());
            $magentoBillingAddress = false;
        }

Also, if we around the code with a similar check:

 if($magentoBillingAddressId) {
            try {
                $magentoBillingAddress = $this->addressRepository->getById($magentoBillingAddressId);
            } catch (\Exception $ex) {
                $this->logger->error($ex->__toString());
                $magentoBillingAddress = false;
            }
        }else{
            $magentoBillingAddress = null;
        }

the code fails newly on this line:

$this->addressRepository->save($magentoBillingAddress);

$this->addressRepository->save($magentoBillingAddress);

because module attempt to save a new address without mandatory fields (postal code, street, and so on....).

Could you support us ?

Thank you,
Gianluca

@gianstraf gianstraf changed the title Magento 2.4.5 compatibility - unable to login on frontend when a customer does not have addresses Magento 2.4.5 compatibility - unable to login when a new customer does not have addresses Dec 29, 2022
@gianstraf
Copy link
Author

Some update ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant