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


 All Forums
 Technical
 Tips and Tricks - HALL OF FAME
 Address verification - smarty streets code
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic   

dbdave
ECT Moderator

USA
7990 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
7990 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
7990 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

244 Posts

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
7990 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

244 Posts

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
7990 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
   Topic   
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2019 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000