Forums / Built-in Shipping and Payment Modules / Would like Country names on Checking not ISO 2 digit

Would like Country names on Checking not ISO 2 digit

Views: 1,414

Results 1 to 9 of 9
21 May 2012, 3:54 PM
#1
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Would like Country names on Checking not ISO 2 digit

Hi all

I have set up the zone module to calculate shipping based on the country, so far so good.

However, the zone rate is labeled, for example:

Shipping to GB

Is there a way I can set it up so it uses the Country name rather than its ISO code? I have searched and tried a method, but it didn't work.

Any help gratefully received.

Debbie Harrison
DVH Design | Web Design blog

24 May 2012, 12:20 PM
#2
jaygee avatar

jaygee

New Zenner

Join Date:
Mar 2005
Location:
UK
Posts:
38
Plugin Contributions:
0

Re: Would like Country names on Checking not ISO 2 digit

Debbie

did you manage to get this working?

I'm assuming the $dest_country needs to be changed in the following line:

$shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country . $show_box_weight;

Not sure what to though!

24 May 2012, 1:41 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Would like Country names on Checking not ISO 2 digit

You would need to customize the Zone Rates zones shipping module in:
/includes/modules/shipping/zones.php

adding the code in RED:

// class methods
    function quote($method = '') {
      global $order, $shipping_weight, $shipping_num_boxes, $total_count;
      $dest_country = $order->delivery['country']['iso_code_2'];
// bof: get country's name
      global $db;
      $dest_country_name_raw = $db->Execute("SELECT countries_name FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $dest_country . "'");
      $dest_country_name = $dest_country_name_raw->fields['countries_name'];
// eof: get country's name
      $dest_zone = 0;
      $error = false;

Then changing the lines to use the $dest_country_name:

// bof: use country's name
                $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country_name . $show_box_weight;
// eof: use country's name
// bof: use country's name
                $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country_name;
// eof: use country's name
// bof: use country's name
                $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country_name;
// eof: use country's name

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

24 May 2012, 2:04 PM
#4
jaygee avatar

jaygee

New Zenner

Join Date:
Mar 2005
Location:
UK
Posts:
38
Plugin Contributions:
0

Re: Would like Country names on Checking not ISO 2 digit

Thank you.

All working fine. Not that I ever doubted it would't unless I messed up the cut and paste.

24 May 2012, 2:18 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Would like Country names on Checking not ISO 2 digit

Thanks for the update that this is working for you ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

6 Feb 2013, 7:05 PM
#6
pxtures avatar

pxtures

New Zenner

Join Date:
Mar 2012
Location:
Singapore
Posts:
14
Plugin Contributions:
0

Re: Would like Country names on Checking not ISO 2 digit

Ajeh:

You would need to customize the Zone Rates zones shipping module in:
/includes/modules/shipping/zones.php

adding the code in RED:

// class methods
function quote($method = '') {
global $order, $shipping_weight, $shipping_num_boxes, $total_count;
$dest_country = $order->delivery['country']['iso_code_2'];
// bof: get country's name
global $db;
$dest_country_name_raw = $db->Execute("SELECT countries_name FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $dest_country . "'");
$dest_country_name = $dest_country_name_raw->fields['countries_name'];
// eof: get country's name
$dest_zone = 0;
$error = false;

> 
> Then changing the lines to use the $dest_country_name:
> ```
// bof: use country's name
                $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country_name . $show_box_weight;
// eof: use country's name

// bof: use country's name
$shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country_name;
// eof: use country's name

> 
> ```
// bof: use country's name
                $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country_name;
// eof: use country's name

Hi,

I would like to display country name during checkout also. I am now using V1.5.0 but I can find the first and the last part of the scripts needed to be changed, but couldn't find the 2nd and 3rd one you highlighted in red.
Can show me where to insert?

https://www.dropbox.com/s/6oeyfwindnatcub/zones.php

9 Feb 2013, 2:05 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Would like Country names on Checking not ISO 2 digit

The original line reads:

                $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country . $show_box_weight;

You need to change it to the new line with the variable in RED ...

[B]// bof: use country's name[/B]
                $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . [B]$dest_country_name[/B];
[B]// eof: use country's name[/B]

If you still want the $show_box_weight, then use:

[B]// bof: use country's name[/B]
                $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . [B]$dest_country_name[/B] . $show_box_weight;
[B]// eof: use country's name[/B]

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

13 Feb 2013, 4:39 PM
#8
pxtures avatar

pxtures

New Zenner

Join Date:
Mar 2012
Location:
Singapore
Posts:
14
Plugin Contributions:
0

Re: Would like Country names on Checking not ISO 2 digit

Ajeh:

The original line reads:

            $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country . $show_box_weight;
> 
> You need to change it to the new line with the variable in **RED **...
> ```
[B]// bof: use country's name[/B]
                $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . [B]$dest_country_name[/B];
[B]// eof: use country's name[/B]

If you still want the $show_box_weight, then use:

[B]// bof: use country's name[/B]
$shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . [B]$dest_country_name[/B] . $show_box_weight;
[B]// eof: use country's name[/B]


Hi Linda,

Sorry for the late reply due to my short break. Thank you so much for your help. It is working fine now!
13 Feb 2013, 5:21 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Would like Country names on Checking not ISO 2 digit

Thanks for the update that this is now working for you properly ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!