Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Configuring the Zen Cart Admin / Built-in Shipping and Payment Modules / How to limit the number of countries from the shipping estimator page?

How to limit the number of countries from the shipping estimator page?

Locked

Started by w00gle on 4 Mar 2007, 6:26 AM · Views: 1,358

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
4 Mar 2007, 6:26 AM
#1
w00gle avatar

w00gle

New Zenner

Join Date:
Feb 2007
Posts:
39
Plugin Contributions:
0

Post #1 by w00gle

I thought I'd share this one to everyone. From the shipping estimator page, I only wanted to display the U.S. and Canada as selections. I accomplished this by editting includes/functions/functions_lookups.php.

After line 46, I added the line

 
where (countries_id = 223 || countries_id = 38)

ORIGINAL PHP CODE:

    if (zen_not_null($countries_id)) {
      if ($with_iso_codes == true) {
        $countries = "select countries_name, countries_iso_code_2, countries_iso_code_3
                      from " . TABLE_COUNTRIES . "
                      where countries_id = '" . (int)$countries_id . "'
                      order by countries_name";
        $countries_values = $db->Execute($countries);
        $countries_array = array('countries_name' => $countries_values->fields['countries_name'],
                                 'countries_iso_code_2' => $countries_values->fields['countries_iso_code_2'],
                                 'countries_iso_code_3' => $countries_values->fields['countries_iso_code_3']);
      } else {
        $countries = "select countries_name
                      from " . TABLE_COUNTRIES . "
                      where countries_id = '" . (int)$countries_id . "'";
        $countries_values = $db->Execute($countries);
        $countries_array = array('countries_name' => $countries_values->fields['countries_name']);
      }
    } else {
      $countries = "select countries_id, countries_name
                    from " . TABLE_COUNTRIES . "
                    order by countries_name";

PHP CODE AFTER EDIT:

    if (zen_not_null($countries_id)) {
      if ($with_iso_codes == true) {
        $countries = "select countries_name, countries_iso_code_2, countries_iso_code_3
                      from " . TABLE_COUNTRIES . "
                      where countries_id = '" . (int)$countries_id . "'
                      order by countries_name";
        $countries_values = $db->Execute($countries);
        $countries_array = array('countries_name' => $countries_values->fields['countries_name'],
                                 'countries_iso_code_2' => $countries_values->fields['countries_iso_code_2'],
                                 'countries_iso_code_3' => $countries_values->fields['countries_iso_code_3']);
      } else {
        $countries = "select countries_name
                      from " . TABLE_COUNTRIES . "
                      where countries_id = '" . (int)$countries_id . "'";
        $countries_values = $db->Execute($countries);
        $countries_array = array('countries_name' => $countries_values->fields['countries_name']);
      }
    } else {
      $countries = "select countries_id, countries_name
                    from " . TABLE_COUNTRIES . "
     where (countries_id = 223 || countries_id = 38)
                    order by countries_name";

Cheers!


Do you Gogo?

9 Jun 2009, 2:58 PM
#2
mickmo68 avatar

mickmo68

Zen Follower

Join Date:
Apr 2008
Location:
Boston
Posts:
129
Plugin Contributions:
0

Post #2 by mickmo68

:clap: Thank you, I had been searching but skipped this post a few times because there where no replies.
This worked perfectly.