Copied to clipboard

Flag this post as spam?

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


  • Kasper Skov 66 posts 346 karma points
    Oct 17, 2013 @ 11:24
    Kasper Skov
    0

    AddOrUpdateOrderLine custom properties HTML API

    I am trying to add some custom properties to my orderlines. I've followed the documentation, but nothing seems to happen. The DB values are just NULL.

        <form action="/base/TC/FormPost.aspx" method="post" class="ajaxForm">
              <input name="storeId" type="hidden" value="@storeId" />
              <input name="AddOrUpdateOrderLine" type="hidden" value="productIdentifier : productIdentifier , quantity : quantity, properties : properties" />
              <input name="properties" value="subscription : subscription , subscriptionInterval : subscriptionInterval" type="hidden" />
    
    @*Lots of other stuff *@
    
        <input name="subscription" value="0" type="hidden" />  
        <input name="subscriptionInterval" value="7" type="hidden" />
    </form>
    

    Am I doing anything wrong?

  • Anders Burla 2560 posts 8256 karma points
    Oct 17, 2013 @ 11:44
    Anders Burla
    0

    Running latest Tea Commerce? Else update :)

    If you are - is the subscription property in the DB for the order line? As these are order line properties

    Kind regards
    Anders

  • Kasper Skov 66 posts 346 karma points
    Oct 17, 2013 @ 11:48
    Kasper Skov
    0

    Using start kit 3.2. And yes - order lines.

  • Anders Burla 2560 posts 8256 karma points
    Oct 17, 2013 @ 12:04
    Anders Burla
    0

    Tried the example code from here and make it really simple and see if that works?
    http://documentation.teacommerce.net/html-api/order-line/addorupdateorderline/

    Try example 2

    Kind regards
    Anders

  • Kasper Skov 66 posts 346 karma points
    Oct 17, 2013 @ 12:54
    Kasper Skov
    0

    That is the exact example I based my code on. It's the standard code from the starter kid. I only included the two new inputs and the properties parameter on the AddOrUpdateOrderLine input.

  • Anders Burla 2560 posts 8256 karma points
    Oct 20, 2013 @ 18:14
    Anders Burla
    0

    Be sure to update to Tea Commerce 2.2. Then test again.

  • Rody 80 posts 280 karma points
    Oct 21, 2013 @ 11:42
    Rody
    1

    I see you are using an ajaxform css class, so this will probably post back the form using AJAX (and Jquery Form plugin). You can look at the result of this POST in the "network" tab of the browser (Chrome / Firefox/firebug) to look what the result of the POST is. I found this very helpful when debugging issues with the HTML api inside a ajaxified form. 

    But, as Anders said, update to 2.2 first if not up to date. 

  • Kasper Skov 66 posts 346 karma points
    Oct 21, 2013 @ 11:44
    Kasper Skov
    0

    Good point Rody. I didn't notice that. I will look into it.

  • Kasper Skov 66 posts 346 karma points
    Oct 21, 2013 @ 16:00
    Kasper Skov
    0

    No luck after updating to 2.2. Will look into the ajax post thingo.

  • Kasper Skov 66 posts 346 karma points
    Oct 21, 2013 @ 18:07
    Kasper Skov
    0

    @Rody removing the ajaxForm class doesnt make any difference. The page makes a full post back no matter if the class in there or not. So I can't really catch the result from the post as the page reloads. Or can I?

  • Rody 80 posts 280 karma points
    Oct 21, 2013 @ 18:10
    Rody
    1

    Kasper, you probably don't have the Jquery.form plugin loaded then. But that is no problem, if the page does a full postback and the site still works, this means the page is posted to /base/TC/FormPost.aspx and the orderline should be processed by teacommerce. 

    Can you post the exact form information shown in the NETWORK tab in the browser which is posted to the FormPost.aspx?

  • Kasper Skov 66 posts 346 karma points
    Oct 21, 2013 @ 18:40
    Kasper Skov
    0

    I didn't know you could save the network log on full page post backs. That's awesome. Here it is:

    enter image description here

    So my custom properties in the post (red underline). I fear that this is just me that has misunderstood the documentation. I thought the custom properties on my order lines would be stored in the tea commerce orderline table in the database. I guess it's stored in the umbraco property tables? But how am I suppose to get a hold on them again?

  • Rody 80 posts 280 karma points
    Oct 21, 2013 @ 18:45
    Rody
    100

    Nope, they are stored in the Teacommerce_CustomOrderLineProperty table. You can just get them in your order whenever using a Teacommerce Order object, from let's say the Razor API: http://documentation.teacommerce.net/razor-api/order/getcurrentorder/

     

  • Kasper Skov 66 posts 346 karma points
    Oct 21, 2013 @ 18:52
    Kasper Skov
    0

    Haha oh what I totally missed that table. That is awesome. Thanks alot!

Please Sign in or register to post replies

Write your reply to:

Draft