Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

confirm transaction form button


griffinsbridge

Recommended Posts

Hi

 

I need to get the sub-total and send that seperately to another file in the background when the button is clicked.

 

Ive found this in www.domain.com/checkout_confirmation.php :

<?php
 if (MODULE_ORDER_TOTAL_INSTALLED) {
$order_total_modules->process();
echo $order_total_modules->output();
 }
?>

That seems to print the full breakdown of the transaction. By adding

	
### get subtotal
$subtotal = $order_total_modules->output();
$subtotal = strip_tags($subtotal);
$subtotal = explode("£", $subtotal);
$subtotal = explode(" ", $subtotal[1]);
####

 

above the closing }, I can get the sub-total as a variable: $subtotal[0] (cant help thinking theres already a variable set somewhere for this)

 

Ok, you with me so far?

 

The file i need to send this variable to will do some cookie and database stuff, dont worry about what its for, thats not important.

What is important is that i need to call this file by using a javascript function that will be fired in the background OnClick(); with the "confirm order" button.

If i could just find where the hidden form is constructed, I could do it.

Does anyone know where I can find the construction of the form containing the "confirm order" button?

I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours - Stephen Roberts

Link to comment
Share on other sites

What is important is that i need to call this file by using a javascript function that will be fired in the background OnClick(); with the "confirm order" button.

If i could just find where the hidden form is constructed, I could do it.

Does anyone know where I can find the construction of the form containing the "confirm order" button?

 

First off, the form itself is in the checkout_confirmation.php file, do a search for button_confirm and you should find it, as the form is wrapped right around that button image... However, I'm curious why you need for this to be performed via javascript, unless something is going to be computed before the form is submitted, and this also would have the drawback of not working for people with javascript disabled... If all you want to do is store that value for something, it could just be done at the beginning of the checkout_process.php file on the server side, after the confirm button has been clicked... Also, the easier location you're looking for to find that value would be $order->info['subtotal'], after the order_totals module has processed...

 

Richard.

Richard Lindsey

Link to comment
Share on other sites

First off, the form itself is in the checkout_confirmation.php file, do a search for button_confirm and you should find it, as the form is wrapped right around that button image... However, I'm curious why you need for this to be performed via javascript, unless something is going to be computed before the form is submitted, and this also would have the drawback of not working for people with javascript disabled... If all you want to do is store that value for something, it could just be done at the beginning of the checkout_process.php file on the server side, after the confirm button has been clicked... Also, the easier location you're looking for to find that value would be $order->info['subtotal'], after the order_totals module has processed...

 

Richard.

 

 

Ah, I see how its working now!! lol :rolleyes:

Still finding my way around this thing, its in a style ive never seen and although it makes sense eventually, its abit confusing at first.

 

What I need to do is explode a cookie (if it exists) before it goes to the paypal page. This is a secondary cookie for affiliate driven traffic. Then insert a row in a custom DB table logging any aff data an the subtotal. Later on I'll be doing similar on checkout_success.php to update it as a valid transaction

 

Ive had a look at checkout_process.php but im unsure as to when it gets called. Ive done some preliminary tests, but I cant even force it to error. So it appears that its not getting called between checkout_confirmation.php and paypal.com.

 

Unless of course, I could simply grab the subtotal before the output in checkout_success.php and do the entire deed there?

What do you think? >_<

I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours - Stephen Roberts

Link to comment
Share on other sites

Ah, I see how its working now!! lol :rolleyes:

Still finding my way around this thing, its in a style ive never seen and although it makes sense eventually, its abit confusing at first.

 

What I need to do is explode a cookie (if it exists) before it goes to the paypal page. This is a secondary cookie for affiliate driven traffic. Then insert a row in a custom DB table logging any aff data an the subtotal. Later on I'll be doing similar on checkout_success.php to update it as a valid transaction

 

Ive had a look at checkout_process.php but im unsure as to when it gets called. Ive done some preliminary tests, but I cant even force it to error. So it appears that its not getting called between checkout_confirmation.php and paypal.com.

 

Unless of course, I could simply grab the subtotal before the output in checkout_success.php and do the entire deed there?

What do you think? >_<

 

Oh yes, this seems interesting. I've just installed the paypal module on an oscommerce site but it does not quite work It takes you to the paypal site and let you pay for the gods you've bought, but it never "registers" in the paypal system what you have bought and thus the site owner will get the payment, but will not know what is paid for.

 

It seems to me you having similar problem? I suppose the best way to solve this would be to process the order and mark it as "pay by paypal" in the osc database and then the storeowners can send the stuff when they see they have got the money via paypal. The question that remains to solve is now only how this is to be done. Any ideas?

Link to comment
Share on other sites

Oh yes, this seems interesting. I've just installed the paypal module on an oscommerce site but it does not quite work It takes you to the paypal site and let you pay for the gods you've bought, but it never "registers" in the paypal system what you have bought and thus the site owner will get the payment, but will not know what is paid for.

 

It seems to me you having similar problem? I suppose the best way to solve this would be to process the order and mark it as "pay by paypal" in the osc database and then the storeowners can send the stuff when they see they have got the money via paypal. The question that remains to solve is now only how this is to be done. Any ideas?

Hi dalaij

No mate, i think its a different problem.

but, you could always try a reinstall of the paypal module. infact, I would consider downloading it again and doing a completely fresh install of it. Thats the first thing I would do. data can easily corrupt in downloads, so this may sort your problem out. And surely you should get an email from paypal telling what has been purchased and how much was paid> if not, the problem lies with paypal and you should contact them.

I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours - Stephen Roberts

Link to comment
Share on other sites

Hi dalaij

No mate, i think its a different problem.

but, you could always try a reinstall of the paypal module. infact, I would consider downloading it again and doing a completely fresh install of it. Thats the first thing I would do. data can easily corrupt in downloads, so this may sort your problem out. And surely you should get an email from paypal telling what has been purchased and how much was paid> if not, the problem lies with paypal and you should contact them.

 

With regards to your earlier post, yeah the method I'd suggested won't work for Paypal, because if I remember correctly, the order of things when Paypal is used is that the Confirm button actually links to Paypal rather than to checkout_process.php, and once payment is complete at Paypal, there's a button at the end of that process that links back to your checkout_process.php page, at which time the order is actually logged... So, with that in mind, you could still do it the checkout_process.php way, buuuuut the problem with that module has always been that if the user doesn't click the button at the end of payment to return to your site, the order doesn't get completed and logged, and in this case, it wouldn't log any affiliate info for you either... There are some different Paypal modules out there, the one I might suggest would be the Express Checkout module, which ships them off to Paypal before order confirmation, lets them login, and ships them back to your store with an authentication token that's then transmitted between the store and Paypal during order confirmation, and on Paypal's end of things, debits the funds from them... However, on your end of the things, the Confirm button posts back to your checkout_process.php just like it would with any normal payment gateway method... If you don't want to go with a different Paypal module, though, javascript may be a better method for you to use to collect this affiliate data, but you'll still have the problems I mentioned above if the user doesn't report back to your site at the end of payment via Paypal, the order most likely won't get logged and whatnot...

 

Richard.

Richard Lindsey

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...