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

Address and Shipping #839

Open
SB1955 opened this issue Feb 9, 2024 · 9 comments
Open

Address and Shipping #839

SB1955 opened this issue Feb 9, 2024 · 9 comments

Comments

@SB1955
Copy link

SB1955 commented Feb 9, 2024

Bit of an issue for me. Would like to have a 'line break' after town and county. Have tried to find how the address is generated and modify without luck. See attached.
Also ‘Shipping’ is set to ‘Free Shipping’ however I’m seeing ‘to be determined’ before I get to the complete page?
Thanks for any help you can give.
Address-source
Shipping-1
Shipping-2
Shipping-3

@Mesuva
Copy link
Collaborator

Mesuva commented Feb 9, 2024

The address formatting is quite deep in the codebase:

public static function formatAddressArray($address)

I think the best thing to do there is make some sort of change to that function to allow more configurability, and we can then look to include that in a future release.

The reason is shows 'To be determined', is that at that point you haven't put in a shipping address, so it doesn't know at that point whether shipping is going to be free or not. It might be, based on how you've set it up, but you could also have it offer other calculated and complex methods. Is the issue that you just want it to always show free shipping, as that's the only shipping option you are ever going to set up?

@SB1955
Copy link
Author

SB1955 commented Feb 9, 2024

Thanks for looking. What I can do as I have before is edit the 'checkout.php' file to show 'No Charge'.

@SB1955
Copy link
Author

SB1955 commented Feb 11, 2024

There many ways to formatting an address. Have several letters with variants, for me I’ve added a break to lines 258 and 264 in the ‘Customer.php’ file.

Thanks for giving me the place to modify.

$line = $city;
if ($stateProvince !== '') {
if ($line !== '') {
$line .= ', break';
}
$line .= $app->make('helper/lists/states_provinces')->getStateProvinceName($stateProvince, $country) ?: $stateProvince;
}
if ($postalCode !== '') {
if ($line !== '') {
$line .= ', break';
}

@SB1955 SB1955 closed this as completed Feb 12, 2024
@Mesuva
Copy link
Collaborator

Mesuva commented Feb 12, 2024

I think I'm going to re-open this issue, as a reminder that it would be great to have a way to customise the output of the address format, through some sort of configuration.

@Mesuva Mesuva reopened this Feb 12, 2024
@SB1955
Copy link
Author

SB1955 commented Feb 12, 2024

Ok. Thanks. See screenshots for my mods.

One-AD
Two-AD
Three-AD
Address-Mod

@Mesuva
Copy link
Collaborator

Mesuva commented Feb 12, 2024

What I'm considering is using something like this library here:
https://github.com/adamlc/address-format

@mlocati
Copy link
Contributor

mlocati commented Feb 12, 2024

Can't we use commerceguys/addressing (already included in Concrete)?

Also, what about letting people customize the way we format addresses? In case you are interested, I can submit a pull request

@Mesuva
Copy link
Collaborator

Mesuva commented Feb 12, 2024

I didn't realise Concrete already had a library - yep, that's much better than introducing something new.

It think if we have it formatting the address automatically, there would actually be very little need to be able to customise the address format. Every time someone has asked about it, it's to support a particular country's formatting.

But I'm thinking a customisation option doesn't actually make sense, as the address should be formatted as per the country selected in the address itself.

@Mesuva
Copy link
Collaborator

Mesuva commented Feb 12, 2024

I've just made this change:
7d119c1

This appears to work correctly on V8 and V9, and I think will cover pretty much everyone

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

3 participants