Copied to clipboard

Flag this post as spam?

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


  • Rasmus Fjord 659 posts 1546 karma points c-trib
    Sep 05, 2012 @ 15:43
    Rasmus Fjord
    0

    Adding unique orderline properties with JS

    Hey again : )

    Another small one, and its properbly just another syntax frack up from my part. 

    I want to add a property to a unique orderline using the JS API. 

    Here im just using the the "properties" edition of the "update" functions 

     var formObj = {"giftwrap": "true"       
    };
    TeaCommerce.updateUniqueOrderLineProperties(1168, 134, formObj,false );

    The numbers are just hardcoded for testing and is ofc right.

    But when i call getOrder again no new properties have been added to the orderline. I know im using the "update" function since i couldnt find an "addUniqueorderlineproperties" function. Gussing this could have something to do with it ?    

  • Rune Grønkjær 1303 posts 2895 karma points
    Sep 05, 2012 @ 15:49
    Rune Grønkjær
    0

    Might be because you are trying to write your code against the old javascript API. What version of Tea Commerce are you using?

    The method looks like this:

    TeaCommerce.updateUniqueOrderLineProperties(nodeId, orderLineId, propertyList, settings);

    So everything but the false looks right.

    /Rune

  • Rasmus Fjord 659 posts 1546 karma points c-trib
    Sep 05, 2012 @ 15:54
    Rasmus Fjord
    0

    im running 1.4.3.1

    Well ive tried it in severeal ways like this aswell TeaCommerce.updateUniqueOrderLineProperties(1168, 134, formObj);

    Its returning "null" but nothing is added.

  • Rune Grønkjær 1303 posts 2895 karma points
    Sep 05, 2012 @ 16:25
    Rune Grønkjær
    0

    That one is my fault. The documentation is wrong. This is what the method REALLY looks like:

    TeaCommerce.updateUniqueOrderLineProperties(orderLineId, propertyList, settings)
    

    I will fix the docs tomorrow!

    /Rune

  • Rasmus Fjord 659 posts 1546 karma points c-trib
    Sep 05, 2012 @ 18:45
    Rasmus Fjord
    0

    That is no problemo champ it can happen :) 

    I will test this tomorrow

  • Rasmus Fjord 659 posts 1546 karma points c-trib
    Sep 06, 2012 @ 08:03
    Rasmus Fjord
    0

    And it works :) I will mark your doc update as solution

    and my code looks like this now 

     

    TeaCommerce.updateUniqueOrderLineProperties(134, formObj)

  • Rune Grønkjær 1303 posts 2895 karma points
    Sep 06, 2012 @ 08:08
    Rune Grønkjær
    0

    Fantastic. And I have updated the documentation. Good thing you found the problem.

    /Rune

  • Rasmus Fjord 659 posts 1546 karma points c-trib
    Sep 06, 2012 @ 08:32
    Rasmus Fjord
    0

    Hey Rune 

    Another quicky here how do i remove the property from a line again ? There is no function for it. 

    So far i tried an empty string or "null" or a 0 as value but nothing removes the property

  • Rune Grønkjær 1303 posts 2895 karma points
    Sep 06, 2012 @ 09:39
    Rune Grønkjær
    0

    You can't. You can set the value to empty.

    /Rune

  • Rasmus Fjord 659 posts 1546 karma points c-trib
    Sep 06, 2012 @ 09:41
    Rasmus Fjord
    0

    Okay doky yea i made a work around with true/false values put inside.

    But thx for clearing it for me :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies