Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Preventing customers from pressing several times


Zuncan

Recommended Posts

Hi,

 

Im looking for a way to prevent customers from pressing several times on checkout_cnfirmation_button. This is a problem since if you press that button rapidly several times it will register several orders from that customer at once.

 

I have written in checkout_confirmation.php that the customer must only press once (in red text), but as you might already know - SOME PEOPLE JUST DON'T READ.

 

So does anyone have a clue how to make it impossible for the customer to press that button several times?

 

Best Regards / Zuncan

So what?! Who care in a hundred years anyway?

Link to comment
Share on other sites

Im been searching and searching, waiting and waiting, but still no fix for this "bug". So pls Im asking again. Does anyone know a fix fo this problem?

 

well, I am not sure if it is a remedy for this but on most buttons that trigger actions which may take a while I replace the button with a "please wait..." image when pressed.

 

Not sure if psychotically rapid clicking is prevented by this though.

Treasurer MFC

Link to comment
Share on other sites

Thanks Amanda,

 

That is always something. I use a red text that tells the customer to only press once, but that does not seem to help.. Maybe if I also change the button as your advice would minimize the problem.

 

Could you please post the code that you are using to switch button after pressed?

 

Best regards / Zuncan

So what?! Who care in a hundred years anyway?

Link to comment
Share on other sites

Thanks Amanda,

 

That is always something. I use a red text that tells the customer to only press once, but that does not seem to help.. Maybe if I also change the button as your advice would minimize the problem.

 

Could you please post the code that you are using to switch button after pressed?

 

Best regards / Zuncan

 

 

This simple java script disables the checkout button after it has been clicked the first time which prevents customers creating multiple orders and charges which need to be refunded.

 

1. In the Shop\checkout_confirmation.php file locate the following code:

 

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

Imediately after this code add the following java script.

 

<script language="JavaScript">

<!--

var _submitted = false;

 

validate = function () {

_submitted = ( ! _submitted ) ? true : true ;

if ( _submitted ) document.getElementById( "checkout_confirmation" ).submit() ;

}

-->

</script>

 

 

 

2. Locate the following code:

 

echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n";

 

and replace with:

 

echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER, ' onClick="validate();" ') . '</form>' . "\n";

 

It I have tested this thoroughly on my site without any problems but please ensure you create and order and test.

 

I didn't write this so don't know who to give credit to.

Link to comment
Share on other sites

I remember a few weeks back someone posted a fix called "Prevent Multiple Clicks on Checkout Confirmation". I haven't tried it myself. Maybe you can give a try if you haven't?

 

Ken

 

Im looking for a way to prevent customers from pressing several times on checkout_cnfirmation_button.

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

Thanks Amanda,

 

That is always something. I use a red text that tells the customer to only press once, but that does not seem to help.. Maybe if I also change the button as your advice would minimize the problem.

 

Could you please post the code that you are using to switch button after pressed?

 

Best regards / Zuncan

 

well, I added these two js functions:

 

function visOn(index) {

var d = document.getElementById(index);

d.className='showMe';

}

function visOff(index) {

var d = document.getElementById(index);

d.className='hideMe';

}

 

in css I have the two classes:

div.hideMe {display: none; }

div.showMe {display: block;}

 

and for the buttons you use div's like :

 

echo '<div class="hideMe" id="ca"><img src="images/please_wait_'.$language.'.png"></div><div class="showMe" id="co">' . tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER, ' onClick="visOn(\'ca\');visOff(\'co\');" ') . '</div>';

Treasurer MFC

Link to comment
Share on other sites

well, I added these two js functions:

 

function visOn(index) {

var d = document.getElementById(index);

d.className='showMe';

}

function visOff(index) {

var d = document.getElementById(index);

d.className='hideMe';

}

Where are these functions go to, which page?

 

Thanks

Link to comment
Share on other sites

Where are these functions go to, which page?

 

Thanks

 

come on guys,

these are javascript functions so you either add them as is to the standard javascript file you include in your pages like :

 

<script language="JavaScript1.2" type="text/javascript" src="includes/js/general.js"></script>

 

in that file you would have all general javascript functions like popup etc.

 

or you add them between your <head></head> tags embedded in <script></script> like:

 

<script>

function visOn(index) {

var d = document.getElementById(index);

d.className='showMe';

}

function visOff(index) {

var d = document.getElementById(index);

d.className='hideMe';

}

</script>

Treasurer MFC

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...