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

Solve bug #116 - Setting number of address line lower breaks checkout #117

Open
wants to merge 4 commits into
base: 2.4-develop
Choose a base branch
from

Conversation

ProxiBlue
Copy link

@ProxiBlue ProxiBlue commented Jan 20, 2025

Description (*)

Refer to bug #116

The code adjusts the fetch of Street lines to ensure result matches expected address lines, if legacy data.
Legacy data with address lines > as current configured will break checkout, as described in detail in bug.
The code uses existing method in core that is meant to do this, but was never actually called.

Related Pull Requests

N/A

Fixed Issues (if relevant)

  1. Fixes Setting number of address line lower than existing entry breaks all checkouts for existing address data #116

Manual testing scenarios (*)

The issue is directly related to legacy address data in address fields, after address was limited to lesser address lines.
The first step is to get a longer address saved, and used, then go back, and retry after address lines were changed.
Extensive detailed testing in note din the ticket on how to reproduce. Refer to bug #116

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green) - as noted in ticket, there are unrelated tests that fail out the box on a clean install. Tests related to this change was tested and works.

image

…sting entry breaks all checkouts for existing address data
@ProxiBlue ProxiBlue requested a review from a team as a code owner January 20, 2025 03:20
Copy link
Contributor

@rhoerr rhoerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add the new constructor argument to the child classes of AbstractAddress, \Magento\Customer\Model\Address and \Magento\Quote\Model\Quote\Address.

Otherwise, looks good!

@ProxiBlue
Copy link
Author

ProxiBlue commented Jan 24, 2025 via email

@rhoerr
Copy link
Contributor

rhoerr commented Jan 24, 2025

I specifically coded not to do that, as those child classes can be extended by 3rd party.. My concern is that this can break 3rd party modules. If that is not a concern I will happily adjust all child classes.

It should be fully intercompatible, as long as you make the new argument optional like you did for AbstractAddress:

        ?AddressHelper $addressHelper = null
...
        $this->addressHelper = $addressHelper ?: ObjectManager::getInstance()
            ->get(AddressHelper::class);

If a child class or preference of CustomerAddress or QuoteAddress doesn't define addressHelper, the optional param and ObjectManager fallback will mean it just gets created at runtime anyway -- no errors.

The reason I ask for this is otherwise there's no way to touch or modify $addressHelper by DI or child class (not that there would be need to, but we should be consistent about it).

The major downside of adding it to the child classes is a very high chance of future merge conflicts, unless this gets merged into Magento too (hopefully it does). I'm confident they'll ask for the same though.

Thank you

@ProxiBlue
Copy link
Author

ProxiBlue commented Jan 24, 2025 via email

@ProxiBlue
Copy link
Author

@rhoerr adjustments made as requested.

Copy link
Contributor

@rhoerr rhoerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@fballiano
Copy link
Contributor

@ProxiBlue @rhoerr this PR targets 2.4-develop, shouldn't it be on release/1.x?

@rhoerr
Copy link
Contributor

rhoerr commented Jan 27, 2025

We can cherry pick it (probably in a new PR) once it's merged.

@fballiano
Copy link
Contributor

but should it even be on 2.4-develop in the first place?

@rhoerr
Copy link
Contributor

rhoerr commented Jan 27, 2025

It's fine to be there -- ultimately our release/1.x branch is going to be remerged from 2.4-develop once Magento 2.4.8 comes out. We are tracking them separately because 2.4-develop has unstable code from upstream right now, but we have customizations on 2.4-develop as well (it's not purely a copy of upstream).

@ProxiBlue
Copy link
Author

ProxiBlue commented Jan 28, 2025

@ProxiBlue @rhoerr this PR targets 2.4-develop, shouldn't it be on release/1.x?

I did actually query this in magechat :)

image

It was not clear / i missed it, where to fork on / develop on, as all instructions pointed to adobe/-develop (and that DID feel wrong tbh)

@fballiano
Copy link
Contributor

@rhoerr once we merge it should I creare a PR for the cherry-pick to release/1.x or we'll do a full merge before the next release?

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

Successfully merging this pull request may close these issues.

Setting number of address line lower than existing entry breaks all checkouts for existing address data
4 participants