Skip to content

Conversation

@SparK-Cruz
Copy link
Contributor

@SparK-Cruz SparK-Cruz commented Mar 15, 2017

Bad addresses with missing numbers broke the checkout page.

* and additionToAddress2 contain additional information that is given at the start and the end of the string, respectively.
* Unit tests for testing the regular expression that this function uses exist over at https://regex101.com/r/vO5fY7/1.
* More information on this functionality can be found at http://blog.viison.com/post/115849166487/shopware-5-from-a-technical-point-of-view#address-splitting.
* Fatia um endereço em nome da rua, número e complemento

Choose a reason for hiding this comment

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

Comments are only in English :)

* Fatia um endereço em nome da rua, número e complemento
*
* @param string $address
* @param string $address Endereço a ser fatiado

Choose a reason for hiding this comment

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

Same above.

\s*\Z/xu';

$result = preg_match($regex, $address, $matches);
public static function split_street($address) {
Copy link

@cezarsmpio cezarsmpio Mar 15, 2017

Choose a reason for hiding this comment

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

Are you really right about this? There is a huge difference between the regexs... Why this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That regex was not working when address had no number... a merchant added an address number field to their checkout (using checkout manager) and that broke things as address had no number and regex simply failed...
As it was too complex we rewrote the regex to be simplier and to match with weird addresses anyway.

} elseif ($result === false) {
throw new \RuntimeException(sprintf('Error occurred while trying to split address \'%s\'', $address));
if ($result === false) {
throw new \RuntimeException(sprintf('Problemas ao interpretar o endereço: \'%s\'', $address));

Choose a reason for hiding this comment

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

The string is in pt-br, please, put in en-us.

@SparK-Cruz SparK-Cruz merged commit 5138b43 into master Mar 15, 2017
@gpressutto5 gpressutto5 deleted the hotfix/1.6.1 branch July 20, 2017 17:05
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.

3 participants