Add Payone support | OneStepCheckout Help Center

Add Payone support

LATEST VERSION

  1. open up app/design/frontend/base/default/layout/payone/core.xml and make all the things that are referenced to checkoutonepageindex to onestepcheckoutindexindex. easiest way is to make a copy of checkoutonepageindex and rename the parent tags
<pre>
    <onestepcheckout_index_index>
        <reference name="head">
            ..
        </reference>

        <reference name="head">
            ..
        </reference>

        <reference name="checkout.payment.methods">
            ...
        </reference>
    </onestepcheckout_index_index>
</pre>
  1. next step is to add ajax event listener to checkout.phtml template to spy on ipayment ajax calls in app/design/frontend/base/default/template/onestepcheckout/checkout.phtml by replacing the following (search for !alreadyplacingorder to find the right place)
    /* Submit the form */
    $('onestepcheckout-form').submit();

with

    if(payment.currentMethod == 'payone_creditcard'){
        Ajax.Responders.register({
            onComplete: function(event) {
                if(event.parameters["payment[method]"]=='payone_creditcard'){
                    $('onestepcheckout-form').submit();
                }
            }
        });
        loaderelement.remove();
        submitelement.removeClassName('grey').addClassName('orange');
        submitelement.disabled = false;
        already_placing_order = false;
        payment.save();
        Event.stop(e);
    } else {
        /* Submit the form */
        $('onestepcheckout-form').submit();
    }

OLDER PAYONE VERSIONS

To enable Ipayment cc support in OneStepCheckout you need to :

  1. add ipayment references to onestepcheckoutindexindex in app/design/frontend/base/default/layout/onestepcheckout.xml. You can copy the references from app/design/frontend/base/default/layout/ipayment.xml and add them as follows by replacing (serach for to find the right place):
<reference name="head">
    ....
    <action method="addJs" ifconfig="payment/payone_cc/active"><script>phoenix/payone/processing.js</script></action>
    .....
</reference>
<reference name="content">
    <block type="payone/jsinclude" name="payone_jsinclude" template="payone/jsinclude.phtml"/>
    ....
  1. next step is to add ajax event listener to checkout.phtml template to spy on ipayment ajax calls in app/design/frontend/base/default/template/onestepcheckout/checkout.phtml by replacing the following (search for !alreadyplacingorder to find the right place)
if(!already_placing_order) {

    already_placing_order = true;

    var submitelement = $('onestepcheckout-place-order');

    var loaderelement = new Element('div').
        addClassName('onestepcheckout-place-order-loading').
        update('&lt;img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif'); ?>" />&nbsp;&nbsp;<?php echo $this->__('Please wait, processing your order...'); ?>');

    submitelement.parentNode.appendChild(loaderelement);

    /* Disable button to avoid multiple clicks */
    submitelement.removeClassName('orange').addClassName('grey');
    submitelement.disabled = true;

    /* Submit the form */
    $('onestepcheckout-form').submit();
}

with

if(!already_placing_order) {

    already_placing_order = true;

    var submitelement = $('onestepcheckout-place-order');

    var loaderelement = new Element('div').
        addClassName('onestepcheckout-place-order-loading').
        update('&lt;img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif'); ?>" />&nbsp;&nbsp;<?php echo $this->__('Please wait, processing your order...'); ?>');

    submitelement.parentNode.appendChild(loaderelement);

    /* Disable button to avoid multiple clicks */
    submitelement.removeClassName('orange').addClassName('grey');
    submitelement.disabled = true;

    if(payment.currentMethod == 'payone_cc'){
        Ajax.Responders.register({
            onComplete: function(event) {
                if(event.parameters["payment[method]"]=='payone_cc'){
                    $('onestepcheckout-form').submit();
                }
            }
        });
        loaderelement.remove();
        submitelement.removeClassName('grey').addClassName('orange');
        submitelement.disabled = false;
        already_placing_order = false;
        payment.save();
        Event.stop(e);
    } else {
        /* Submit the form */
        $('onestepcheckout-form').submit();
    }
}