I have tried using AddOrUpdateOrderProperty to add the property, when continue the checkout, but it seems that I am missing something, because the property don't seem to exist, when I have modified edit-order.cshtml to include the property:
At the accept step the GeneratePaymentForm us used to generate the form that redirects to the payment gateway. Because of that your Tea Commerce specific methods isnt running at this step. If you need to do something like that you need to post it using javascript and then in the success method call the generatePaymentForm JS method and the customer will be redirected.
function initAccept() {
var acceptTermsCheck = jQuery('#acceptTermsCheck'),
next = jQuery('#next button'); //input
if (acceptTermsCheck[0]) {
next.click(function () {
if (!acceptTermsCheck.is(':checked')) {
//alert(acceptTermsCheck.attr('alt'));
// use bootbox for alert message
bootbox.alert(acceptTermsCheck.attr('alt'));
return false;
} else {
var form = jQuery("#subscribeNewletter").find('form');
//form.submit();
var url = form.attr("action");
$.ajax({
type: "POST",
url: url,
data: form.serialize(),
success: function (data) {
//console.log(data);
TC.generatePaymentForm({ storeId: 1 });
}
});
return false;
}
return true;
});
}
}
It add a value "on" to a property called newsletter_check when the checkbox is checked and no value when the checkbox isn't checked. Is there a way to decide with value to add to the property? e.g. true / false as string?
However I have modified the edit-order.cshtml to use this snippet, so I display a value whether the checkbox was checked or not:
Add property to order
Hi..
In the Accept step in the cart checkout, I need to add a true/false property to decide whether the customer want to be subscribed to newsletter.
In the Information step it use AddOrUpdateOrderProperties to add the properties.
I have tried using AddOrUpdateOrderProperty to add the property, when continue the checkout, but it seems that I am missing something, because the property don't seem to exist, when I have modified edit-order.cshtml to include the property:
/Bjarne
Hi Bjarne
At the accept step the GeneratePaymentForm us used to generate the form that redirects to the payment gateway. Because of that your Tea Commerce specific methods isnt running at this step. If you need to do something like that you need to post it using javascript and then in the success method call the generatePaymentForm JS method and the customer will be redirected.
Kind regards
Anders
Hi Anders
Okay, it seems that isn't a AddOrUpdateOrderProperty for HTML API, but only AddOrUpdateOrderProperties?
So now I have this:
and the following in my JavaScript:
It add a value "on" to a property called newsletter_check when the checkbox is checked and no value when the checkbox isn't checked.
Is there a way to decide with value to add to the property? e.g. true / false as string?
However I have modified the edit-order.cshtml to use this snippet, so I display a value whether the checkbox was checked or not:
/Bjarne
is working on a reply...