Jump to content

Skip Payment Method Choice?


Guest Cyberious

Recommended Posts

Guest Cyberious

My client just sent me an email from Support about having customers skip the payment method choice, since he is only offering 1 payment method - the email says to use Javascript on a transparent gif :

** QUOTE FROM SUPPORT EMAIL REMOVED **

How do I set this up?

** EDIT REASON - Please do not quote support/sales correspondance in the forums. :)

This email may be confidential, may be legally privileged, and is for the intended recipient only. Unauthorised access, disclosure, copying, distribution, or reliance on any of it by anyone else is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender.
Edited by Cyberious
Link to comment
Share on other sites

I have always been annoyed by having the system make you select the payment choice as well (when there is only 1 option).

IMHO, this is a cube cart bug and should be addressed instead of having people add a hack like this.

Not sure if it will ever be addressed though.

Has anyone found a better solution?

Link to comment
Share on other sites

So you want it set up if only one payment method is selected in admin to skip the payment part and go straight to checkout?

shouldn't be 2 hard will take a look 2day got the day off from work so i'll b cubing all day ;)

Link to comment
Share on other sites

I replied to your client this morning with the solution.

For others change gateway.tpl from:

<tr>

<td class="{TD_CART_CLASS}">{VAL_GATEWAY_DESC}</td>

<td width="50" align="center" class="{TD_CART_CLASS}">

<input name="gateway" type="radio" value="{VAL_GATEWAY_FOLDER}" {VAL_CHECKED} />

</td>

</tr>




To:




<tr>

<td class="{TD_CART_CLASS}">{VAL_GATEWAY_DESC}</td>

<td width="50" align="center" class="{TD_CART_CLASS}">

<input name="gateway" type="radio" value="{VAL_GATEWAY_FOLDER}" {VAL_CHECKED} />

<img src="images/general/px.gif"  alt="" title="" onload="submitDoc('gateway');" />

</td>

</tr>

That will auto submit the form. To work the chosen gateway must be set as the default.

Link to comment
Share on other sites

Guest Cyberious

Well, something isn't right... When you go through the checkout, you get stuck on step5, where it still asks you to select a payment method (there is only 1) - when you click on the radio button, or the 'Continue' button, the page constantly reloads itself over and over again... I hit the 'Stop Loading' button in my browser, and then was able to hit the continue button and place the order...

Do you remember this occuring when you made the change? Was there a fix?

Link to comment
Share on other sites

  • 4 months later...
Guest loren antolik

i wanted to do the same thing and tried this form autosubmit method, but didn't really like it, because the form still showed for a second before it took you to the payment screen. i did this little mod to actually make it skip this step.

1. find out what the form value for your gateway is by doing a view source on the step 5 gateway selection screen. the input name is gateway and the value you are looking for is the value field. mine was Authorize_AIM.

2. edit the includes/content/gateway.inc.php page. first thing is to define a unique variable and give it the value that you found in step 1. for example $uniqueGatewayValue = "Authorize_AIM"; define this right before the conditional statement

if($basket == TRUE && isset($_POST['gateway']) && eregi("[0-9a-z_-]",$_POST['gateway'])) {

3. do a search for $_POST['gateway'] and replace with $uniqueGatewayValue;

4. save gateway.inc.php and upload to your ftp server in the proper directory.

basically, this mod manually sets the value that the form is getting before the form is displayed, and the conditional logic of gateway.inc.php recognizes this and thinks that the form was submitted and will take you to the payment form straightaway.

Link to comment
Share on other sites

  • 1 month later...
Guest igner

i wanted to do the same thing and tried this form autosubmit method, but didn't really like it, because the form still showed for a second before it took you to the payment screen. i did this little mod to actually make it skip this step.

1. find out what the form value for your gateway is by doing a view source on the step 5 gateway selection screen. the input name is gateway and the value you are looking for is the value field. mine was Authorize_AIM.

2. edit the includes/content/gateway.inc.php page. first thing is to define a unique variable and give it the value that you found in step 1. for example $uniqueGatewayValue = "Authorize_AIM"; define this right before the conditional statement

if($basket == TRUE && isset($_POST['gateway']) && eregi("[0-9a-z_-]",$_POST['gateway'])) {

3. do a search for $_POST['gateway'] and replace with $uniqueGatewayValue;

4. save gateway.inc.php and upload to your ftp server in the proper directory.

I haven't looked at the code to sort out what other implications this could have, if any. However, wouldn't it make more sense to just overwrite $_POST['gateway'] before the logic check? The following code checks to see if there's only one Gateway enabled, and if so, attempts to use it:

if ($db->numrows("SELECT folder FROM {$glob['dbprefix']}.CubeCart_Modules WHERE module='gateway' AND status = 1") == 1)

{

	$myGateway = $db->select("SELECT folder FROM ".$glob['dbprefix']."CubeCart_Modules WHERE module='gateway' AND status = 1 AND `default` = 1" );

	$_POST['gateway'] = $myGateway[0]['folder'];

}

Note that this will only automatically load the gateway page IF AND ONLY IF the gateway is also set as default. In other words, it's conceivable that one might want to display the selection page even if there is only one gateway enabled; this code allows you to set up a gateway, and not set it as default, and you'd still get the selection dialog. Seems to me this should address most of the issues (no hardcoding a gateway in the code, can still display the dialog if desired, no issues with javascript refresh pains).

It's still a hack to the source, which means that an update can break it, but if you're looking for a seamless transition, this is it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...