Prohibiting Post Office boxes from validating |
Post Reply |
Author | ||
hotshotsecret
Newbie Joined: 10-January-2013 Status: Offline Points: 0 |
Post Options
Thanks(0)
Posted: 10-January-2013 at 4:03pm |
|
Due to restrictions with our FedEx shipping manager in Quickbooks, we would like to force an actual street address in the 'ship to' section of the cart.
Here is what I have so far with the code (found in opc_updshipaddr.asp): if pcShippingAddress="PO Box" then pcErrMsg=pcErrMsg & "<li>Street Address is not valid</li>" end if Hopefully I'm on the right track & not over-thinking it... Thanks!
|
||
Guests
Guest |
Post Options
Thanks(0)
|
|
Hi @hotshotsecret,
I think you'd want this argument instead:
|
||
hotshotsecret
Newbie Joined: 10-January-2013 Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
So I'm adding the following to line 75 or thereabouts, and it's not working yet. Continues to load shipping rates:
if InStr(LCase(pcShippingAddress),"po box") > 0 OR InStr(LCase(pcShippingAddress),"pobox") > 0 then pcErrMsg=pcErrMsg & "<li>Street Address is not valid</li>" end if Thanks for the quick response!
|
||
Guests
Guest |
Post Options
Thanks(0)
|
|
Ok, I had a quick look under the hood here, and this is what I see:
First of all, you have the name of the variable slightly incorrect here. But handling it here is not the best place as this catches the "error" after the silent post back and then I find that all of the fields the user filled out on shipping info get lost and have to be re-entered. Not particularly elegant. However, if handling it here, this is what you'd want. Find:
Right below that, add:
It would be better to handle it on onepagecheckoutJS.asp, though. However, that's more complicated and would take me some head-scratching time to sort out.
|
||
Greg Dinger
Certified ProductCart Developers Joined: 23-September-2006 Location: United States Status: Offline Points: 238 |
Post Options
Thanks(0)
|
|
We actually implemented something to address this, but in the end, and with all respect to Sean's helpful post, it was a bit more complex than he proposes. I'm not in a position to go grab the code and paste it here, as it actually involved 2 hours of coding.
What I recall we discovered was that even though something like the above approach seemed desirable, there is logic in OPC that defeated us in that regard. I beleive that what happened was that we'd get the desired error message, but then the checkout process would blast past our error and head off to the shipping options portion of OPC.
We ended up establishing a block of code in opc_chooseShpmnt.asp that tests pcCustSession_ShippingAddress from the pcCustomerSessions table, and thus addresses the issue.
If you find that the above approach is not successful, tap on me (via my site) next week and we can help sort this out for you.
|
||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |