Zen Cart Logo
Forums / All Other Contributions/Addons / Add Customers From Admin - default country

Add Customers From Admin - default country

Locked

Views: 1,489

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
5 Nov 2007, 5:00 PM
#1
tat2nu avatar

tat2nu

Zen Follower

Join Date:
Jan 2005
Posts:
178
Plugin Contributions:
0

Add Customers From Admin - default country

I love the add customers from admin module by Rick Riehle but I was wondering if I can set the default country to United States in stead of being alphabetically listed. I searched cut can not seem to find posts addressing this.

thanks,
Marc

9 Nov 2007, 2:39 AM
#2
thomasw98 avatar

thomasw98

Zen Follower

Join Date:
Aug 2007
Location:
Eugene, OR
Posts:
166
Plugin Contributions:
0

Re: Add Customers From Admin - default country

tat2nu:

I love the add customers from admin module by Rick Riehle but I was wondering if I can set the default country to United States in stead of being alphabetically listed. I searched cut can not seem to find posts addressing this.

thanks,
Marc

I want to do the same. I think we need to adjust something on these lines:

if ($error == true) {
    if ($entry_country_error == true) {
      echo zen_draw_pull_down_menu('entry_country_id', zen_get_countries(), $cInfo->entry_country_id) . ' ' . ENTRY_COUNTRY_ERROR;
    } else {
      echo zen_get_country_name($cInfo->entry_country_id) . zen_draw_hidden_field('entry_country_id');
    }
  } else {
    echo zen_draw_pull_down_menu('entry_country_id', zen_get_countries(), $cInfo->entry_country_id);
  }

But I can not figure it out. I successfully set this up for the account creation page, but now I forgot how I did it. Maybe someone else can help on this?

9 Sep 2008, 6:01 AM
#3
grind avatar

grind

New Zenner

Join Date:
Aug 2008
Posts:
5
Plugin Contributions:
0

Re: Add Customers From Admin - default country

Hey guys,
I wanted to do the same, and I couldn't find it anywhere, so I went on a hunt.

Anyways,

File: /admin/includes/functions/general.php

Look for the function zen_get_countries

And here is how it should look like

  function zen_get_countries($default = '') {
    global $db;
    $countries_array = array();
    if ($default) {
      $countries_array[] = array('id' => '',
                                 'text' => $default);
    }
    $countries = $db->Execute("select countries_id, countries_name
                               from " . TABLE_COUNTRIES . " WHERE countries_id!='223'
                               order by countries_name");

	$countries_array[] = array('id' => '223',
                               'text' => 'United States');
    while (!$countries->EOF) {
      $countries_array[] = array('id' => $countries->fields['countries_id'],
                                 'text' => $countries->fields['countries_name']);
      $countries->MoveNext();
    }

    return $countries_array;
  }

Hope that helps
=]