Loaded Commerce Community

Banner


Board index » Web Design and Development » Contribution Announcements

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Counties/State Drop Down Menu
PostPosted: Fri Apr 08, 2005 2:54 am 
Offline
CRE Expert

Joined: Thu Nov 11, 2004 1:00 am
Posts: 884
Location: Barking, England
Some may find this useful, adds a dropdown box instead of haveing to write but be warned you will need to make sure you have enough zones defined in your database.



Code:
In catalog/templates/content/create_account.tpl.php:

Find:

<?php
  if (ACCOUNT_STATE == 'true') {
?>
              <tr>
                <td class="main"><?php echo ENTRY_STATE; ?></td>
                <td class="main">
<?php
    if ($process == true) {
      if ($entry_state_has_zones == true) {
        $zones_array = array();
        $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name");
        while ($zones_values = tep_db_fetch_array($zones_query)) {
          $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
        }
        echo tep_draw_pull_down_menu('state', $zones_array);
      } else {
        echo tep_draw_input_field('state');
      }
    } else {
      echo tep_draw_input_field('state');
    }

    if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT;
?>
                </td>
              </tr>
<?php
  }
?>

--------------------------------------
Replace with:

<?php
    if ($process == true) {
      if ($entry_state_has_zones == true) {
        $zones_array = array();
        $zones_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
        $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name");
        while ($zones_values = tep_db_fetch_array($zones_query)) {
          $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
        }
        echo tep_draw_pull_down_menu('state', $zones_array);
      } else {
        $zones_array = array();
        $zones_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));     
        $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " order by zone_name");
        while ($zones_values = tep_db_fetch_array($zones_query)) {
        $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
        }
        echo tep_draw_pull_down_menu('state', $zones_array);
      }
    } else {
        $zones_array = array();
        $zones_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));     
        $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " order by zone_name");
        while ($zones_values = tep_db_fetch_array($zones_query)) {
        $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
        }
        echo tep_draw_pull_down_menu('state', $zones_array);
    }

    if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT;
?>
                </td>
              </tr>
<?php
  }
?>


Here is what it can look like:

Image


Top
 Profile  
 
 Post subject: Re: Counties/State Drop Down Menu
PostPosted: Fri Jan 20, 2006 3:21 pm 
Offline
CRE Newbie
User avatar

Joined: Fri Jan 20, 2006 1:00 am
Posts: 32
Hi wroughtec,

It worked. Thanks.

How would I get rid of the states other than US states? I've deleted all the countries except US in the "countries" and "zones" database, but I still get the other states.

Thank you.

_________________
EQ3


Top
 Profile  
 
 Post subject: Re: Counties/State Drop Down Menu
PostPosted: Thu Dec 17, 2009 5:13 am 
Offline
CRE Newbie
User avatar

Joined: Thu Dec 17, 2009 5:08 am
Posts: 1
Thanks for a great topic its works with a small change!!! :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

Board index » Web Design and Development » Contribution Announcements

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
It is currently Thu May 24, 2012 6:27 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Login

Forums Latest Activity

Top Listing

1. Cart2Cart - Shopping...
    Category: Shopping Cart Database Conversion Scripts
    
2. Points & Rewards PLUS!...
    Category: Add-Ons
    
3. Configuration Server...
    Category: Fixes
    
4. Credit Card with CCV
    Category: Payment Modules
    
5. CC7333_ATS
    Category: Templates
    
Show more...

© CRE Loaded is a product of Chain Reaction Ecommerce, Inc. Usage & Privacy Policy