3

I would like to 'skip' the payment method step on the one page checkout step in Magento.

I am currently using SagePay as my payment method and well, as SagePay is my only method it seems pretty pointless having the Payment Method step on the one page checkout.

How can I do this?

I guess I need to somehow set the SagePay option as the default, hide the payment method form the user and skip straight to the order review step?

4
  • Can we assume your sagepay integration does not require you to enter payment credentials on your store? Commented Nov 24, 2014 at 10:49
  • I am using the server integration so the details you need to enter only appear once you hit the submit button in the order review step. Essentially, I need to not display the Payment Method step and skip over it but setting the default value to be SagePay server. Commented Nov 24, 2014 at 10:54
  • Up to you how you do it of course but for me do you not think the customer will want to know how exactly they are going to be paying for the order before they click the submit button? What if the payment method is not actually an option for them? I know I would find it off putting to not have this information first. Commented Nov 24, 2014 at 10:59
  • I do completely understand, and was one the things that I mentioned to the client when they suggested removing the payment step. They have their mind set on the fact as there is only one option why even bother showing it. They will not budge :( Commented Nov 24, 2014 at 11:06

2 Answers 2

1

One way to achieve this is in the file: app/design/frontend/base/default/template/checkout/onepage/payment/methods.phtml When looping over the selected methods add something like:

<?php if($_code == 'YOUR METHOD'): ?>
     <span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" class="radio" /></span>
    <?php $oneMethod = $_code; ?>
<?php endif; ?>
    <label for="p_method_<?php echo $_code ?>"><?php echo $this->escapeHtml($this->getMethodTitle($_method)) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?></label>

Then add some JS at the bottom:

<script type="text/javascript">
//<![CDATA[
<?php if (is_string($oneMethod)): ?>
payment.switchMethod('<?php echo $oneMethod ?>');
    <?php endif; ?>
//]]>

In reality this is all that default magento template is doing to help the user select only a single option if one is set via the admin. However what I think might be happening in your case is that you have 2 methods available even though one may not be visible as a option. Adding this to the template will select that option by default and move to next step.

0

according to @James_Cowie just use the javascript below instead of his (also the php code he discribed is already in your file, so no need for any change.)

<script type="text/javascript">
//<![CDATA[
<?php if (is_string($oneMethod)): ?>
payment.save();
<?php endif; ?>
//]]>
</script>

You can hide your payment div with this css rule

    #mydiv {
display: none;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.