tedmcdonald Posted October 28, 2002 Share Posted October 28, 2002 I really need to get some help on this one. When my customers go to checkout, no payment method is selected. Many of my customers fill out the credit card information, hit continue and are then sent back to the checkout page asking them to select payment type (via radio button). Is there some way to make it so that the Credit Card payment radio button is automatically (by default) selected when they enter the checkout page? Please help if you can. Best Regards, Ted Quote Link to comment Share on other sites More sharing options...
hobbzilla Posted October 28, 2002 Share Posted October 28, 2002 Depending on whether or not CC is the first option or not.. adding this line onload="javascript:document.payment.payment[0].click();return true; to checkout_payment.php in the <BODY> tag should do the trick! :) Quote Link to comment Share on other sites More sharing options...
tedmcdonald Posted October 28, 2002 Author Share Posted October 28, 2002 Howdy Zilla Thank you very much. You have been a big help for me today. At first your code would not work, then I looked and added a " to the end; thus it should be: onload="javascript:document.payment.payment[0].click();return true;" Thanks again Zilla. Best Regards, Ted Quote Link to comment Share on other sites More sharing options...
hobbzilla Posted October 28, 2002 Share Posted October 28, 2002 Ah yes... the elusive quotation mark! Once again tedmcdonald, you have topped me. Quote Link to comment Share on other sites More sharing options...
sefu Posted October 28, 2002 Share Posted October 28, 2002 Cool works perfect! you wouldnt also know how to make the radio button on the delivery options be selected once you select a type of payment. EG If they select COD as a payment I want a particular type of shipment to be selected and not being able to be changed. Hope you understand and I didnt confuse you Quote Link to comment Share on other sites More sharing options...
hobbzilla Posted October 29, 2002 Share Posted October 29, 2002 This will change as soon as the updated checkout procedure is commited to CVS. But javascript allows you to do many things. For example.. if you select payment option A, then shipping options B & C turn greyed out and are "disabled". I can't write out javascript code for every possible combination. Use what I have given here as well as a search on google to try and figure it out. Specifically, you will need a trigger (onLoad, onClick, onChange, etc.) and an action. See http://www.houseofscripts.com/scripts/java...s/disablebm.htm for other examples. Quote Link to comment Share on other sites More sharing options...
sefu Posted October 29, 2002 Share Posted October 29, 2002 Cool thanks :D I'm aware of the new checkout prodecure, do you think it can easily be implemented into ver 2.2 snapshop from April? Quote Link to comment Share on other sites More sharing options...
agadak Posted November 3, 2002 Share Posted November 3, 2002 I tried to add this: onload="java script:document.payment.payment[0].click();return true;" in the body <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" TRIED HERE> and also directly below that and it would not work. I used <script language = "javascript"> onload="java script:document.payment.payment[0].click();return true;" </script> in both areas and it did not want to. Is it because I only have one type of payment? (CC#). I am running 2.2 Quote Link to comment Share on other sites More sharing options...
hobbzilla Posted November 3, 2002 Share Posted November 3, 2002 Not sure about the new checkout procedure.. but on the old one... if you only had one payment option.. there isn't any option! So, not 100% sure what you are trying to do.. The <body ... TRIED HERE> is where that code belongs.. <script> onload="CODE" </script> Is not valid. Quote Link to comment Share on other sites More sharing options...
trpost Posted January 20, 2004 Share Posted January 20, 2004 I added the following to checkout_payment.php, and got it to work: Before: <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> After: <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onload="java script:document.checkout_payment.payment[0].click();return true;"> Quote Link to comment Share on other sites More sharing options...
ModManOSC Posted February 6, 2005 Share Posted February 6, 2005 (edited) I added the following to checkout_payment.php, and got it to work: Before: <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> After: <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onload="java script:document.checkout_payment.payment[0].click();return true;"> <{POST_SNAPBACK}> This is an post for an older version of Osc (and did not work when we tried on 2.2) - does anyone know how to mod the checkout_payment.php to get the credit card radio button auto-selected if a customer starts typing in any of the credit card fields? Even if I could get the first radio button checked by default (which is the credit card choice), that would eliminate some senseless errors presented to customers. Thanks! Derek-Paul Edited February 6, 2005 by ModManOSC Quote My Contributions Welcome Email enhanced - username, password Link to comment Share on other sites More sharing options...
nick Posted April 22, 2005 Share Posted April 22, 2005 If you are using BTS you can do the following: In main_page.tpl.php find <body> and replace with <?php // Added to auto select first payment option - usually credit card if ($PHP_SELF == "/checkout_payment.php"){ echo '<body onload="javascript:document.checkout_payment.payment[0].click();return true;">'; } else { echo '<body>'; } ?> Hope this can help someone. Quote Link to comment Share on other sites More sharing options...
sefu Posted June 24, 2005 Share Posted June 24, 2005 Hi All, I have a number of customers who are entering their cc details into the cc feild but accidentely selecting another form of payment therefore we never receive their CC details. I am wondering if anyone can help me put a piece of javascript which will automatically select the CC payment option when they enter the cc number. I am using MS1 loaded. Please let me know what code you need to see to help if needed Thanks heaps!! Wing Quote Link to comment Share on other sites More sharing options...
AverageJoe Posted June 24, 2005 Share Posted June 24, 2005 http://www.oscommerce.com/forums/index.php?act=ST&f=11&t=26143 Quote Link to comment Share on other sites More sharing options...
sefu Posted June 24, 2005 Share Posted June 24, 2005 This is an post for an older version of Osc (and did not work when we tried on 2.2) - does anyone know how to mod the checkout_payment.php to get the credit card radio button auto-selected if a customer starts typing in any of the credit card fields? Even if I could get the first radio button checked by default (which is the credit card choice), that would eliminate some senseless errors presented to customers. Thanks! Derek-Paul <{POST_SNAPBACK}> Sorry for bringing up a old thread but does anyone know how to make it auto select the credit card if the customer enters details into the cc field. I already have the auto cc select on load but some customers accidentely select other payment options and then decide to enter cc details which results in no cc details being received. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.