Copied to clipboard

Flag this post as spam?

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


  • Neil Hodges 338 posts 987 karma points
    Mar 15, 2014 @ 11:28
    Neil Hodges
    0

    OrderLine Property not getting value

    Hi

    Using the StarterKit Umbraco 6.1.6, and set a button to add a Donation into the OrderLine, ive set a empty Product in the back office and set it as Donation product, given it a generic property of textstring with alias donationamount

    Not sure what im doing wrong here but i have the below HTML to add the value of the Donation to the OrderLine via Properties, but when i inspect the OrderLine in the Cart its not getting a value.

    My code HTML below

    <form method="post" action="/base/TC/FormPost.aspx">
                <input name="AddOrUpdateOrderLine" value="productIdentifier, quantity, properties" type="hidden" />
                <input name="storeId" value="1" type="hidden" />
                <input name="productIdentifier" value="@donationNode.Id" type="hidden" />
                <input name="quantity" value="1" type="hidden" />
                <input name="returnUrl" value="/shop/cart" type="hidden" />
                <input id="donationamount" type="text" />
                <input id="uiBtnDonation" type="submit" class="btn" value="Add Donation to Basket" />
                <input name="properties" value="donationamount" type="hidden" />
            </form>

    i have tried putting the input box insde and outside of the from tag, and also in different places inside the form tag, also setting the from to do a ajax postback has the same result.

    Then when i have a break point in my cart on this line

     @foreach ( OrderLine orderLine in order.OrderLines ) {
              string donationAmount = TC.GetPropertyValue(storeId, orderLine.ProductIdentifier, "donationamount");

    The value is empty, not sure why as im sure ive followed the documention right. Any help would be greafully appreciated. Thanks.

     

  • Anders Burla 2560 posts 8256 karma points
    Mar 17, 2014 @ 08:26
    Anders Burla
    100

    Hi Niel

    In your code I would just use orderLine.Properties["donationamount"] - your code use order properties - but you should get the property from the order line. GetPropertyValue is to get a property form a node in Umbraco. So that is why it doesnt work :)

    Kind regards
    Anders

  • Neil Hodges 338 posts 987 karma points
    Mar 19, 2014 @ 10:25
    Neil Hodges
    0

    Hi Anders

    Finally figured it out, i was missing the name="" attribute of all things from the custom property field! i put it down to being a long day lol

    It's all working now, i created a override to incorporate the Donation amount into the Order total and Sub total and seems to work well.

    On another note Anders, when Warren did a rapid MVC conversion of the starterkit last year after his training i dont suppose you have a copy of that do you i could have, i'd like to look into converting the starterkit to fully MVC, and it be nice to see where he left off and i could possibly pick up.

    Cheers

    Neil.

  • Anders Burla 2560 posts 8256 karma points
    Mar 19, 2014 @ 12:00
    Anders Burla
    0

    Hi Neil

    Glad you solved it! :)

    I can't find the MVC starter kit. Warren just did a quick implementation with no UI etc. So I think the best way is just to start a new solution and start it as MVC and then start by creating the product page, add the product to the cart etc. Sorry I can't find the template.

    Kind regards
    Anders

  • Neil Hodges 338 posts 987 karma points
    Mar 19, 2014 @ 12:13
    Neil Hodges
    0

    Ah no worries, i'll give it a go between projects i have on at the moment :)

    Cheers

    Neil

Please Sign in or register to post replies

Write your reply to:

Draft