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
    Apr 07, 2014 @ 10:46
    Rasmus Fjord
    0

    Adding to cart from serverside

    Hey :)

    Im trying to add products from the serverside, and it works .. almost :) 

    Im doing this in a base request : 

         HttpRequest request = HttpContext.Current.Request;
                
                int storeId = Convert.ToInt32(request["storeId"]);
                string productIdentifier = request["productIdentifier"];
                int quantity = Convert.ToInt32(request["quantity"]);
                Guid guid = Guid.Parse(request["guid"]);
                
                Order o = TC.SetCurrentOrder(storeId, guid);
              
                TC.SetCurrentPaymentCountry(storeId, 1);
                TC.SetCurrentCurrency(storeId, 1);
                o.OrderLines.AddOrUpdate(productIdentifier, quantity);

     

    The order gets added but it has no price, but if I afterwords add an other using HTML form, the price is calculated.

    When i call the price Obj of the orderline it just return Null

    So what am i missing ? 

  • Rasmus Fjord 659 posts 1546 karma points c-trib
    Apr 07, 2014 @ 11:47
    Rasmus Fjord
    100

    got it working -.-

    forgot to call  o.Save();

    though it got the orderline added without just didnt calc the prices.
  • 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