Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
 All Forums
 Technical
 Tips and Tricks - HALL OF FAME
 Address verification - smarty streets code
Next Page
Author    Topic »
Page: of 2

dbdave
ECT Moderator

USA
10405 Posts

Posted - 06/18/2018 :  21:58:02  
Address issues can be a real problem. If you have a busy store, you know about address correction fees, returned (undeliverable) shipments and other problems.
For a while, we have been using the admin address popup to copy addresses and run them through Melissa data's online lookup tool
But they have a limit on free lookups, and sometimes we exceed that.
https://www.melissadata.com/lookups/AddressCheck.asp

I began thinking how nice it would be to have the address validated as the customer enters it at the website.
Suggesting the correct address. Melissa data has an API for that.
I searched for other companies offering this type of service.
I found https://www.addressy.com/ (just changed their name https://www.loqate.com/en-us/address-verification/ ) and discovered they have an easy to install web based plugin and I tested it and had it running on my dev site in short order.
Then I looked at pricing - Melissa is very high, and the addressy seemed a bit high, but lower than Melissa.

I looked around some more - then I found - https://smartystreets.com/
They also have a web app and I was able to get it running on the site without much trouble.
Although, I did have problems with the country not being selected, and the ect "expanding" option for the separate shipping field caused problems.
With some clever javascript and .asp, I was able to work it out.
You can see how it works here - https://smartystreets.com/products/single-address (scroll down and start typing an address that you know is valid - then once you select a valid address, scroll down and look at the additional metadata )
Pricing is less than the others - https://smartystreets.com/pricing

Tonight, I went live with it on my ect site.
We have it active on the cart and client page where customers add addresses too.
It's quite robust as it will actually alert the user if they have left off a suite or apartment number.
It's also great for mobile users who will benefit from the fields populating themselves.
Using .css I was able to add some custom flavoring to match our site.

I am working with the API next.
I have connected to it and my plan is to use it in the admin. We will have a button to check the address, but more importantly return quite a bit of specifics regarding the address.
We will know if it's commercial or residential, we will see if it's been vacant in the last 90 days.
We could even use the longitude and latitude to return a google map if we wanted to get fancy. (Melissa data shows a map on lookup).
These are good fraud tools and all of this will ensure addresses are up to standard.

If there is interest, I will post up my experience once some customers are using it, and details of my integration.




Edited by - dbdave on 12/08/2018 15:33:09

dbdave
ECT Moderator

USA
10405 Posts

Posted - 06/18/2018 :  22:10:56  
Ok, while I was typing this - we had our first order come in and we can see the zip+4, so we know it was validated by the customer -

Here is the page with the web integration if anyone wants to take a peek
https://smartystreets.com/docs/plugins/website/install

dbdave
ECT Moderator

USA
10405 Posts

Posted - 11/20/2018 :  19:54:31  
EDIT - REVISED 12/8/2018 - Fixed issue to allow for stores with alternate ship to address to be verified.
Instructions have been totally revised below to work with checkout regardless if you use allow a secondary ship to address for customers.

I was asked for help implementing smartystreets on a .php site, I previously worked this out for .asp and the install is just about the same for both versions.
Details below.
There are a number of settings on your store that may impact how this operates, so keep that in mind and if you need help, ask questions in this thread and I will see if I can help.

For some time now, we have been using smartystreets on my busy ect store. It has been a powerful tool for getting valid addresses from customers.
This helps cut down on shipping errors and address correction fees from UPS and fedex.
This will also help mobile users populate the address fields faster.

NOTE - Some browsers will try to populate the address and there does not seem to be much we can do to force the smartystreet usage from the customers, but I can tell you more than 90% of our orders come through with validated addresses.

This is implemented in your cart.php or cart.asp pages and that means it will not get overwritten by updates to your ect store.

smarty streets - https://smartystreets.com/
here is a page with details of how it works. They have a ton of code examples and great info on customizations.
https://smartystreets.com/products/plugins/jquery

You can start with the website plugin - 250 lookups for free every month to test with. If you have a busy store, you may need a paid package. (I have 60,000 lookups a year plan)

documentation and link to setup a free testing account
https://smartystreets.com/docs/plugins/website

===STEP ONE===
The first thing you need is open your cart.php or cart.asp page in your html editor and see if you already have the jquery plugin.
Use "find" to search the page code for the word jquery.
If you do not have it, add this to the <head> section of the page
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

===STEP TWO===
Below, in the content area of the page, after the cart include line ( <?php include "vsadmin/inc/inccart.php" ?> or <!--#include file="vsadmin/inc/inccart.asp"--> )
add the following...

.ASP VERSION
<% if SESSION("country")="" then SESSION("country")="United States of America" %>

.PHP VERSION
<?php if (!isset($_SESSION['country'])) { $_SESSION['country']='United States of America'; } ?>

NOTE - you may need to change United States of America to USA depending on how its listed in your drop down

===STEP THREE===
The last step is the javascript to make it work. For your convenience, it's the same for both .asp and .php versions.
Add this below the code you added in step two
NOTE - Be sure to insert your key in place of YOUR_WEBSITE_KEY_HERE

<script src="//d79i1fxsrar4t.cloudfront.net/jquery.liveaddress/5.1/jquery.liveaddress.min.js"></script>
<script>
window.onload = onPageLoad();
$("#shipdiff").click(function() {
verifychange(this)
});
function onPageLoad() {
if($("#shipdiff").prop('checked') == false)
verifychange('#shipdiff');
}
function verifychange(obj) {
if($(obj).is(":checked")){
document.getElementById("scountry").value = 1;
checkoutspan('s');
var ss = jQuery.LiveAddress({
key: 'YOUR_WEBSITE_KEY_HERE',
verifySecondary: true,
debug: false,
autocomplete: 7,
submitVerify: false,
target: "US",
addresses: [{
address1: "#address",
address2: "#address2",
locality: "#city",
administrative_area: "#state",
postal_code: "#zip",
country: "#country"
}, {
address1: "#saddress",
address2: "#saddress2",
locality: "#scity",
administrative_area: "#sstate",
postal_code: "#szip"
}]
});
}else{
var ss = jQuery.LiveAddress({
key: 'YOUR_WEBSITE_KEY_HERE',
verifySecondary: true,
debug: false,
autocomplete: 7,
submitVerify: false,
target: "US",
addresses: [{
address1: "#address",
address2: "#address2",
locality: "#city",
administrative_area: "#state",
postal_code: "#zip",
country: "#country"
}]
});
} }
</script>

There is a list of options here - https://smartystreets.com/docs/plugins/website/configure
for example, I have autocomplete set to 7 there and verify secondary is set to true so if a suite number is missing, the customer will be prompted for it.
Those options should be listed with a comma there.

To get your key, register and create a website key here - https://smartystreets.com/account#keys
Upload the page and it should be working on your cart page.
You can see a demo on my php test site here by adding that item to cart and proceed to checkout step 2 (address entry).
http://www.floridasurpluswarehouse.com/dev/proddetail.php?prod=scanner001

Enjoy,
David

Edited by - dbdave on 12/08/2018 15:36:36

ardade
Advanced Member

257 Posts

Pre-sales questions only
(More Details...)

Posted - 11/21/2018 :  08:29:41  
Thanks! I got it to work. One thing is to remember to make sure you register your web site correctly. I had to add another web registration with the www. becuase my site forces it to go to the www. NOW, how do I use smartystreet for the customer that use the "Id Like this shipped to a different address" ?

dbdave
ECT Moderator

USA
10405 Posts

Posted - 11/21/2018 :  10:37:27  
quote:
NOW, how do I use smartystreet for the customer that use the "Id Like this shipped to a different address" ?


EDIT - The steps in my post above have been edited to fix this.

David

Edited by - dbdave on 12/08/2018 15:32:22

ardade
Advanced Member

257 Posts

Pre-sales questions only
(More Details...)

Posted - 11/21/2018 :  10:58:24  
OK Thanks. Yes I will eed to do it for the address management also.

dbdave
ECT Moderator

USA
10405 Posts

Posted - 12/08/2018 :  15:59:07  
For those that want this on the client login page where users can add an address, here are the instructions.

===STEP ONE===
The first thing you need is open your clientlogin.php or clientlogin.asp page in your html editor and see if you already have the jquery plugin.
Use "find" to search the page code for the word jquery.
If you do not have it, add this to the <head> section of the page
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

===STEP TWO===
Below, in the content area of the page, after the clientlogin include line ( <?php include "vsadmin/inc/incclientlogin.php" ?> or <!--#include file="vsadmin/inc/incclientlogin.asp"--> )
add the following...

.ASP VERSION
<% if SESSION("country")="" then SESSION("country")="United States of America" %>

.PHP VERSION
<?php if (!isset($_SESSION['country'])) { $_SESSION['country']='United States of America'; } ?>

NOTE - you may need to change United States of America to USA depending on how its listed in your drop down

===STEP THREE===
The last step is the javascript to make it work. For your convenience, it's the same for both .asp and .php versions.
Add this below the code you added in step two
NOTE - Be sure to insert your key in place of YOUR_WEBSITE_KEY_HERE

<script src="//d79i1fxsrar4t.cloudfront.net/jquery.liveaddress/5.1/jquery.liveaddress.min.js"></script>
<script>
var ss = jQuery.LiveAddress({
key: 'YOUR_WEBSITE_KEY_HERE',
verifySecondary: true,
debug: false,
submitVerify: false,
target: "US",
addresses: [{
address1: "#address",
address2: "#address2",
locality: "#city",
administrative_area: "#state",
postal_code: "#zip",
country: "#country"
}]
});
</script>

You can see a demo on my php test site here by creating an account and attempt to add a new address under "address management".
http://www.floridasurpluswarehouse.com/dev/clientlogin.php

Enjoy,
David

midvalleydrifter001
Ecommerce Template Expert

USA
931 Posts

Posted - 12/20/2019 :  20:34:07  
Hi David,

Updated to PHP ECT v7.1.7 and the Smarty Streets feature is not working on the "Ship to an alternate address" section.

It worked before prior to the update.

It still works fine in the billing section. Just not in the Alternate Ship to Address section.

* NOTE: I also noticed it's not working on clientlogin.php either.

Patrick

Edited by - midvalleydrifter001 on 12/20/2019 20:43:08

dbdave
ECT Moderator

USA
10405 Posts

Posted - 12/21/2019 :  06:44:14  
Hi Patrick, I haven't updated, but this weekend, I will load that up on my dev site and see what's happening.
You might check the console (F12 on your keyboard > console) to see if any errors are reported there.

Thanks,
David

midvalleydrifter001
Ecommerce Template Expert

USA
931 Posts

Posted - 12/21/2019 :  10:17:18  
No errors regarding this reported.

The only Errors are the "SameSite=None" and "Secure" attribute that everyone else is experiencing.

dbdave
ECT Moderator

USA
10405 Posts

Posted - 12/31/2019 :  14:26:39  
:::FIX FOR VERSIONS 7.1.7+:::
Hi Patrick, sorry for the delay in getting back to you on this.
Fix for Versions 7.1.7 and newer...
I see smartystreets is no longer supporting this type of integration, but it does still work.
In the future, we will need to look at implementing their API for this.
For now, here is the fix.

In your cart.asp/php file, change the following 12 lines from
<script src="//d79i1fxsrar4t.cloudfront.net/jquery.liveaddress/5.1/jquery.liveaddress.min.js"></script>
<script>
window.onload = onPageLoad();
$("#shipdiff").click(function() {
verifychange(this)
});
function onPageLoad() {
if($("#shipdiff").prop('checked') == false)
verifychange('#shipdiff');
}
function verifychange(obj) {
if($(obj).is(":checked")){

to
<script src="//d79i1fxsrar4t.cloudfront.net/jquery.liveaddress/5.1/jquery.liveaddress.min.js"></script>
<script>
window.onload = onPageLoad();
$("input.shipdiff").click(function() {
verifychange($("#shipdiff").val());
});
function onPageLoad() {
verifychange($("#shipdiff").val());
}
function verifychange(obj) {
if (obj==1){


That should get it going again. Basically we needed to test for a button click instead of a tick box click, due to changes in the latest ect update.
FYI - I didn't have any problems on my .asp dev site with the client login address verification. Check your install and let me know if it's still not working.
I don't recall if you use the .php version and if so, maybe there are changes in that version that are not in the .asp version.

Edited by - dbdave on 01/07/2020 19:23:28

midvalleydrifter001
Ecommerce Template Expert

USA
931 Posts

Posted - 12/31/2019 :  17:22:59  
It works but it forces the "Ship to an Alternate address" to be open along with the billing address.

I'm on PHP.

Might be a little confusing for some customers.

Patrick

Edited by - midvalleydrifter001 on 12/31/2019 17:25:14

dbdave
ECT Moderator

USA
10405 Posts

Posted - 01/01/2020 :  08:14:36  
Hi Patrick, sorry. I will need to get a copy of the latest php version from Vince for my .php test site.
I believe he is away for a few days, so you might want to put that back for now if that's an issue for you.

Thanks,
David

midvalleydrifter001
Ecommerce Template Expert

USA
931 Posts

Posted - 01/01/2020 :  09:50:17  
Ok... No worries

Patrick

midvalleydrifter001
Ecommerce Template Expert

USA
931 Posts

Posted - 01/06/2020 :  19:37:45  
Just following up on this.

No hurry. Just checking.

Patrick

dbdave
ECT Moderator

USA
10405 Posts

Posted - 01/07/2020 :  11:50:33  
Hi Patrick, sorry about the delay.
I did get the php copy, so I will try to get this sorted this evening.

dbdave
ECT Moderator

USA
10405 Posts

Posted - 01/07/2020 :  19:26:25  
Hi Patrick, I have this sorted now.
I had an extra line there not needed.
I edited my post above and that is now tested to work in both .asp and .php versions.

The original 12 lines there are now replaced with the 11 lines below it.

Let me know if you have issues.

Thanks,
David

midvalleydrifter001
Ecommerce Template Expert

USA
931 Posts

Posted - 01/07/2020 :  19:38:04  
Hi David,

It works PERFECTLY !!

Thanks so much.

This feature has saved me TONS of time not having to correct addresses and look them up.

Some browsers with anti tracking options setup will not let this feature work but that doesn't happen very often.

Patrick

dbdave
ECT Moderator

USA
10405 Posts

Posted - 01/07/2020 :  19:47:07  
Thanks Patrick.
Same here with us. Address problems can be a nightmare, and expensive.
Have the customer sort this out from the beginning is a huge win.
Like you, we save a good bit of manpower (and $$) using this.

In the near future, I will work on the api integration. I have mentioned it to Vince as well, so maybe he will pick it up and run with it.

Thanks,
David

papawj
New Member

USA
61 Posts

Posted - 01/14/2020 :  07:56:19  
On the ASP 7.1.7 version of the store, I have implemented Smarty Streets using the code provided here (many thanks for that ) and it works fine in windows but it doesn't function on an IOS device using chrome, safari or firefox. Has anyone else run into this and is there some way to make this work on IOS?

dbdave
ECT Moderator

USA
10405 Posts

Posted - 01/14/2020 :  08:45:30  
Hi papawj, are you using the fix I posted for 7.1.7+ versions?
I don't think anything about this is operating system specific, so it's odd they issue you are having.
I have plenty of customers at my site using IOS to checkout and we are getting orders with the +4 zip, so I expect it's working.

I'll see if I can locate someone with a device I can test my site with and post back what I find.

If you want to post a link to your site, or message me that (click my username), I can take a look at your site to see if I see anything out of place.

David
Page: of 2    Topic »  
Next Page
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000