Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Prohibiting Shipping to States/Countries


bird68

Recommended Posts

Hello,

 

I'm looking for a way to prohibit shipping to particular areas. I've searched exhaustingly through this forum and the contributions. There were some suggestions prevented the shipping module from appearing -- but the approach hard-coded the locale -and- didn't issue a warning (and in some cases still allowed the order). Other approaches, simply won't display the state/country, but would allow them to be entered manually or the order would still be processed (just with no shipping fees).

 

Anyway, the closest thing I found was "Country Based Shipping" -- this (cool) contribution restricts where a particular product can be shipped based on the tax zone. The nice thing about this is that it issues an explanation why the product can't be shipped. The downside, is that it's based on tax-zones, so to include exclude a state or region -- a zone need to be created to include the world, except the prohibited states/regions. Also, it would appear this approach would interfere with normal taxing process, since a product only has one tax class.

 

I've noticed that other people have requested this...so it's not an unusual requirement, especially given the huge range of variants in regulatory restrictions from country/state to country/state. It seems like a module where states/countries can be specified as no ship/order zones would be a great contribution.

 

Any help/suggestions would be greatly appreciated!

 

 

Cheers,

 

-Bird

Link to comment
Share on other sites

OK, let me get this straight - you want to be able to define a list of countries which essentially display a message that say we can't ship this item to this country turn off the checkout button (to make sure nobody checks out is spite of the message). Are we talking about a list that differs from product to product or just a master list?

Even at a Mensa convention someone is the dumbest person in the room.

Link to comment
Share on other sites

OK, let me get this straight - you want to be able to define a list of countries which essentially display a message that say we can't ship this item to this country turn off the checkout button (to make sure nobody checks out is spite of the message). Are we talking about a list that differs from product to product or just a master list?

 

Exactly. For us, it's a master list that applies to all products. In the US, we actually need to restrict shipment to particular states, so the list would need to be more specific that just country codes.

 

Best Regards!

Link to comment
Share on other sites

Exactly. For us, it's a master list that applies to all products. In the US, we actually need to restrict shipment to particular states, so the list would need to be more specific that just country codes.

 

Best Regards!

 

 

Hi there..

 

you will need to change the code below the following line:

<td class="main"><b><?php echo TABLE_HEADING_SHIPPING_METHOD; ?></b></td>

in the checkout_shopping.php file.

 

you can access the customer address by that time and hence find the zone, country and/or state using the functions already present.

check for right conditions like zone not in NY TX etc and if still ok calculate shipping, else dont calculate;display error message;

 

Need more help, let me know.

 

Cheers

Hari

Link to comment
Share on other sites

Hi there..

 

you will need to change the code below the following line:

<td class="main"><b><?php echo TABLE_HEADING_SHIPPING_METHOD; ?></b></td>

in the checkout_shopping.php file.

 

you can access the customer address by that time and hence find the zone, country and/or state using the functions already present.

check for right conditions like zone not in NY TX etc and if still ok calculate shipping, else dont calculate;display error message;

 

Need more help, let me know.

 

Cheers

Hari

 

Hi,

I was wondering if you could help me. I want to only allow people from the U.S. to buy my products. How do I do this? Thanks

Link to comment
Share on other sites

Hari,

 

Thanks for the info. I'm a pretty good embedded sytems programmer (C, assembly, etc), but php is not my forte. I've looked through other contributions and probably can hack something...but this seemed like something that could use a clean contribution, which is something that would take a bit of a learning curve for me. And hard-coding the states/countries make it a case by case basis...

 

Anyway, there's actually been quite a few requests for such a feature... There numerous industries that have shipping restrictions based on locale, so I figured it would be a good contribution. Can't ship encryption algorithms to some countries, can't ship porn to some states!

 

 

Oh well, if push comes to shove, I'll have to bite the bullet & invest a weekend or two to knock this out!

 

-Rod

Link to comment
Share on other sites

Hello,

 

I'm looking for a way to prohibit shipping to particular areas. I've searched exhaustingly through this forum and the contributions. There were some suggestions prevented the shipping module from appearing -- but the approach hard-coded the locale -and- didn't issue a warning (and in some cases still allowed the order). Other approaches, simply won't display the state/country, but would allow them to be entered manually or the order would still be processed (just with no shipping fees).

 

Anyway, the closest thing I found was "Country Based Shipping" -- this (cool) contribution restricts where a particular product can be shipped based on the tax zone. The nice thing about this is that it issues an explanation why the product can't be shipped. The downside, is that it's based on tax-zones, so to include exclude a state or region -- a zone need to be created to include the world, except the prohibited states/regions. Also, it would appear this approach would interfere with normal taxing process, since a product only has one tax class.

 

I've noticed that other people have requested this...so it's not an unusual requirement, especially given the huge range of variants in regulatory restrictions from country/state to country/state. It seems like a module where states/countries can be specified as no ship/order zones would be a great contribution.

 

Any help/suggestions would be greatly appreciated!

Cheers,

 

-Bird

 

I am by no means an expert on this as I've only just started developing in this area but for me the key seems to be ..

 

return $this->quotes;

 

This seems to be the point at which a shipping option is actually offered to the customer and here you can add any exclusions you wish.

 

For example:-

 

I wanted to offer free shipping via the module freeamount but only for specific products.

 

I added two queries to the install

 

	  tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (
			  `configuration_title` ,
			  `configuration_key` ,
			  `configuration_value` ,
			  `configuration_description` ,
			  `configuration_group_id` ,
			  `sort_order` ,
			  `last_modified` ,
			  `date_added` ,
			  `use_function` ,
			  `set_function`
			  )
			  VALUES (
			  'Product Inclusion', 'MODULE_SHIPPING_FREEAMOUNT_PRODSLIST', 'false', 'Products are only offered free shipping if listed', '6', '7', NOW( ) , NOW( ) , NULL , 'tep_cfg_select_option(array(''True'', ''False''),')");
  tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (
			  `configuration_title` ,
			  `configuration_key` ,
			  `configuration_value` ,
			  `configuration_description` ,
			  `configuration_group_id` ,
			  `sort_order` ,
			  `last_modified` ,
			  `date_added` ,
			  `use_function` ,
			  `set_function`
			  )
			  VALUES (
			  'Products array', 'MODULE_SHIPPING_FREEAMOUNT_PRODSARRAY', 'false', 'List of products to have free shipping.', '6', '7', NOW( ) , NOW( ) , NULL , NULL)");

 

So you could add the product exclusions from admin

 

Then in function quote you use the new define to include/exclude in my case ..

 

	  if (MODULE_SHIPPING_FREEAMOUNT_PRODSLIST == 'True') {
		$show_shipping = true;
		$free_ship_products = explode(',', MODULE_SHIPPING_FREEAMOUNT_PRODSARRAY);
		foreach($list_products as $key => $value) {
		if (!in_array($value, $free_ship_products)) {
		  $show_shipping = false;
		}
		}
		if ($show_shipping) $get_total = true;
		else $get_total = false;
	  }

 

So in this example we don't show free shipping to the customer ($show_shipping = false;) unless the product is in the array $free_ship_products. If the product is in the array then we show free shipping to the customer ($show_shipping = true;)

 

In your question bird68 we would exclude/include zones/countries not products.

 

Hope that helps.

Edited by Babygurgles
Link to comment
Share on other sites

  • 6 years later...

This is rather an old post, so I just wondered if any had produced a contribution or an 'easy' solution to this problem?

I'm in the UK, and due to the complications of shipping my products outside of UK/Europe, just simply want to excluded the 'worldwide' option on my postal options.  With an explanation!

 

Kellie

Running a botched up version of  osCommerce Online Merchant v2.3.4 bootstrap with the dresscode theme installed, numerous add-ons, terrible coding, terrible website, but will have to make do until I have made up for my losses and can risk shutting down for a couple of weeks while I start all over again. - I did not install my program but am endeavouring to fix it with your help.

Link to comment
Share on other sites

You do have an option in admin 2.3....   configuration/shipping & packaging

 

"Should orders be allowed to shipping addresses not matching defined shipping module shipping zones?"

 

may be a simple solution you would need to define UK as a zone there are a few addons with the needed counties

 

never tested myself but worth looking at

 

Regards

Joli

To improve is to change; to be perfect is to change often.

 

Link to comment
Share on other sites

@@zefeena There is an addon for this. It is named Active Countries. I haven't checked It lately but I doubt that it has been converted to 2.3 but the changes made should still work. It is not an easy installation though. But it seems to me the easiest way to handle this is to just delete the countries from the database (you can do that in admin). If a customer can't create an account they can't place an order.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Hi, 

 

Thank you.  Deleting countries definitely seems the best way to go.  I'll take a look at the database - not a place I go often - but less scary than messing with the code!

 

Kellie

Running a botched up version of  osCommerce Online Merchant v2.3.4 bootstrap with the dresscode theme installed, numerous add-ons, terrible coding, terrible website, but will have to make do until I have made up for my losses and can risk shutting down for a couple of weeks while I start all over again. - I did not install my program but am endeavouring to fix it with your help.

Link to comment
Share on other sites

You can delete them in admin->Locations/Taxes->Countries. There are also thread here that provide the sql for deleting all countries except for a few. Use google to search for deleting countries on this forum.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

You can delete them in admin->Locations/Taxes->Countries.

 

If I delete the countries from as above, will this only affect only NEW customers?  Will the existing customers still be able to order? 

 

thanks  Kellie

Running a botched up version of  osCommerce Online Merchant v2.3.4 bootstrap with the dresscode theme installed, numerous add-ons, terrible coding, terrible website, but will have to make do until I have made up for my losses and can risk shutting down for a couple of weeks while I start all over again. - I did not install my program but am endeavouring to fix it with your help.

Link to comment
Share on other sites

@@zefeena

 

I use the Royal mail addon and with that you can add as many of the RM modules as you like. RM airmail module allows for either Europe and / or rest of the World. The postage modules can be set up using product weight and as long as you already use a weight based shipping module, they should be easy to set up. I dont think there is a latest price included with the addon, but using the RM postage leaflet they are easy to alter. You can even add a charge for something like the packaging costs.

 

Add on can be found here http://addons.oscommerce.com/info/4473 and go down the list until you find the full package by uksitebuilder  dated 5 Apr 2011 I have this working on 2.3.3 version and have not tried on any layer versions.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

If I delete the countries from as above, will this only affect only NEW customers?  Will the existing customers still be able to order? 

 

thanks  Kellie

It will affect any customer with an account from the country you delete. If you delete all countries except the US, any existing US customers will still work fine. If you do this, go slow. It is easy to click on the wrong country and delete it before you realize it. Since there isn't an undo feature, that could break your shop until it is fixed.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

@@Jack_mcs 

Thank you for the info.  I would like to allow my existing customers to remain, and that doesn't seem viable with these options, so it would mean upsetting a few people!  I'll wander through the contributions and see if there is any way around it!

 

@@14steve14

- yes I use the RM shipping and that works fine.  The problem is if an order is over 2kg it may have to go via courier.  I recently sent an order to Korea (Rep) and it was stopped by customs who want Tariff codes for each item.  There was over 40 different items!  The codes are difficult to figure what goes with what.  E.g - you get in the section for Textiles and there is a different code for embroidery fabric, and for nylon and for cotton, etc.  My fabrics are often mixed fibres, sometimes I don't even know what composition they are so its impossible to know what Tarrif code it is - and i'll be damned if I know why the hell it makes any difference to customs!  In the end I gave up and they returned the package too me.  It seemed that had I done the codes customs would have charged ME for exporting - sod that I pay enough tax for things coming in! 

 

Kellie

Running a botched up version of  osCommerce Online Merchant v2.3.4 bootstrap with the dresscode theme installed, numerous add-ons, terrible coding, terrible website, but will have to make do until I have made up for my losses and can risk shutting down for a couple of weeks while I start all over again. - I did not install my program but am endeavouring to fix it with your help.

Link to comment
Share on other sites

When I first looked into restricting which countries I would ship to, I thought about deleting most of the countries from the database. When I realized how much work that would be, the possibility for mistakes, and the effort needed to re-add countries later, I ended up using the Active Countries add-on:  http://addons.oscommerce.com/info/3607

 

It took a lot of work to adapt it to osC 2334bs, but it is working now. I have it integrated into Create Account as well as the Shopping Cart Checkout. One feature I especially like is that I can restrict not only by country, but also by 'state'. So, if I do not want to ship to any of the Armed Forces regions, Guam, Marshal Islands, etc ... I can restrict that too.

 

I did run into a problem, though. I do have a guest check-out enabled and Paypal Express for the payment method. So, a customer doesn't even have to enter their location ... it all comes back to me from their Paypal account. I did have to contact Paypal and ask that they restrict all purchases to only customers that have confirmed USA addresses.

 

HTH

 

Malcolm

Link to comment
Share on other sites

  • 5 weeks later...

When I first looked into restricting which countries I would ship to, I thought about deleting most of the countries from the database. When I realized how much work that would be, the possibility for mistakes, and the effort needed to re-add countries later, I ended up using the Active Countries add-on:  http://addons.oscommerce.com/info/3607

 

It took a lot of work to adapt it to osC 2334bs, but it is working now. I have it integrated into Create Account as well as the Shopping Cart Checkout. One feature I especially like is that I can restrict not only by country, but also by 'state'. So, if I do not want to ship to any of the Armed Forces regions, Guam, Marshal Islands, etc ... I can restrict that too.

 

I did run into a problem, though. I do have a guest check-out enabled and Paypal Express for the payment method. So, a customer doesn't even have to enter their location ... it all comes back to me from their Paypal account. I did have to contact Paypal and ask that they restrict all purchases to only customers that have confirmed USA addresses.

 

HTH

 

Malcolm

 

 

Its not that bad an amount of work if you go into the DB on the server and edit there since you can delete blocks at a time. Takes about 5 mins

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...