Jump to content
Sign in to follow this  
enigma1

Active Countries

Recommended Posts

I just wanted to add, for those who run the BTS contribution, some of the code you need to replace will be found in the filename.tpl files. So, if you do not find the code you are looking for in the files mentioned, look in it's cooresponding tpl file.

Share this post


Link to post
Share on other sites

I?m having problems with this contribution because I?m using PWA and FEC (shipping combo bit). Actually it?s probably PWA which is the main culprit.

Can some please advise how to modify this contribution to work in PWA?

(Contribution works fine in normal login pages)

Thanks

Pete

Share this post


Link to post
Share on other sites

Great contribution. It has helped me out a lot.

 

I think I found a small bug with it though. When I go back in to edit my address from the account section the country dropdown doesn't remember what country I picked and defaults to the store's country. I applied the following fix to includes/modules/address_book_details.php and it seems to work ok now:

 

Change:

			<td class="main"><b><?php echo ($tmp_object = tep_get_country_active_list('country', $country, 'onChange="this.form.submit();"')) . tep_draw_hidden_field('country_old', $country) . ' ' . (is_array($tmp_object) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></b></td>

 

to:

<?php
if ($process == true) {
?>
		<td class="main"><b><?php echo ($tmp_object = tep_get_country_active_list('country', $country, 'onChange="this.form.submit();"')) . tep_draw_hidden_field('country_old', $country) . ' ' . (is_array($tmp_object) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></b></td>
<?php
} else {
?>
		<td class="main"><b><?php echo ($tmp_object = tep_get_country_active_list('country', $entry['entry_country_id'], 'onChange="this.form.submit();"')) . tep_draw_hidden_field('country_old', $entry['entry_country_id']) . ' ' . (is_array($tmp_object) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></b></td>
<?php
}
?>

 

I've done some testing and it seems to work ok but use it at your own risk :)

Share this post


Link to post
Share on other sites

Interesting that no one posted problems with reset meta and seo cache scripts. I had to get (download) one, and then create the other.

 

Anyway anyone else have the very small issue of the status in admin not changing from red to green? Doesn't matter since the change is actually recorded in the database, just curious about the glitch.

 

Now if someone would only write an "active attribute" contribution whereby you have attribute a and attribute b and all options for attribute b where dependent on a via refresh. Many stores have this and it would just be a a fantastic, significant asset. :P

 

Nevertheless this is a great contribution in it's own right and makes the drop down addon for states, provinces, etc., useable when doing business outside ones own country. Without it that drop down menu is a convoluted mess. :)

 

JP

Edited by jpalbicke

Share this post


Link to post
Share on other sites
Anyway anyone else have the very small issue of the status in admin not changing from red to green? Doesn't matter since the change is actually recorded in the database, just curious about the glitch.

 

LEDs do change and reflect the database condition of the country's status. Double check the install instructions. Be carefuly if you have other mods installed in the same script.

Share this post


Link to post
Share on other sites
LEDs do change and reflect the database condition of the country's status. Double check the install instructions. Be carefuly if you have other mods installed in the same script.

 

 

Actually the store is about as "modded" up as you can get, however very little work has been done to the scripts that relate to active countries.

 

Not too concerned though, since I tested the drop down menus, then tested the shipping options tied to the geo zones I have set up, and everything seems to be a ok...

 

And as I said, for stores that ship around the world and also use the drop down menu for states, this is an absolute necessity.

 

JP

Share this post


Link to post
Share on other sites

Anyone know if it is possible to create, say, an anchor, so that when the page refreshes, it lands back at the "Country" and/or "State" field, as opposed to the top of the page? It would be a nice touch if the customer did not have to scroll back down to finish his registration. :)

 

JP

Share this post


Link to post
Share on other sites

Hello,

 

I'm new at osCommerce and therefore apologize for a mightbe silly question.

 

I found this great contrib and started installing it. So I altered the files as mentioned in your document and run the SQL file.

 

In the admin area, everything in fine. LEDs are switching and the redslt in the countries table is ok.

But when it comes to add a new customer, all countries are displayed in the dropdown.

 

Could you give me a hint please?

 

j?rgen

Edited by stritti

Share this post


Link to post
Share on other sites

double check the instructions if all changes are implemented in the catalog\create_account.php. If you still cannot find the problem post the file here

Share this post


Link to post
Share on other sites

I have a minor problem with my address data on the catalog side of OSCommerce. I have only just noticed this having implemeted this excellent contribution a few months back as part of a development. I also implemented PWA a while back.

 

Whenever an address is displayed, e.g. in address_book.php, checkout_shipping.php etc, the zone_id is output on the screen and not the zones description. On the admin side when displaying orders I do not have this problem

 

I use address format 1 ($firstname $lastname$cr$streets$cr$city$cr$state$cr$postcode$cr$country)

 

I notice in the database address_book that the entry_state is blank.

 

Could this be related to the contribution or does anyone know how to fix this so that the description is output rather than the zone_id.

 

Thanks

Share this post


Link to post
Share on other sites

the zone_id is used and picks up the associated name from the zones table. The address_book entry_state should be blank to enforce selection from the list of zones/countries via identifiers. Otherwise you usually ending up with customers not paying taxes, shipping & handling mispelled addresses etc.

 

So have you implemented the drop-down list code that came with the contribution files? When you create an account or you change address you should have a drop-down list for the states. Make sure you have the zones populated for the countries where your store operates.

Share this post


Link to post
Share on other sites
the zone_id is used and picks up the associated name from the zones table. The address_book entry_state should be blank to enforce selection from the list of zones/countries via identifiers. Otherwise you usually ending up with customers not paying taxes, shipping & handling mispelled addresses etc.

 

So have you implemented the drop-down list code that came with the contribution files? When you create an account or you change address you should have a drop-down list for the states. Make sure you have the zones populated for the countries where your store operates.

 

Hi, thanks for reply.

 

The pull down menu is working fine to capture the state. I have the zones populated as well. E.g. Zone BERK = Berkshire for the UK

 

When I see the address displayed on screen e.g. the delivery address on checkout_shipping.php, billing address on checkout_payment etc, the address is displayed as 'BERK' rarther than berkshire. I'm not sure how to amend this to get the description rather than code displayed.

Share this post


Link to post
Share on other sites

I see, well the behaviour of osc in that case is to pick up the zone code rather name, but yea I know what you mean in UK the whole name is needed. Ok backup affected files and try this:

 

Open catalog\includes\functions\general.php locate this code

 

$state = tep_get_zone_code($address['country_id'], $address['zone_id'], $state);

 

change it to:

$state = tep_get_zone_name($address['country_id'], $address['zone_id'], $state);

 

make sure you test this change adequately with your checkout procedure. And this should not apply for countries where the zone code needed like US, so if you're opearating on multiple countries in EU and Nort America, you may have to add more code or do enhancements for zone code vs zone name selection based on country.

Share this post


Link to post
Share on other sites

Thanks for your support and explanation. I will try that out in my test system.

 

 

I will be slowly expanding my shop to other countries in the EU (what a great contribution you made for this).

 

I may just amend the zones table data for the uk for now so that the zone code = description. I now thats not particularly clever, but I don't think I need the zone code in any of my tax / shipping code for the UK. I will test that as well.

Regards

Andrew

Share this post


Link to post
Share on other sites

Hi Mark,

 

This is a very good contribution. :thumbsup:

 

I can see that the Country field is automatically set to the country of the store. As I sell as well in France, Spain and USA and therefore use 3 languages in my osCommerce shop, is it possible to automatically set the Country dropdown menu to the country of the language that is used in the shop? (French -> France, English -> USA, Spanish -> Spain). :blush:

 

Sincerely,

 

Amar

Share this post


Link to post
Share on other sites

Hi Mark,

 

By the way, when the user selects a country that has no state/province, a mix of all the states available in the database appears in the 'State/Province' dropdown menu. Is it possible to get rid of this behavior?

 

Sincerely,

 

Amar

Share this post


Link to post
Share on other sites

to have zones for all countries you need something like this:

http://www.oscommerce.com/community/contributions,1792

but becareful how to install it. Backup the dbase first, then remove zones that already exist in your store from the sql file otherwise you will mess existing accounts.

 

As of setting up different based on language you have to define somehow the countries and then associate them with a language. I am sure there are contributions that you could extract code from and port it over to your store. Then create_account.php could be changed instead of using

 

  $country = (isset($HTTP_POST_VARS['country']))?tep_db_prepare_input($HTTP_POST_VARS['country']):((int)STORE_COUNTRY);

 

to replace the STORE_COUNTRY with the one from a table.

http://www.oscommerce.com/community/contributions,1568

Edited by enigma1

Share this post


Link to post
Share on other sites

Hi Mark,

 

Thanks for pointing me to the 'Country Names' contribution.

 

As for the other question, I don't need (and I don't want) to have zones for all countries. I would like, if no zones are in the database, that a normal text input field is shown in place of the dropdown menu. Is it possible with your contribution?

 

Sincerely,

 

Amar

Share this post


Link to post
Share on other sites

it was zones names for countries. The drop-down zone lists are part of the contribution really. And the reason is shipping and taxes. If you have edit boxes then a visitor can enter whatever he wants under the zone. If the osc code cannot detect the zone it will not impose shipping, tax during checkout.

 

Another thing some people do, is to delete the unused countries from the dbase and use the original osc code. (That will do what you're asking). The problem is, if you decide to add new countries later the identifiers are different and other countries/zones contributions or modules that rely on these identifiers don't work.

Share this post


Link to post
Share on other sites

Hi Mark,

 

I understand. The contry zone is useful for shipping taxes.

 

Maybe I didn't make my self clear in my previous message. I mean, for every country in the database that has no zone (and don't need zone for calculation of taxes/shipping, for instance Belgium) the dopdown menu is totally messed up (a mix of all zones available in the database, in this case Spain, USA, Germany and France).

 

USA - Good: AC_USA.jpgBelgium - Bad: AC_Belgium.jpg

Sincerely,

 

Amar

Edited by Amar_Guerfi

Share this post


Link to post
Share on other sites

the way it works is that if no zones are assigned for a country it brings up the list of all zones available. So what you see is how it works.

 

If you install the zones for Belgium it should be ok. It's not only for shipping those were just examples. If your customer enters an invalid state you do not know when the order is placed where to ship the goods. So zones for the operational countries are important.

Share this post


Link to post
Share on other sites

Hi,

 

 

i hope somebody is still watching this thread ;)

 

 

I've installed the Active Countries mod and just activated the UK.

 

 

So, when i go and try to create an account i am presented with the usual form and there is no drop-down field for the country but the text "United Kingdom" as it should be.

 

The problem however is that for the State-field (i renamed the field to "County" in languages/english.php (?)) it displays an edit-box at first.

 

When you input all the necessary fields and either leave the field blank or input something (doesn't matter) and click on "Continue" to sign up you'll get redirected back to the register-form with the error-message "Error Please select a state from the States pull down menu." shown above.

 

And only after this procedure, the drop-down box then appears, to select a county/state.

 

I already checked create_account.php if i did forget something to add but it looks just good.

 

I hope somebody has an advice for me ;)

Share this post


Link to post
Share on other sites

The contribution has the create_account.php file with the edit box replaced by a drop-down list. Install that section:

 

	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 . " 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);
}

 

And you should no longer have an edit box. Do the same for the edit delivery and payment address files. Also install the states for UK so the drop-down list will be populated with correct values.

Share this post


Link to post
Share on other sites

Hello! :)

I have just installed this contribution and it seems to be working just fain. Thank you very much!

 

Simone

 

P.S. Here is my webpage in case you want to have a look :) Magic Senses

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×