Forum Moderators: open
when a customer goes to the checkout page they are shown a rundown of all the necessaries eg(price,shipping,etc) then the click a javascript link saying "pay by Credit Card" which takes them to a secure bank's payment page.
The problem that i have is that i want to pass a few variables thru like price for example and also if possible the customers email address and an invoice number.
How do i attach the JS code to php (i hope i am asking the question so you can all understand it here) so that when the link is clicked the values go thru. I have all the javascript at the top so i know what to call the variables i.e.
sClientID + '&description=' + sDescription + etc. but how do i attach that to the price when the price is being dynamically generated?
This is the Javascript below:
<script language="javascript"><!--
function gotopay(sDescription, sEmail, sUniqueID, iAmount) {
// New Window options
sResize = 'yes';
sToolbar = 'no';
sScrollbars='yes';
iWidth = 680;
iHeight = 560;
sSite = 'https://banksite';
sClientID = 'clientid=123;
sURL = sSite + '?' + sClientID + '&description=' + sDescription + '&invoice=' + sUniqueID + '&amount=' +
iAmount + '&email=' + sEmail + '&t=1';
//alert(sURL);
window.open(sURL,'','resizable=' + sResize + ',toolbar=' + sToolbar + ',scrollbars=' + sScrollbars + ',width='
+ iWidth +',height=' + iHeight);
}//--></script>
And then this is where i believe the order total is being generated
<?php
if (MODULE_ORDER_TOTAL_INSTALLED) {
$order_total_modules->process();
echo $order_total_modules->output();
}
?> So how do say to the pop-up that that is the price?
and what do i put next to the pop-up?
<a href="javascript:gotopay()"><img src="popup/bank.gif"></a> Any help would be much appreciated as this is causing some discomfort to my sleeping habits at the moment!
Thanks in advance and i look forwar to your most generous help.
Thankyou
Enrico
What you might do is substitue the link by a submit button within a form, generate the input-values (type = hidden) by a javascript writeLn and send the whole form to a php site, which then generates your second window.
The other would be to generate the link itself by writeLN and transform the values as a?-query-string.
But before that I would rather more lean back and think whether you really have to invent the wheel again. There are a number of stable shop systems in either javascript or php available on the net.
Hope this helps a bit
Oliver