If the user is logged in the newest version of the code now includes user info (Customer ID, Full name, e-mail address, Cart ID).
The customers id is a link to the customers account info in your admin
The email address can be clicked on to instantly write an e-mail to them.
The cart id # is still a link as described before.
If enough interest exists I will consider adding the cart contents to the e-mail but that is a bit more work.
Code:
9/28/2014 10:18:23 AM
9215 | Joe Smith | joesmith@websiteurl.com
45B7866FB2F648FE93020AF0527960CC
Please fill in the Billing Address field First Name.
Please fill in the Billing Address field Last Name.
Please fill in the Billing Address field Address.
Please fill in the Billing Address field City.
Save this as onepageactivity.asp into the root directory via FTP "/v/onepageactivity.asp"
Code:
<%
Option Explicit
Dim subject : subject = "One Page Checkout Activity Report"
Dim email_to : email_to = "abc@website.com"
Dim email_from : email_from = "abc@website.com"
Dim time_offset : time_offset = 3
Dim VSMTPKey : VSMTPKey = "<------------enter your key here-------->"
Dim CartID5 : CartID5 = Request.Cookies("CartID5")
Dim Errortext_formatted
Dim i
Dim c_name : c_name = Server.URLEncode(Request.Form("c_name"))
Dim c_email : c_email = Server.URLEncode(Request.Form("c_email"))
Dim c_id : c_id = Server.URLEncode(Request.Form("c_id"))
Dim User_info_html : User_info_html = ""
If c_id <> "" then
User_info_html = User_info_html & Server.URLEncode("<a href='https://") & Request.ServerVariables("SERVER_NAME") & Server.URLEncode("/admin/AdminDetails_Generic.asp?table=Customers&ID=") & c_id & "'>" & c_id & "</a>" & Server.URLEncode(" | ")
End If
If c_name <> "" then
User_info_html = User_info_html & c_name & Server.URLEncode(" | ")
End If
If c_email <> "" then
User_info_html = User_info_html & Server.URLEncode("<a href='mailto:") & c_email & "'>" & c_email & "</a><br>"
End If
if Request.Form("Errortext").Count > 0 then
For i = 1 To Request.Form("Errortext").Count
Errortext_formatted = Errortext_formatted & Server.URLEncode(Request.Form("Errortext")(i)) & "<BR>"
Next
Dim HTTPRequest1
Set HTTPRequest1 = CreateObject("WinHTTP.WinHTTPRequest.5.1")
HTTPRequest1.Open "POST", "http://" & Request.ServerVariables("LOCAL_ADDR") & "/vsmtp.asp", False
HTTPRequest1.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
HTTPRequest1.SetRequestHeader "Host", Request.ServerVariables("SERVER_NAME")
HTTPRequest1.Send _
"VsmtpKey=" & VSMTPKey &_
"&Subject=" & Server.URLEncode(subject) &_
"&FromEmailAddress=" & email_from &_
"&ToEmailAddress=" & email_to &_
"&Body_HTML=" & Server.URLEncode(dateadd("h", time_offset, now())) & "<br>" & User_info_html &_
Server.URLEncode("<a href='https://") & Request.ServerVariables("SERVER_NAME") &_
Server.URLEncode("/admin/admindetails_generic.asp?table=CartIDLog&ID=") & CartID5 & "'>" & CartID5 & "</a><br>" & "<br>" &_
Errortext_formatted
response.write(HTTPRequest1.ResponseText)
End If
%>
Then place the following in one of your one-page-checkout articles. Like 115 or 116
Code:
<script type="text/javascript">
function send_c_data(c_data_combined) {
jQuery.ajax({
url: '/v/onepageactivity.asp',
type: 'POST',
cache: false,
data: c_data_combined,
success: function (data) {
}
});
}
jQuery(function () {
if ( jQuery('.v65-error-list-text').length ) {
jQuery.ajax({
url: '/api/v1/users/current',
type: 'GET',
cache: false,
dataType: 'json',
success: function (data) {
var data_string = '';
jQuery('.v65-error-list-text ul').find('li').each(function(){
data_string = data_string + 'Errortext=' + encodeURIComponent(jQuery.trim(jQuery(this).text())) + '&';
});
if (data.data.email) {
var data_string_combined = "c_name=" + encodeURIComponent(data.data.firstName + " " + data.data.lastName) + "&c_email=" + encodeURIComponent(data.data.email) + "&c_id=" + data.data.id + "&" + data_string
send_c_data(data_string_combined);
} else {
send_c_data(data_string);
}
},
error: function () {
var data_string = '';
jQuery('.v65-error-list-text ul').find('li').each(function(){
data_string = data_string + 'Errortext=' + encodeURIComponent(jQuery.trim(jQuery(this).text())) + '&';
});
send_c_data(data_string);
}
});
}
});
</script>
Bookmarks