Skip to content

Instantly share code, notes, and snippets.

@honewatson
Last active August 29, 2015 13:57
Show Gist options
  • Save honewatson/9402930 to your computer and use it in GitHub Desktop.
Save honewatson/9402930 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
// Extend original Billing class and overwrite newAddress method
var BillingCustom = new Class.create(Billing, {
//$super represents the original function
newAddress: function($super, isNew) {
$super(isNew); // call original function. You don't have to call the original function you may or may not want to. You might just copy the original function and adapt it.
// Do something else here after calling the original function
}
});
//Replace new Billing() with new BillingCustom()
//var billing = new Billing();
var billing = new BillingCustom();
//Extend payment class and overwrite beforeValidate function
var PaymentCustom = new Class.create(Payment, {
beforeValidate : function($super) {
var original_result = $super();
//do something else to original_result
return original_result;
}
});
var payment = new PaymentCustom('checkout-payment-method-load', '<?php echo $this->getUrl('checkout/onepage/savePayment') ?>');
payment.currentMethod = "<?php echo $this->getQuote()->getPayment()->getMethod() ?>";
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment