Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

DHL module error: Country invalid


nicklestud

Recommended Posts

I seem to get an error when using the DHL Module. The error is as reads:

 

DHL Express (1 x 2lbs) DHL Express

The following errors have occured:

1. Country invalid.

 

 

I get this whenever I use a UK address. Anyone else getting this error when they are using a certain address?

 

-Nickle

Link to comment
Share on other sites

  • 1 month later...

Here is what DHL sent me about this issue:

 

Sorry for the incorrect code .

Use "UK" instead of "GB".

Here is an example :

<Receiver>

<Address>

<CompanyName>Coke E. Coli</CompanyName>

<Street>303 Regent Street</Street>

<City>Leicester</City>

<State></State>

<PostalCode>LE45DP</PostalCode>

<Country>UK</Country>

</Address>

<AttnTo>Sally Consumer</AttnTo>

<PhoneNbr>206-255-2555</PhoneNbr>

</Receiver>

The document will be updated.

 

Regards,

Harish

 

XML Implementation Team

 

DHL

10001 N. 92nd Street

Suite 100

Scottsdale, AZ 85258

USA

 

fax: (480) 907-2220

 

[email protected]

www.dhl.com

Link to comment
Share on other sites

I put the code shown below into the includes/modules/shipping/dhlairborne.php

somewhere around line 273. Pretty simple fix. Basically I had to change the information from 'GB' into "UK'. I tested it out for address from Scotland all the way to N Ireland and it works.

 

Here is the old code:

	function _setDestination($street_address, $city, $state, $postal, $country) {
  global $order;

  $postal = str_replace(' ', '', $postal);
  $state_query = tep_db_query("select zone_code from " . TABLE_ZONES . " where zone_name = '" . $state . "' and zone_country_id = '" . (int)$order->delivery['country']['id'] . "'");
  $state_info = tep_db_fetch_array($state_query);

  $this->destination_street_address = $street_address;
  $this->destination_city = $city;
  $this->destination_state = $state_info['zone_code'];
  $this->destination_postal = substr($postal, 0, 5);
  $this->destination_country = $country;
}

 

 

Here is what I changed it to:

 

	function _setDestination($street_address, $city, $state, $postal, $country) {
  global $order;

  $postal = str_replace(' ', '', $postal);
  $state_query = tep_db_query("select zone_code from " . TABLE_ZONES . " where zone_name = '" . $state . "' and zone_country_id = '" . (int)$order->delivery['country']['id'] . "'");
  $state_info = tep_db_fetch_array($state_query);

  $this->destination_street_address = $street_address;
  $this->destination_city = $city;
  $this->destination_state = $state_info['zone_code'];
  $this->destination_postal = substr($postal, 0, 5);
  if ($country == 'GB'){
	  $country = "UK";
  } 
  $this->destination_country = $country;
}

Link to comment
Share on other sites

  • 2 months later...

You can also just go into Countries (under Locations / Taxes) in your configuration screens and for the country United Kingdom just change the two-letter code from GB to UK. This is where the shipping modules get their data. But this changes it for the entire osCommerce system, not just the DHL shipping module.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...