Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Restricting Oscommerce to one Country


bitznbytes

Recommended Posts

Posted

Hi, looking to restrict OScommerce to sell just in Canada - Can anyone suggest what steps I should do to ensure only people in Canada can buy my products?

 

Thanks,

 

B

Posted

I don't quite know of any other solutions, but this one worked for me:

 

Go to Admin -> Locations/Taxes -> Countries and delete all the countries that you don't want. (Yes, it's a bit boring, but it workes.) Just make sure that zones for the country left behind are still there.

 

When a guest adds to their cart and tries to checkout, Oscommerce will ask them to create an account. They will only be able to select Canada as their country.

 

Hope this helps! :thumbsup:

Posted

If you don't mid getting your fingers dirty with a quick bit of coding there's another approach which just modifies the function function 'tep_get_country_list' in catalog/includes/functions/html_output.php slightly to display only one country. It has been discussed several times on the forums.

Posted

Try replacing the existing function with:

 

// Creates a pull-down list of countries
 function tep_get_country_list($name, $selected = '', $parameters = '') {
$countries_array = array(array('id' => '38', 'text' => 'Canada'));
$countries = tep_get_countries();
//   for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
//	 $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
//   }
$countries_array[] = array('id' => '38', 'text' => 'Canada');
return tep_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
 }

 

It should be simpler than this. The is from the multiple countries method. I am just trying to save you the bother of searching.

btw the Active Countries contrib is imo a very long-winded method of achieving a similar aim. YMMV

Posted
btw the Active Countries contrib is imo a very long-winded method of achieving a similar aim. YMMV

 

I don't think so, because you can have people registering from all over the world but only allow people from certain countries to checkout. Plus a bunch of other features.

 

With your approach not only you restrict countries for selection from the entire store, but you do not do form validation meaning someone can setup a country_id in the form outside the list and still create an account or checkout.

 

 

And if you remove countries from a seasoned store you risk customers who created already accounts with countries that no longer exist to cause problems. Plus the countries identifiers will be different when you delete/re-insert countries and that affects other tables.

Posted

Yes the full approach allows people to live anywhere but to deliver only to one country. That is the advantage.

 

My approach suits shops with lots of contributions already installed who are not in a position to just replace the files. It also offers the ability to still deliver to existing customers outside the area (to ease the changeover) and as you say, we could if we wished still accomodate exceptions on a case-by-case basis.

Posted

Hi radders,

tried your suggestion but that did not make a difference....just setup an account and had an address for the US and it let me buy something...

Archived

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

×
×
  • Create New...