Copied to clipboard

Flag this post as spam?

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


  • Kenn Jacobsen 133 posts 791 karma points MVP 4x c-trib
    Jul 20, 2011 @ 11:57
    Kenn Jacobsen
    0

    Adding custom properties to an order

    Hi,

    Does anyone know how to add (and save) custom properties to an order from the frontend?

    Take the (brilliant) example http://rune.gronkjaer.dk/en-US/2011/04/12/tea-commerce-dynamic-vat/ with the field "companyVATNo". How would one expose that field in the webshop to let the customer enter their VAT number, and have it saved to the order properties in a fashion that allows for the entered VAT number to be fetched from e.g. event handlers and to be displayed in the order summary in the admin interface?

    I've tried adding the property name ("companyVATNo") to the list contained in the form field "UpdateOrderProperties" in "cartStep02.xslt" from the starter kit, and also added a form field with the same name and ID to the form, but it doesn't do the trick.

      <div class="stepProgress02" id="cart">
        <form action="/tcbase/teacommerce/SubmitForm.aspx" method="post">
          <input name="ReturnUrl" type="hidden" value="/en/cart/shipping-and-payment.aspx" />
          <input name="UpdateOrderProperties" type="hidden" value="company,companyVATNo,firstName,lastName,streetAddress,zipCode,city,country,telephone,email,comments,shipping_firstName,shipping_lastName,shipping_streetAddress,shipping_zipCode,shipping_city" />
          <input name="SetCurrentCountry" type="hidden" value="country" />
        <xsl:call-template name="CartStepProgress" />
          
          <!-- General customer information START -->
        <div id="paymentInformation">
          <h2>Customer information</h2>
          <label for="company">Company</label>
          <input type="text" id="company" name="company" value="{$order/properties/company}" />
          <label for="companyVATNo">VAT number</label>
          <input type="text" id="companyVATNo" name="companyVATNo" value="{$order/properties/companyVATNo}" />
          ...

    Note: I'm using the 1.4.1.0 beta of Tea Commerce.

    Regards,
    Kenn

  • Rune Grønkjær 1372 posts 3103 karma points
    Jul 20, 2011 @ 12:03
    Rune Grønkjær
    0

    Hi Kenn,

    What is properly going wrong for you is that you have only added the companyVATNo to the fallback code. That part is only used if javascript is off in the browser.

    You also need to add the property to the sendCustomerInformation method in the teaCommerce_Simple.js file.

    Maybe I should improve that script one day to use the hidden fields values instead. Might be easier to add extra properties then.

    /Rune

  • Kenn Jacobsen 133 posts 791 karma points MVP 4x c-trib
    Jul 20, 2011 @ 13:06
    Kenn Jacobsen
    0

    Hi,

    That did the trick, thank you :-)

     

    ~Kenn

  • Rune Grønkjær 1372 posts 3103 karma points
    Jul 20, 2011 @ 13:33
    Rune Grønkjær
    0

    No problem. Glad to help.

    /Rune

Please Sign in or register to post replies

Write your reply to:

Draft