Copied to clipboard

Flag this post as spam?

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


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Qaisar 31 posts 77 karma points
    Oct 13, 2014 @ 10:11
    Qaisar
    0

    Adding dynamic properties to each orderline through Javascript

    I have created a new service as shown http://our.umbraco.org/projects/website-utilities/ucommerce/ucommerce-support/40250-Adding-dynamic-properties-via-javascript ; but I want to add a property on each orderline. I am not able to get hold of the current orderline object after creation with in this service class. Can you help?

    Following is the code

    public class AddToBasket
        {
            public int? CatalogId { get; set; }
            public int Quantity { get; set; }
            public string Sku { get; set; }
            public string VariantSku { get; set; }
            public bool AddToExistingLine { get; set; }
            public string Name { get; set; }
        }

        public class AddToBasketResponse : IHasResponseStatus
        {
            public ResponseStatus ResponseStatus { get; set; }
        }

        public class AddToBasketService : ServiceBase<AddToBasket>
        {
            protected override object Run(AddToBasket request)
            {
                TransactionLibrary.AddToBasket(request.Quantity, request.Sku, request.VariantSku, request.AddToExistingLine, true, request.CatalogId);
                TransactionLibrary.GetBasket().PurchaseOrder["Name"] = request.Name;
                TransactionLibrary.GetBasket().PurchaseOrder.Save();
                return new AddToBasketResponse();
            }
        }

  • Morten Skjoldager 440 posts 1499 karma points
    Oct 20, 2014 @ 11:32
    Morten Skjoldager
    0

    You can get the internal implementation of AddToBasket by:

    ObjectFactory.Instance.Resolve<TransactionLibraryInternal>(); that will return the orderLine in addToBasket.

  • Qaisar 31 posts 77 karma points
    Oct 20, 2014 @ 11:56
    Qaisar
    0

    Thanks Morten - I will give it a try.

  • Morten Skjoldager 440 posts 1499 karma points
    Oct 27, 2014 @ 09:35
    Morten Skjoldager
    0

    Any luck getting this resolved? 

  • Qaisar 31 posts 77 karma points
    Oct 27, 2014 @ 10:12
    Qaisar
    0

    Sorry for writing back so late been very busy on another project.

    Yes it has been resolved using your code :)

    Thanks



  • Morten Skjoldager 440 posts 1499 karma points
    Oct 27, 2014 @ 10:30
    Morten Skjoldager
    0

    Awsome sauce :) 

Please Sign in or register to post replies

Write your reply to:

Draft