International vs. Domestic shipping options

Posts: 15
Joined: 08/08/2007
Getting busy with the Ubercode.

I have mentioned this before, but I don't recall where it was left off so here goes:

One of the shops I'm maintaining would like to expand to international shipping (to pretty much anywhere). They want domestic users to get UPS quotes, and everyone else to get USPS quotes. Is there a system in place to handle this? Would it be a pain to make these options conditional?

Posts: 163
Joined: 08/07/2007
Uber DonorBug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Not Kulvik

I'm in on the bounty to make this happen!

Posts: 110
Joined: 08/08/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Not Kulvik

It requires a bit of tweaking with the quote module check the location, or tyhe country and bring only those quotes.

Its a couple of hours work, but it will surely require patching the quote module,

Posts: 2352
Joined: 08/07/2007
AdministratoreLiTe!

Well, as it turns out, I was working on this today. About all I have left is actually restricting the shipping methods when the customer chooses their country. This is going to take a good bit of JavaScript, though, and that hasn't been working out for some people lately. I expect really hammering out all the problems will take more than just a couple of hours.

Posts: 110
Joined: 08/08/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Not Kulvik

Well building it as a module will surely be a work, i was expecting to do this simply

by passing the country into it

function uc_quote_request_quotes($country){
...

if ($method = $methods[$_POST['method']] && $country=="bla..."){
$quote_data = call_user_func($method['quote']['callback'], $products, $details);
}
else{
$quote_data = call_user_func($method['quote']['callback'], $products, $details);
}

}

Correct me if Iam wrong.

Posts: 110
Joined: 08/08/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Not Kulvik

Iam assuming simpler cases, like if the country is this get this quotes, else get these quotes.

Building it into a module may involve some more work, selecting the shipping methods for what countries etc..

Posts: 163
Joined: 08/07/2007
Uber DonorBug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Not Kulvik

I don't have the whole solution to international shipping by any means but if you add:

'08' => t('UPS Worldwide Expedited'),

to the array of services in
uc_ups_module _uc_ups_service_list() one can achieve international shipping quotes from UPS.

Posts: 2352
Joined: 08/07/2007
AdministratoreLiTe!

Right now, the customer has to choose a method to get a quote, and then choose the options that are available. The way you're talking about, we would return all the options from all the appropriate methods at once. And then we figure out which option belongs to which method when they click the Submit button.

Hmm...that should work. Getting quotes from UPS, USPS, FedEx at once would take time, but could be done. That's an extreme case, though.

I also like not having to add nearly as much JS as my earlier idea. It'll definitely have to change the uc_quote module, but it shouldn't affect the method modules any.

Posts: 163
Joined: 08/07/2007
Uber DonorBug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Not Kulvik

with the addition of UPS WorldWide in the services array and a modification to quote.js that intercepts Military APO's and changes the detail["methods"] to "flatrate", we appear to be in business as far as shipping quotes go. I just have to repopulate the country/zone tables.

anyone interested, military APOs can be trapped in the quote.js script. Add code to the quoteCallback function that is like the following:

if ((APOzip == '09') || (APOzip == '96') || (APOzip == '34')) {
// you have a Mil addy
details["method"] = "flatrate";
} else {
// you don't
}

change "flatrate" to the method you want Mil to be handled by... USPS prob, but I'm in a hurry so flatrate will do for proof of concept.

Posts: 2352
Joined: 08/07/2007
AdministratoreLiTe!

Alright, I've committed the changes to the quote module. You should be able to choose the countries for each shipping method in the Quote Methods Settings. It's a multi-select box, and leaving it blank is the same as selecting "--All--".

As of this message, make sure you have all the countries covered. The customer won't be able to check out, but they will be confused by the lack of shipping quotes.

Posts: 139
Joined: 08/22/2007
Spreading the word - Ubercart for president.

Is this available to download in the current ubercart module? Or do I need to modify the code? If so what files need to be modified?

Thanks,
I

Posts: 2352
Joined: 08/07/2007
AdministratoreLiTe!

Changes are made to the Bazaar repository. Using Bazaar, you can easily get the latest code and keep it up to date.

When we do make a new release, this change and all the others that have been made will be in it.