TESTED FOR .ASP
Confirmed! works for .PHP also.
Sometimes we need to collect additional funds from a customer on an order.
Often we send them an email with a link to the rebranded donations page that we call make-a-payment.
We have to give them a total amount to enter and it would be nice if they could click the link to populate that info.
With the magic of javascript, all things are possible.
This is based on my other tip here with applying a coupon code from the URL querystring. https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=108517
(If you need info on creating the make-a-payment page, https://www.ecommercetemplates.com/help/donations.asp )
Open your static (re branded donations page) in your html editor and at the very bottom of the page, just
before the closing body tag, paste the following
<!-- begin url populate -->
<script type="text/javascript">
function getQueryString() {
var qs = document.location.search,pairs,pair,key,value,el,i,n;
if (qs.length > 0) {
qs = qs.substr(1);
pairs = qs.split(/&/);
for (i = 0, n = pairs.length; i < n; i++) {
pair = pairs[i].split(/=/);
key = pair[0];
value = decodeURIComponent(pair[1].replace(/\+/g, " "));
el = document.getElementById(key);
if (el) {
el.value = value;
}
}
pairs = null;
pair = null;
el = null;
}
}
window.addEventListener('load',getQueryString,false);
if(window.attachEvent){
window.attachEvent('onload',getQueryString);
}
</script>
<!-- end url populate -->
Upload to the server, and that's it - all done.
Except to create the link for your customer
There are three fields and you can populate them all, or just the required amount. It's up to you.
You just need the ID's of the fields and remember if you add several words to the other two (text) fields, separate them with
%20
that is the "space" in URL language.
The three ID's are
amount
fromname
gcmessage
Here are a few example URL's you might use
www.somesite.com/payments.asp?amount=25.00 (will populate the amount field with $25.00)
www.somesite.com/payments.asp?amount=25.00&fromname=John%20Smith (will populate the amount field with $25.00 and the From field with John Smith)
www.somesite.com/payments.asp?amount=25.00&fromname=John%20Smith&gcmessage=Additional%20payment%20on%20order%2012345 (will populate the amount field with $25.00 and the From field with John Smith and the message field with Additional payment on order 12345)
With this feature, you can save any customer error and confusion by populating the field(s) for your customer and tell them - click the link, then click the submit button and proceed through checkout to pay the additional balance due.
We like to make email response templates where we can just fill in the blanks and quickly send the emails.
save this in a notepad file on your desktop.
Something like
*****************************************************************************************
Hello,
firstname lastnameHere is the link to make the additional payment due on your order.
This link will populate the form with the details and you just click the "submit" button to load the shopping cart.
From there just complete the checkout process to pay the additional balance due.
If the link below does not populate with the amount due, you can type the amount in. It's
amountwww.somesite.com/payments.asp?amount=
amount&fromname=
firstname%20
lastname&gcmessage=Additional%20payment%20on%20order%20
orderidThanks,
Acme Company
****************************************************************
With the template above, you can create the email in moments with 4 bits of info. Amount, first name, last name and order ID.
David
ECT Power User