Zen Cart Logo
Forums / All Other Contributions/Addons / Selectable Countries [Support Thread]

Selectable Countries [Support Thread]

Views: 4,056

Results 1 to 20 of 20
22 Jun 2012, 6:23 PM
#1
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Selectable Countries [Support Thread]

You've got a store and you only want to ship to four countries ... today. This plugin allows you to enable or disable individual countries in your database so that if you decide tomorrow that you now want to ship to seven countries, it's a simple matter of clicking a couple of buttons in your admin area to enable the next three.

This plugin updates the display of your admin's Location/Taxes->Countries. Countries that are Active show a green-dot and those that are Inactive show a red-dot. You can change a country's Active status by either clicking on the dot to toggle between active and inactive or via checkbox input if you choose to Edit that country's settings.

When a country is Inactive, that country cannot be used in any customer address -- neither the billing nor shipping address can reside in that country. If an existing customer has an address-book entry in a country that is now inactive, that customer will be redirected to the address_book_process page upon login. From that page, they can either change the no-longer-supported address to have an active country, delete the no-longer-supported address or logoff.

This plugin was inspired by batracy's posts to http://www.zen-cart.com/showthread.php?195527-Ship-to-only-two-countries/page2; it includes an SQL patch to add a field to the countries table and also includes core file overwrites.

23 Jun 2012, 6:30 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: Selectable Countries [Support Thread]

Holy crow, that was fast ... the plugin is now available for download: http://www.zen-cart.com/downloads.php?do=file&id=1424.

25 Jun 2012, 12:38 AM
#3
batracy avatar

batracy

New Zenner

Join Date:
Jun 2012
Posts:
57
Plugin Contributions:
1

Re: Selectable Countries [Support Thread]

Nice job on putting the plugin together. I see you solved the remaining issue as well - well done!

30 Jun 2012, 6:37 PM
#4
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,875
Plugin Contributions:
7

Re: Selectable Countries [Support Thread]

Very good effort, this basic functionality is something that I would expect to see core in 2.0.

A further enhancement could be one-click enable/disable of logical groups of countries like continents and trade groups (EU, Unasur).

17 Feb 2013, 4:34 AM
#5
thannaree avatar

thannaree

Zen Follower

Join Date:
Dec 2010
Location:
Thailand
Posts:
304
Plugin Contributions:
1

Re: Selectable Countries [Support Thread]

I've just successfully installed this module and selected the countries of interest (Europe).

Now when I try and check out, I get this message: Sorry, we are not shipping to your region at this time.

Do I need to create a zone with the countries of interest to have this worked?

17 Feb 2013, 12:53 PM
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: Selectable Countries [Support Thread]

Thannaree, what shipping module(s) are you using? Is the Selectable Countries plugin operating properly -- does it limit the number of countries that can be used to create an account to only those you've selected?

I'm pretty sure (i.e. I don't know absolutely!) that if there is no Zone associated with a shipping module then that module is associated with any ship-to address specified by a customer.

18 Feb 2013, 6:15 AM
#7
thannaree avatar

thannaree

Zen Follower

Join Date:
Dec 2010
Location:
Thailand
Posts:
304
Plugin Contributions:
1

Re: Selectable Countries [Support Thread]

I use the free shipper module. The Selectable Countries plugin operates properly, it limits the number of countries that can be used to create an account to only those I've selected.

I've created a zone with the countries I've selected and associated the zone to the free shipper module and it now works.

27 Feb 2013, 10:51 PM
#8
ccmall avatar

ccmall

New Zenner

Join Date:
Feb 2013
Posts:
23
Plugin Contributions:
1

Re: Selectable Countries [Support Thread]

This is an awesome plug in. Question though. How hard would it be to modify this plug in to allow billing addy to be outside a selected country but not the shipping address? I know a lot of Canadians who buy from the US with a Canadian credit card and ship to a US address. I for one am one.

28 Feb 2013, 12:52 PM
#9
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: Selectable Countries [Support Thread]

CCMall:

This is an awesome plug in. Question though. How hard would it be to modify this plug in to allow billing addy to be outside a selected country but not the shipping address? I know a lot of Canadians who buy from the US with a Canadian credit card and ship to a US address. I for one am one.
Thanks for the compliment:smile: You could use this plugin to limit the countries that can be associated with an account (and, thus, either the shipping or billing address) and then use the built-in Zen Cart zones to restrict shipping to the US. That way, a customer in Canada can create an account (and a billing address) in Canada but would only be able to ship their order to an address in the US.

2 May 2013, 12:31 AM
#10
uncharted avatar

uncharted

New Zenner

Join Date:
Oct 2011
Posts:
68
Plugin Contributions:
0

Re: Selectable Countries [Support Thread]

Hello,

Is this module compatible with 1.5.1?

Regards

2 May 2013, 6:19 AM
#11
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Selectable Countries [Support Thread]

Yes it is

30 Nov 2013, 2:35 PM
#12
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: Selectable Countries [Support Thread]

The function provided by this plugin is partially supported in the upcoming Zen Cart v1.5.2, the differences being:

  1. This plugin adds the field countries_active char(1) to the countries table in the database; ZC 1.5.2 adds the field status tinyint(1)
  2. This plugin disallows the creation of any address (billing or shipping) if the country is not active; ZC 1.5.2 disallows only shipping addresses.
    I'm currently in limbo as to whether and/or how to merge this plugin's changes into a ZC 1.5.2 environment, so at this point of time this plugin should be considered not compatible with ZC 1.5.2.

Feedback and suggestions are welcomed.

5 Dec 2013, 3:13 PM
#13
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,875
Plugin Contributions:
7

Re: Selectable Countries [Support Thread]

as far as getting past the installer upgrade and maintaining the selected country settings I made this alteration to the installer code:
zc_install\sql\mysql_upgrade_zencart_151_to_152.sql
from

ALTER TABLE countries ADD status tinyint(1) DEFAULT '1';
to
ALTER TABLE countries CHANGE countries_active status tinyint(1) DEFAULT '1';

5 Dec 2013, 4:58 PM
#14
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,875
Plugin Contributions:
7

Re: Selectable Countries [Support Thread]

...since the functionality included in 1.5.2 has been lifted from this mod it seems logical that the existence of the countries_active column should have been sniffed out first by the installer before carrying out a corresponding CHANGE or ADD as required.

5 Dec 2013, 5:10 PM
#15
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: Selectable Countries [Support Thread]

lat9:

The function provided by this plugin is partially supported in the upcoming Zen Cart v1.5.2, the differences being:

  1. This plugin adds the field countries_active char(1) to the countries table in the database; ZC 1.5.2 adds the field status tinyint(1)
  1. This plugin disallows the creation of any address (billing or shipping) if the country is not active; ZC 1.5.2 disallows only shipping addresses.

I'm currently in limbo as to whether and/or how to merge this plugin's changes into a ZC 1.5.2 environment, so at this point of time this plugin should be considered not compatible with ZC 1.5.2.

Feedback and suggestions are welcomed.
The v1.5.2 implementation is not as far off from "Selectable Countries" as I was led to believe by the wording in the v1.5.2 admin. On the store-side, if a country is disabled, it can't be used for either a shipping nor a billing address ... just like "Selectable Countries".

torvista:

as far as getting past the installer upgrade and maintaining the selected country settings I made this alteration to the installer code:
zc_install\sql\mysql_upgrade_zencart_151_to_152.sql
from ```
ALTER TABLE countries ADD status tinyint(1) DEFAULT '1';

> 
> to ```
ALTER TABLE countries CHANGE countries_active status tinyint(1) DEFAULT '1'; 

When I get to the update for "Selectable Countries" for v1.5.2, I'll include an upgrade.sql file with this (thanks)!

11 Dec 2013, 7:38 PM
#16
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: Selectable Countries [Support Thread]

Following is the text that I'm planning to include in the next update of Selectable Countries, describing the upgrade procedure to Zen Cart v1.5.2:

Upgrading to Zen Cart v1.5.2 or later

The function provided by Selectable Countries is included in Zen Cart v1.5.2 and later. If you have installed Selectable Countries on your Zen Cart v1.5.0 or v1.5.1 store and are preparing to upgrade, this section identifies that process. The following table identifies what action to perform on each of this plugin's files during your upgrade:

File Name                                                                             Upgrade Action
/includes/auto_loaders/config.country_check.php                                       Delete
/includes/init_includes/init_country_check.php                                        Delete
/includes/functions/functions_lookups.php                                             Use Zen Cart distribution version
/includes/functions/extra_functions/selectable_countries_functions.php                Delete
/includes/languages/english/extra_definitions/YOUR_TEMPLATE/selectable_countries.php  Delete
/YOUR_ADMIN/countries.php                                                             Use Zen Cart distribution version
/YOUR_ADMIN/includes/languages/english/countries.php                                  Use Zen Cart distribution version

Once the file and database portions of your upgrade are completed, run the SQL patch present in /sc_upgrade_to_zc152.sql. This file changes the name of the countries_active field to its Zen Cart v1.5.2+ field name (status).

The SQL file contains:

# 
# Use this SQL script to upgrade your Selectable Countries installation to Zen Cart v1.5.2 and later.
#
# Selectable Countries uses the field named "countries_active" to identify whether/not the associated country is active
# while Zen Cart v1.5.2 and later use the field named "status".
# 
# Upgrading your database requires two steps:
# 1) Removing the 'status' field from the 'countries' table
# 2) Modifying the 'countries_active' field from your Selectable Countries installation to the 'status' format.
#    Thanks to torvista for providing this SQL fragment!
#
ALTER TABLE countries DROP status;
ALTER TABLE countries CHANGE countries_active status tinyint(1) DEFAULT '1';
7 Jan 2014, 9:27 PM
#17
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: Selectable Countries [Support Thread]

v1.1.0 of Selectable Countries is now available in the Plugins. The only change was to incorporate the v1.5.2 upgrade instructions/SQL patch indicated by the previous posting.

26 Jul 2014, 11:47 AM
#18
togfather avatar

togfather

New Zenner

Join Date:
Dec 2009
Location:
Scotland
Posts:
76
Plugin Contributions:
0

Re: Selectable Countries [Support Thread]

Hello,

My DB has prefix ZEN_ ( define('DB_PREFIX', 'zen_');)

I try to install the SQL file by pasting: # Selectable Countries Plugin - Install SQL to add the countries_active field to the countries table.
ALTER TABLE zen_countries ADD countries_active char(1) default 1;
and I get the following message:
WARNING: An Error occurred, please refresh the page and try again
Refreshing, going back and trying again gets the same message. Can anyone offer help?

Regards

Tog

26 Jul 2014, 1:25 PM
#19
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: Selectable Countries [Support Thread]

When you see the message "WARNING: An Error occurred, please refresh the page and try again", there's a debug-log file present in either your /logs directory or the /cache directory if your Zen Cart version is v1.5.0 or earlier.

If you simply open the installation SQL file in a text editor, copy its contents to the clipboard and then paste that information into your admin's Tools->Install SQL Patches, Zen Cart "knows" that you've got a non-blank DB_PREFIX and will properly handle those changes.

26 Jul 2014, 4:15 PM
#20
togfather avatar

togfather

New Zenner

Join Date:
Dec 2009
Location:
Scotland
Posts:
76
Plugin Contributions:
0

Re: Selectable Countries [Support Thread]

Thank you but I still couldn't get the plug in to work, so now I have removed the unwanted countries from the database, leaving only one (United Kingdom).

Do you know how I can get rid of the country drop down box, and just have United Kingdom show as static text instead?

Regards

Tog