0

How can i update payment section if user click (check) radio button of payment. So i want that magento safe the new selected payment method and reload the payment section.

1 Answer 1

0

fire payment.save() on payment method change.

Edit: you can extend (right way) or override your opcheckout.js (in your theme)

Extended Class

var CustomPayment = Class.create(Payment,{
    saveAndStayOnThisStep: function(){
        if (checkout.loadWaiting!=false) return;
        var validator = new Validation(this.form);
        if (this.validate() && validator.validate()) {
            checkout.setLoadWaiting('payment');
            var request = new Ajax.Request(
                this.saveUrl,
                {
                    method:'post',
                    onComplete: this.onComplete,
                    // onSuccess: this.onSaveAndStay,
                    onFailure: checkout.ajaxFailure.bind(checkout),
                    parameters: Form.serialize(this.form)
                }
            );
        }
    },
});

In template use CustomPayment.saveAndStayOnThisStep();

3
  • Can you show me some code? at the moment im not sure were i can set this up and who? Feb 26, 2016 at 11:39
  • I try to set it here. onclick="payment.switchMethod('<?php echo $_code ?>') , payment.save()" That works, but i want to stay at the payment section. If i click now it switch to the next and last step. Feb 26, 2016 at 11:42
  • I update my answer with code example.
    – Bashev
    Feb 26, 2016 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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