Open gdav99 opened 9 years ago
Below is the working code for the older version of Minicart....
<script>
PAYPAL.apps.MiniCart.render({
events: {
onAddToCart: function (product) {
var hasAgreed = !!document.getElementById('on3').checked;
if (!product.os0) {
// Stop
alert('Please select your model?');
return false;
} else if (!product.os1) {
// Stop
alert('Please select a color?');
return false;
} else if (!product.os2) {
// Stop
alert('Please tell us how you heard about us?');
return false;
} else if (hasAgreed) {
// Continue
return true;
} else {
alert('You must agree to the Terms of Service.');
// Stop
return false;
}
}
}
});
</script>
This is what I assume would work for version 3.0.5 but I haven't a clue, I'm just going by what worked and what is being used in the new API examples.
<script>
paypal.minicart.render({
events: {
paypal.minicart.cart.on:('add', function (idx, product, isExisting) {
var hasAgreed = !!document.getElementById('on3').checked;
if (!product.get('os0') {
this.remove(idx);
// Stop
alert('Please select your model?');
return false;
} else if (!product.get.('os1') {
this.remove(idx);
// Stop
alert('Please select a color?');
return false;
} else if (!product.get.('os2') {
this.remove(idx);
// Stop
alert('Please tell us how you heard about us?');
return false;
} else if (hasAgreed) {
// Continue
return true;
} else {
alert('You must agree to the Terms of Service.');
// Stop
return false;
}
}
}
});
</script>
Also interested in this issue. Or is this project dead?
Need help adding multiple events similar to post #126 . If anyone has this working in v 3.05 please post. I am desperate to get this working for my web & mobile sites. I've been trying to figure this out for weeks but haven't a clue how all this code works. I am using the same 3 options os0, os1, os2 with a TOS checkbox. I've emailed Jeff multiple times with no reply, if anyone knows how to do this or would like to figure this out I will gladly donate $ thru PayPal for a working code. You can also email me at my ID above @ yahoo.com. Thanks, Gil.