Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Prevent shipping to PO Box (how to) Rate Topic   - - - - -

 
  • trevorgehman
  • Junior Member
  • Members
  • Join Date: 25-Feb 10
  • 17 posts

Posted 28 June 2010 - 07:17 PM #1

Figured I'd start sharing how I'm doing the custom modifications I'm making to CS-Cart....

I'm working with CS-Cart version 2.0.15

Edit the /js/core.js file and add this at line 1483:

// Billing address first line
			if(elm.attr("name") == "user_data[b_address]") {
				if (lbl.hasClass('cm-required') || jQuery.is.blank(elm.val()) == false) {
					if($('#sa').css('display') !== "block") {
						if(elm.val().indexOf( 'po box' ) !== -1 || elm.val().indexOf( 'PO Box' ) !== -1 || elm.val().indexOf( 'P.O. Box' ) !== -1 || elm.val().indexOf( 'p.o. box' ) !== -1 || elm.val().indexOf( 'po Box' ) !== -1 || elm.val().indexOf( 'p.o. Box' ) !== -1 || elm.val().indexOf( 'p.o Box' ) !== -1 || elm.val().indexOf( 'p.o box' ) !== -1 || elm.val().indexOf( 'P.O Box' ) !== -1|| elm.val().indexOf( 'P.O box' ) !== -1) {
								this.form_message("Cannot ship to a PO Box", lbl);
								is_ok = false;
								set_mark = true;
						}
					}
				}
			}
			
		
		// Shipping address first line
				if(elm.attr("name") == "user_data[s_address]") {
					if (lbl.hasClass('cm-required') || jQuery.is.blank(elm.val()) == false) {
						if(elm.val().indexOf( 'po box' ) !== -1 || elm.val().indexOf( 'PO Box' ) !== -1 || elm.val().indexOf( 'P.O. Box' ) !== -1 || elm.val().indexOf( 'p.o. box' ) !== -1 || elm.val().indexOf( 'po Box' ) !== -1 || elm.val().indexOf( 'p.o. Box' ) !== -1 || elm.val().indexOf( 'p.o Box' ) !== -1 || elm.val().indexOf( 'p.o box' ) !== -1 || elm.val().indexOf( 'P.O Box' ) !== -1 || elm.val().indexOf( 'P.O box' ) !== -1) {
								this.form_message("Cannot ship to a PO Box", lbl);
								is_ok = false;
								set_mark = true;
						}
					}	
				}

This is for one page checkout. What this does is prevent the user from inserting anything containing "po box" or several variations into the shipping address fields. If they elect to ship to billing address, they cannot put a po box as their billing address either.

 

Posted 06 July 2010 - 12:54 AM #2

Never thought about this - will try it out. Thanks!
Web development in progress with CS-Cart 3.x

 
  • DawnG
  • Senior Member
  • Members
  • Join Date: 02-Jun 09
  • 330 posts

Posted 07 July 2010 - 04:21 PM #3

Does this appear to be working for everyone ? This is something we could really use for those persons who don't quite understand English :rolleyes:

 
  • grabbags
  • Senior Member
  • Members
  • Join Date: 14-Aug 07
  • 360 posts

Posted 07 July 2010 - 10:12 PM #4

i need this feature long long time ago. will check it out. thanks for sharing.

 
  • trevorgehman
  • Junior Member
  • Members
  • Join Date: 25-Feb 10
  • 17 posts

Posted 09 July 2010 - 09:22 PM #5

I implemented this one a store I recently designed, so you can see it in action here: http://www.theactigraph.com/store/

 

Posted 10 July 2010 - 11:32 PM #6

I implemented this one a store I recently designed, so you can see it in action here: http://www.theactigraph.com/store/


Just FYI "News & Events" goes to a blank page. Otherwise a really nice Web site!
Web development in progress with CS-Cart 3.x

 
  • Jakubsnm
  • Member
  • Members
  • Join Date: 02-Jul 07
  • 73 posts

Posted 23 October 2012 - 03:51 AM #7

Anyone know how to do this for version 3.0.1?

 
  • tmccaff
  • Member
  • Trial users
  • Join Date: 28-Jan 15
  • 25 posts

Posted 11 August 2019 - 04:40 PM #8

Anyone know how to do this with recent version?