Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ferdy Hoefakker 214 posts 248 karma points
    Nov 30, 2010 @ 12:40
    Ferdy Hoefakker
    0

    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 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.

    Kind regards,

    -Ferdy

  • Anders Burla 2560 posts 8256 karma points
    Nov 30, 2010 @ 12:47
    Anders Burla
    0

    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.

  • Ferdy Hoefakker 214 posts 248 karma points
    Nov 30, 2010 @ 13:12
    Ferdy Hoefakker
    0

    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?

    -Ferdy

  • Anders Burla 2560 posts 8256 karma points
    Nov 30, 2010 @ 13:27
    Anders Burla
    1

    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?

  • Rune Grønkjær 1372 posts 3103 karma points
    Nov 30, 2010 @ 13:33
    Rune Grønkjær
    1

    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

  • Ferdy Hoefakker 214 posts 248 karma points
    Nov 30, 2010 @ 14:01
    Ferdy Hoefakker
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft