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.

  • Simon Dingley 1474 posts 3431 karma points c-trib
    Nov 23, 2011 @ 18:35
    Simon Dingley
    0

    Razor Reference Store

    Tryng to imoplement a relatively simple shop using pure razor and struggling on a few elements such as adding a product to the basket with selected properties e.g. size and colour and then initiating the checkout process. Is the reference store now available?

    Thanks, Simon

  • Søren Spelling Lund 1797 posts 2786 karma points
    Nov 29, 2011 @ 15:04
    Søren Spelling Lund
    0

    Hi Simon,

    The Razor store will be released for Umbraco 5 only.

    You can add the product like you would any product and then copy custom props to the order line afterwards.

    To add a product to the cart you can use the following code:

    var purchaseOrder = SiteContext.Current.OrderContext.GetBasket().PurchaseOrder;
    var orderLine = purchaseOrder.AddProduct(myProduct);
    foreach(var property in product.ProductProperties)
    orderLine[property.ProductDefinitionField.Name] = property.Value;
    purchaserOrder.Save();

    That should be the gist of it. Will copy all custom product properties to the order line. You could do a pipeline for it as well if you don't want the code in your UI layer.

Please Sign in or register to post replies

Write your reply to:

Draft