Hi there,

is there a technical reason why the ship-from address in the settings form here couldn't be more inclusive, or even just use an addressfield, so that we could use the module to ship from addresses outside the US?

Willing to write a patch, but if there's a reason it should be done in a separate module, please do let me know :-)

-- Jamie

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ultimike’s picture

Jamie,

There's no reason why the module couldn't be changed to utilize the Address Field module (http://drupal.org/project/addressfield). I don't have all that much experience with shipping from outside the U.S. (sorry), but if you'd like to give it a shot and post a patch, it would be welcome.

Thanks,
-mike

Andrew M Riley’s picture

Version: » 7.x-1.x-dev
Status: Active » Postponed

I gave this a shot tonight but there are currently with using address fields in other modules. When calling it, changing the country doesn't actually refresh the form to be the correct format for the new country (it also has issues with saving). I double checked with Address Field dev and had the same issue. Postponing until the linked issue is resolved.

http://drupal.org/node/970048#comment-5323230

Because I'll forget in the future:
Remove the address form fields and add this right above 'service'.

// Code from http://drupal.org/node/1302712
$form['origin']['address'] = addressfield_generate(addressfield_default_values(), array('address'), array('mode' => 'form'));
$form['origin']['address']['#required'] = TRUE;
Andrew M Riley’s picture

Assigned: Unassigned » Andrew M Riley

Good news, it looks like the related ticket has legs and somebody has created a patch for it (http://drupal.org/node/970048#comment-5601208). Once Ryan gets it into at least a dev release I'll be able to update this module.

cronix’s picture

Just curious. Is there anyone working on this issue? It would be great if this modules would work outside the US.

Andrew M Riley’s picture

I need to check again but the last time I checked the issue was with the address module not working properly when we added it. The community has been asking for a new release of the address module for multiple reasons, hopefully it comes soon.

cronix’s picture

Do you mean the address field module? That one just got an updated version yesterday. I hope that helps?

Andrew M Riley’s picture

Looking at the change log, the address field update didn't fix what we need. It looks like there is a good candidate for a patch out there but until it gets into a dev release I can't put the related code into this module (I can't require all users of this module patch another module, that would exclude most users)

Patch candidate: http://drupal.org/node/970048#comment-5712492

memil’s picture

Many thanks for peezy, he helped me a lot. I changed some files and now I can get shipping quotes even if the origin country is other than US. Peezy made changes in "commerce_ups.admin.inc" file and I made little changes in "commerce_ups.xml.inc". In the attached file, you can find these modificated files, just replace the old files with these. However there are still faulties in sending the xml request to UPS server, but if you can compromise this, you can use this half-baked module. So, when you creating/modifying your products, at weight field, use the unit "lb". If you change it to other (kg, or g, etc...) it will calculate back to lb, but we don't want it. It means, that if your products weight is 1.5 kg, input 1.5 lb. The module - after modification of "commerce_ups.xml.inc" - will send 1.5 kg to UPS server (even if you entered 1.5 lb). The dimensions are not sent from products unique dimensions, they are sent from default dimensions (in all cases), which you can set on the page: "admin/commerce/config/shipping/methods/ups/edit". So, if you have products with different dimensions, you need to calculate an average dimensions, and use that. The UPS sends back the quotes in the origin countries currency (in my case in Hungarian Forints), but I want to get the quotes or in EUR or in the selected currency of user. I really hope, that there will be an update of this module, I want to use it regularly.

andyg5000’s picture

Hey @memil
Thanks for sharing your work here. However, the best way to contribute is to submit diff patches for improvements or new features. See http://drupal.org/project/commerce_ups/git-instructions for more info on creating patches.

makangus’s picture

I just ran into this shipping from Canada. The good news is it works when I can simply add CA to commerce_ups_country_code field and ON to the commerce_ups_state field in the admin form.

Since the addressfield module is still not fixed in #970048: Define and use addressfield as a form element type, can we maybe at least hardcode a list countries supported by UPS and maybe change the commerce_ups_state field to a textfield or ort add the Canadian provinces? If anyone is interested I will be happy to write a patch.

jcodina’s picture

The issue seems to be fixed now.

Which are the steps to make this module work with addressfield?

Thank you

bendiy’s picture

Issue summary: View changes

I'm adding a hook over here #2293431: Abstract Ship To and Ship From addresses with hook_..._alter() that will let you modify the Ship From address based on the order.

ultimike’s picture

Status: Postponed » Closed (works as designed)

Based on the discussion above, and the fact that @bendiy's patch will be committed once we have some verification that it is working as expected, I'm going to close this case. Feel free to re-open if there is a use case that still needs some attention.

Thanks,
-mike

joelpittet’s picture

Title: ship-from addresses outside the US? » Add ship from address outside the US
Assigned: Andrew M Riley » Unassigned
Status: Closed (works as designed) » Needs review
FileSize
3.12 KB

The other one has been RTBC for a while now. But this one really should be resolve for quick testing the module out.

IMO we need both. I re-rolled the changes that seemed needed.

Here's a patch that uses the countries module if available or core locale instead of the long list. And turns the the state dropdown into a 2 digit text field like commerce_fedex uses.

michielkenis’s picture

I'm afraid this patch isn't working... I'm testing with a Shipping Address in Belgium and I got no results back :(

joelpittet’s picture

@michielkenis is there any details to why this wouldn't work with Belgium? I'm going to commit this and we can iterate on it to improve it.

joelpittet’s picture

Status: Needs review » Fixed

@michielkenis feel free to open up a follow-up for Belgium

  • joelpittet committed 253edfc on 7.x-2.x
    Issue #1313318 by joelpittet, Andrew M Riley, instanceofjamie,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.