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.

  • Neo 22 posts 42 karma points
    Feb 24, 2011 @ 11:51
    Neo
    0

    namespaces to be used for the following functions

    Can you guys tell me the namespace to be used for the following functions? It need to use these functions in .NET usercontrols (via API)

     

    CommerceLibrary:ExecuteBasketPipeline();

    CommerceLibrary:DeleteLineItem($deleteLineItem);

    CommerceLibrary:GetBasket();

    CommerceLibrary:CreatePayment($paymentMethodId, -1, true(), true())"

    CommerceLibrary:CreateShipment($shippingMethodId, 'Shipment', true());

    CommerceLibrary:EditShipmentInformation()

    CommerceLibrary:Checkout()

    CommerceLibrary:SetBillingAddress('Billing')"

     

    Neo

     

  • Christian Wendler 46 posts 155 karma points
    Feb 24, 2011 @ 12:04
    Christian Wendler
    1

    The UCommerce XSLT functions are found in UCommerce.Xslt.Library. You may have a look at http://www.ucommerce.dk/docs/ for further investigation.

    Hope this helps.

     

    Christian

  • Neo 22 posts 42 karma points
    Feb 24, 2011 @ 12:10
    Neo
    0

    Hi Christian 

    Thanks for you reply. By the way I want to know the API equivalent for those functions?

    for eg. 

    CommerceLibrary:GetBasket() corresponds to SiteContext.Current.OrderContext.GetBasket();

     

    Like that how we can call this function ExecuteBasketPipeline(); in .NET usercontrol through API?

     

    Neo

     


  • Søren Spelling Lund 1797 posts 2786 karma points
    Feb 24, 2011 @ 13:30
    Søren Spelling Lund
    0

    Neo,

    You can call a pipeline with the following code from .NET

    var pipeline = PipelineFactory.Create<PurchaseOrder>("Basket"); // name of the pipeline found in /umbraco/ucommerce/pipelines 
    pipeline.Execute(purchaseOrder);
    
  • Neo 22 posts 42 karma points
    Feb 24, 2011 @ 14:24
    Neo
    0

    Thanks Soren.

    By the way can you please tell how to call the following methods?

     

    CommerceLibrary:CreatePayment($paymentMethodId, -1, true(), true())"

    CommerceLibrary:CreateShipment($shippingMethodId, 'Shipment', true());

    CommerceLibrary:EditShipmentInformation()

    CommerceLibrary:Checkout()

    CommerceLibrary:SetBillingAddress('Billing')

     

    And what is equavent for CommerceLibrary in API?

  • Søren Spelling Lund 1797 posts 2786 karma points
    Feb 24, 2011 @ 14:33
    Søren Spelling Lund
    0

    CreatePayment: new Payment()

    CreateShipment:

    PaymentMethod method = PaymentMethod.All().Single(x => x.PaymentMethodId == myId);
    var paymentFactory = method as IPaymentFactory;
    paymentFactory.CreatePayment(PaymentRequest);

    CreateShipment:

    purchaseOrder.CreateShipment(shippingMethod, shippingAddress);

    EditShipmentInformation:

    Shipment shipment = purchaseOrder.Shipments.First();
    OrderAddress address = shipment.ShippingAddress;
    address.FirstName = "Neo";

    Checkout:

    var pipeline = PipelineFactory.Create<PurchaseOrder>("Checkout");
    pipeline.Execute(purchaseOrder);

    SetBillingAddress:

    purchaseOrder.BillingAddress = address;
  • Neo 22 posts 42 karma points
    Feb 25, 2011 @ 12:53
    Neo
    0

    Thank you  Soren. This is what I am looking for.

     

    Got some more doubts.

     

    Basket BasketInstance = SiteContext.Current.OrderContext.GetBasket();

    //BasketInstance.PurchaseOrder

     

    OrderAddress address = new OrderAddress(); //Want to assign this address to PurchaseOrder (for both billing and shipping address)
    address.FirstName = "Neo"; 

    I need to assign Billing and Shipping address to the PurchaseOrder.

    But BasketInstance.PurchaseOrder.BillingAddress is not a valid property.

     

    and 

    Shipment shipment = BasketInstance.PurchaseOrder.Shipments.First();

    OrderAddress address = shipment.ShippingAddress; //Not a valid property

    address.FirstName = "Neo";

     

     

    Can you please help me on this?

     

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Feb 25, 2011 @ 13:16
    Søren Spelling Lund
    0

    Ah yes, you're using UCommerce.Entities so the way of associating objects to each other works than the EntitiesV2 example I showed above.

    Basically you need to do on the id level instead of object like so:

    BasketInstance.PurchaseOrder.BillingAddressId = billlingAddress.OrderAddressId;

    Same thing for shipping address.

    Hope this helps.

  • Neo 22 posts 42 karma points
    Feb 25, 2011 @ 14:09
    Neo
    0

    Is it the right way to assign Billing address?

    OrderAddress Address = new OrderAddress();
    Address.FirstName = "Neo";
    Address.Save();
    BasketInstance.PurchaseOrder.BillingAddressId = Address.OrderAddressId;

     

    But in the case of shipping there is no property called BasketInstance.PurchaseOrder.ShippingAddressId?

    Can you please show the code for adding shipping address also?

     

     

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Feb 25, 2011 @ 14:31
    Søren Spelling Lund
    0

    Shipping address is linked to the order via a shipment. If you're working with just one shipment here's how you do it:

    Shipment shipment = purchaseOrder.Shipments.First();
    shipment.ShippingAddressId = shippingAddress.OrderAddressId;
  • Neo 22 posts 42 karma points
    Feb 28, 2011 @ 09:20
    Neo
    0

    Thanks Soren for your reply.

    Can you please tell me the code to create payment and assign to a payment method?

    This is the payment method that I want to use.

    PaymentMethod Pay = PaymentMethod.SingleOrDefault(pm => pm.PaymentMethodServiceName.Equals("SagePay") && pm.Enabled);

  • Søren Spelling Lund 1797 posts 2786 karma points
    Feb 28, 2011 @ 10:38
    Søren Spelling Lund
    0

    Take a look at the last part of this article: Integrating uCommerce with a Payment Provider. It shows you how to execute a payment method service both from XSLT and .NET.

Please Sign in or register to post replies

Write your reply to:

Draft