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
 Prepopulate your donation (make a payment) fields
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic   

dbdave
ECT Moderator

USA
7990 Posts

Posted - 09/25/2017 :  21:08:39  
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 lastname
Here 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 amount

www.somesite.com/payments.asp?amount=amount&fromname=firstname%20lastname&gcmessage=Additional%20payment%20on%20order%20orderid

Thanks,
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

Edited by - dbdave on 04/17/2018 06:56:01

sparksm
New Member

82 Posts

Posted - 09/26/2017 :  12:03:17  
Very handy. Thanks for the snippet of code.

chrismlandon
Advanced Member

USA
304 Posts

Posted - 03/26/2018 :  09:33:43  
thanks! very helpful

dbdave
ECT Moderator

USA
7990 Posts

Posted - 03/26/2018 :  10:55:52  
Thanks, we use it all the time here.

V45
Advanced Member

United Kingdom
416 Posts

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

Posted - 03/26/2018 :  15:46:04  
Thanks for this David.

Works perfectly on php

Will -
Bolton, Manchester UK

Graham Slaughter
Ecommerce Template Expert

725 Posts

Posted - 04/17/2018 :  07:40:16  
Oh man, we have needed this for so long! SO helpful

- Graham Slaughter

dbdave
ECT Moderator

USA
7990 Posts

Posted - 04/17/2018 :  07:58:29  
If there is interest, I can write some code that would be a basic html page where you can enter the info, click a button and the url is created for you.

Graham Slaughter
Ecommerce Template Expert

725 Posts

Posted - 04/17/2018 :  08:13:37  
Thanks for the offer. I'm guessing we would usually just use this in conjunction with a previously placed order. I'm asking my customer service guys for input to be sure, but we'll likely just create a button on the order page that would create an email with the link already there for them. I imagine both methods would be uniquely useful and valuable.

- Graham Slaughter

dbdave
ECT Moderator

USA
7990 Posts

Posted - 04/17/2018 :  15:59:53  
Hi Graham, We are already doing this in our admin. And we get the customer name and order ID right off the order.
We just have an input box to insert an amount, then click our button to create the URL.
We then fire that off in an email.

To take it a step further, we actually added some javascript that fires when they come from a URL and it activates the submit button to take the customer on to the cart.
Then, we use some javascript and css to hide the shipping options during checkout,
It creates a very simple and professional process for the customer.

If you have quite a few orders that customers owe you extra money, it's a beautiful thing to have them making the payment themselves rather than us jumping through multiple hoops to bill additional fees.

Edited by - dbdave on 04/17/2018 16:00:51
   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.02 seconds. Snitz Forums 2000