Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Change iso-code-2 to country name

Change iso-code-2 to country name

Locked

Views: 5,923

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
11 Sep 2006, 5:26 AM
#1
sjoblin avatar

sjoblin

New Zenner

Join Date:
Sep 2006
Posts:
1
Plugin Contributions:
0

Change iso-code-2 to country name

I have searched and searched for the answer to this one :shocking: but havnt been able to find the answer anywhere.

Its a very simple question, how do I change the iso-code-2 display on the zones shipping, during checkout. Instead of it saying

Shipping to AK (1 x 3.00kg(s))
I want it to say
Shipping to Auckland (1 x 3.00kg(s))

Ive looked at the zones.php and can find where it says the following

// class methods
function quote($method = '') {
global $order, $shipping_weight, $shipping_num_boxes, $total_count;
$dest_country = $order->delivery['country']['iso_code_2'];
$dest_zone = 0;
$error = false;

I assumed that if I changed the iso_code_2 to say name that would do the job but it doesnt.

Any clues??

14 Mar 2008, 9:37 PM
#2
stavros avatar

stavros

New Zenner

Join Date:
Feb 2008
Location:
Poland
Posts:
11
Plugin Contributions:
1

Re: Change iso-code-2 to country name

I'm surprised nobody responded to this earlier. Technically, if you do not use "Zone Rates" shipping (maybe others) you could change it to 'title'; but, that is an aweful hack. A better way to do it would be to create another variable and display that. I am using ZC version 1.3.8.

Hacking a core file, or "How can I make upgrading harder?"

includes/modules/shipping/zones.php

around line 118:

function quote($method = '') {
  global $order, $shipping_weight, $shipping_num_boxes, $total_count;

  $dest_country = $order->delivery['country']['iso_code_2'];
  // add the next line
  $dest_country_name = (($dest_title =$order->delivery['country']['title']) == '' ? $dest_country : $dest_title);

  $dest_zone = 0;
  $error = false;

Then change $dest_country to $dest_country_name in three places in the same file.

around line 174:

$shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country_name . $show_box_weight; // change this line
$done = true;

around line 188:

if (($_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices()) <= $zones_table[$i]) {
  $shipping = $zones_table[$i+1];
  $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country_name; // change this line

around line 202:

if (($total_count - $_SESSION['cart']->free_shipping_items()) <= $zones_table[$i]) {
  $shipping = $zones_table[$i+1];
  $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country_name; // change this line
  $done = true;
16 Mar 2008, 11:33 PM
#3
cntgifts avatar

cntgifts

Totally Zenned

Join Date:
Sep 2005
Posts:
836
Plugin Contributions:
0

Re: Change iso-code-2 to country name

tried that it didnt work

17 Mar 2008, 8:03 AM
#4
stavros avatar

stavros

New Zenner

Join Date:
Feb 2008
Location:
Poland
Posts:
11
Plugin Contributions:
1

Re: Change iso-code-2 to country name

A little more detail would be helpful to solve your problem. Try reverting all your changes (back to the way it was originally) and try the following: (hopefully you have a development server to try this on!)

includes/modules/shipping/zones.php

change this line:

  $dest_country = $order->delivery['country']['iso_code_2']; 

to this:

  $dest_country = $order->delivery['country']['title']; 

What does that look like? Note: this will screw up the shipping charges calculation, but should display the country name.