Created
January 10, 2013 16:09
-
-
Save ceckoslab/4503260 to your computer and use it in GitHub Desktop.
Workaround to unbind the event listeners for the agreement checkboxes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
//<![CDATA[ | |
// submit buttons are not needed when submitting with ajax | |
$('review_submit').hide(); | |
if ($('update_shipping_method_submit')) { | |
$('update_shipping_method_submit').hide(); | |
} | |
<?php if ($this->getUseAjax()):?> | |
OrderReviewController.prototype._submitOrder = function() { | |
if (this._canSubmitOrder) { | |
if (this._pleaseWait) { | |
this._pleaseWait.show(); | |
} | |
new Ajax.Request(this.form.action, { | |
parameters: {isAjax: 1, method: 'POST'}, | |
onSuccess: function(transport) { | |
try{ | |
response = eval('(' + transport.responseText + ')'); | |
} catch (e) { | |
response = {}; | |
} | |
if (response.redirect) { | |
setLocation(response.redirect); | |
return; | |
} | |
if (response.success) { | |
setLocation('<?php echo $this->getSuccessUrl()?>'); | |
return; | |
} else { | |
var msg = response.error_messages; | |
if (typeof(msg)=='object') { | |
msg = msg.join("\n"); | |
} | |
if (msg) { | |
$('review-please-wait').hide(); | |
alert(msg); | |
return; | |
} | |
} | |
$('review-please-wait').hide(); | |
alert('<?php echo $this->jsQuoteEscape($this->__('Unknown Error. Please try again later.')); ?>'); | |
return; | |
}, | |
onFailure: function(){ | |
alert('<?php echo $this->jsQuoteEscape($this->__('Server Error. Please try again.')) ?>'); | |
$('review-please-wait').hide(); | |
} | |
}); | |
} | |
} | |
<?php endif ?> | |
PayPalExpressAjax = new OrderReviewController($('order_review_form'), $('review_button'), | |
'shipping_method', null, 'details-reload' | |
); | |
PayPalExpressAjax.addPleaseWait($('review-please-wait')); | |
PayPalExpressAjax.setShippingAddressContainer($('shipping-address')); | |
PayPalExpressAjax.setShippingMethodContainer('shipping-method-container'); | |
PayPalExpressAjax.shippingMethodsUpdateUrl = '<?php echo $this->escapeHtml($this->getUpdateShippingMethodsUrl()) ?>'; | |
PayPalExpressAjax.setUpdateButton($('update_order'),'<?php echo $this->escapeHtml($this->getUpdateOrderSubmitUrl()) ?>','details-reload'); | |
if ($('billing:as_shipping')) { | |
PayPalExpressAjax.setCopyElement($('billing:as_shipping')); | |
} | |
//Workaround to unbind the event listeners for the agreement checkboxes | |
var agreementsBlock = $$('.checkout-agreements p.agree')[0]; | |
if(agreementsBlock != undefined) { | |
agreementsBlock.replace('<p class="agree">' + agreementsBlock.innerHTML + '</p>'); | |
} | |
//]]> | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!! But if you have more than one checkboxes you can use:
https://gist.github.com/thorstenfriesen/5574702