CRE Loaded Community



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: 28
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.


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 Fri Jul 30, 2010 11:59 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Login

Top Listing

1. Credit Card with CCV
    Category: Payment Modules
    
2. CC7333_ATS
    Category: Templates
    
3. Points & Rewards PLUS!...
    Category: Add-Ons
    
4. One Page Checkout...
    Category: Fixes
    
5. Configuration Server...
    Category: Fixes
    
Show more...

Follow Us on Twitter

@likeOMGitsFEDAY we do offer a wiki and other resources at www.creloaded.org
@smellgoodslady 6.2 is old code, we are at 6.4 now. come and get the latest.
@smellgoodslady what version/release are you running?
CRE Secure in the news: Payment News Article about Hosted Payment Pages reducing PCI friction - http://is.gd/ba0CH
@smellgoodslady yes it should work for 6.2 as well. let me know of you have any issues.

CRE Loaded Community Chat hosted by CRE Loaded.

Join now


Chat about what's on your mind. More about public chats.


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