Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Account Constants


oki.tu

Recommended Posts

Posted

Hi there,

 

I need to change some account-/registration-constants, but i cant find the file.

 

could anyone tell me please where that file can be found?

 

 

Another question:

 

When i try to register an account in the shop, i have to enter a state/province.

1. Where are the lists for the states of each country?

2. How can i disable the requirement of this field?

 

 

 

Thanks

Posted

Hellloooo?!?

 

Everytime im posting a question into this forum i dont get any answer.

 

Why cant anyone answer such a simple question?

Posted

Hi there,

 

First of all. Im not happy either with this forum because the search engine just doesn't make sense (and believe me I know how to query). I think there should be an FAQ or something and the search engine should be updated. But ohh well. Its free so I won't complain! ;)

 

Anyways .....If you want to just disable the field then in the Admin panel/ configuration / customer details you should disable the fields you don't want. They will not show in the account creation form .

 

The countries are listed in a database. You could either delete them all or go to

http://www.oscommerce.com/forums/index.php?showtopic=88244&st=10

where they explain what else you could do.

 

The other solution I used was to leave the whole table intact but use the default_country contribution. http://www.oscommerce.com/community/contri.../search,country

 

What Im stuck now is that Netherlands is my default country but the user has to input his data first and get an error before the dropdown menu with states comes up. Really weird.

Posted

I can help with part of this... What I find puzzling is that the way the stock osC handles country/state is so lame, and generates so many complaints, but nobody has come up with a good solution. (At least in all my searching, I haven't found one.) I am working on one myself, but it involves JavaScript where I'm far from an expert, so I'm treading slowly.

 

Here's what I have so far that should at least be an improvement over stock. I show here changes for create_account.php. I haven't worked this in to the address book code yet.

 

First, find the line:

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));

at around line 252. Add after this:

if (!isset($country)){$country = 223;}

 

Replace 223 with the appropriate code for your country.

 

Next, replace the code that displays the state list (around line 415) with the following:

 

<?php
       $zones_array = array();
        $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = " . $country . " order by zone_country_id DESC, 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;

?>

 

Last, replace the line that displays the country list with this:

 

                <td class="main"><?php echo tep_get_country_list('country',$country) . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>

 

The effect of this will be to cause the default country to appear preselected in the country list and to have that country's states show in the state list.

 

What I haven't got yet is a way to cleanly allow the user to change the country and have the state list change accordingly. There are two approaches one can take that I can think of:

 

1) Load ALL the states in the zone table into an array and use JavaScript to filter out only the ones for the current country. Use an onChange action for the country to call a function that resets the state list in the browser.

 

2) Use an onChange action to "submit" the form in such a way that the check for missing fields is skipped and when the page refreshes, the new selected country is used for filling in the state list.

 

1 is the more traditional approach to this and is more natural to use, but I cringe somewhat at loading an array with all 181 or so zones. Maybe that isn't so bad...

 

2 seems cleaner, but is a bit jarring to the user (screen visibly refreshes) and is more complicated to code.

 

I will be working on this over the next few days and will see what I come up with. If any of you are JavaScript wizards, you could probably do it faster.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...