I could be wrong on the translation of the error of the first one though. In any case, I am not sure what's going wrong. I took the sample codes from Anders' blog as a reference and only made minor edits to this function.
/* The confirm order step of the cart */ jQuery('a#confirmOrder').live("click", function () {
var personalInformation = jQuery("#personalInformation");
/* We fetch the information from the form and creates an object that can be sent to the server as a form POST submit */ var formObj = { "firstName": personalInformation.find("#firstName").val(), "lastName": personalInformation.find("#lastName").val(), "email": personalInformation.find("#email").val(), "streetAddress": personalInformation.find("#streetAddress").val(), "zipCode": personalInformation.find("#zipCode").val(), "city": personalInformation.find("#city").val() };
/* The properties is sent to the server with a syncronous call This way we lock the UI and can redirect the user.*/ TeaCommerce.updateOrderProperties(formObj, false); TeaCommerce.goToPayment(); return false; });
The oddest thing is, it worked ONCE. But I can't make it work again.
What payment provider are you using? Have you called SetPaymentMethod? Tea Commerce can only generate a payment form if their is a payment method specified for the order.
No, I did not set a provider since the documentation said the following:
goToPayment
Sends the user to the selected payment method. If there is no selected
payment method or payment provider, the order will be automatically
approved and the user will be sent to the confirmation page.
Which is what I how I want/need to do it at the moment. So, is the documentation incorrect? Or is there something else?
The documentation is incorrect - we will fix that.
What it should say is that you must ALWAYS specify a payment method for an order by calling - SetPaymentMethod( paymentMethodId ) - this payment method can have the "Tea Commerce default" payment provider - this provider just approve the order and send the confirmation email. Could you try and see if thats what you want?
Sorry about the misleading documentation and thanks for noticing. I have edited it on my blog and in the teacommerce.js when we release the next version.
This is the new documentation for goToPayment:
Sends the user to the selected payment method. For this to work the order MUST have a payment method attached. An error will be thrown otherwise. If no payment provider has been attached to the payment method, the order will be automatically approved and the user will be sent to the confirmation page.
Error on goToPayment function
After hitting my confirm order button I get the following 2 errors in the FireFox error console:
Error: no element found
Source: http://teacommerce.clients.businessmedia.nl/tcbase/teacommerce/GeneratePaymentForm.aspx
Line: 1
and
Error: c[0] is undefined
Source: http://teacommerce.clients.businessmedia.nl/scripts/TeaCommerce/teaCommerce.js
Line: 1
I could be wrong on the translation of the error of the first one though. In any case, I am not sure what's going wrong. I took the sample codes from Anders' blog as a reference and only made minor edits to this function.
The oddest thing is, it worked ONCE. But I can't make it work again.
Kind regards,
-Ferdy
What payment provider are you using? Have you called SetPaymentMethod? Tea Commerce can only generate a payment form if their is a payment method specified for the order.
No, I did not set a provider since the documentation said the following:
Which is what I how I want/need to do it at the moment. So, is the documentation incorrect? Or is there something else?
-Ferdy
The documentation is incorrect - we will fix that.
What it should say is that you must ALWAYS specify a payment method for an order by calling - SetPaymentMethod( paymentMethodId ) - this payment method can have the "Tea Commerce default" payment provider - this provider just approve the order and send the confirmation email. Could you try and see if thats what you want?
Hi Ferdy,
Sorry about the misleading documentation and thanks for noticing. I have edited it on my blog and in the teacommerce.js when we release the next version.
This is the new documentation for goToPayment:
Sends the user to the selected payment method. For this to work the order MUST have a payment method attached. An error will be thrown otherwise. If no payment provider has been attached to the payment method, the order will be automatically approved and the user will be sent to the confirmation page.
/Rune
Ah, right. Thanks a lot once again!
Btw, I marked Rune's post as the answer (despite Anders being faster) since he has the updated documentation. Might be good for others too :)
-Ferdy
is working on a reply...