Copied to clipboard

Flag this post as spam?

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


  • Gordon Saxby 1461 posts 1883 karma points
    Jun 12, 2012 @ 12:45
    Gordon Saxby
    0

    Save Basket

    The site I am developing has a "product designer" where lots of options can be set, text entered, etc. I am storing all this extra info as OrderLine Properties and that is all working fine.

    I now need to add the ability for a logged in user (Umbraco member) to store a "product design" which they can come back to later.

    Initially I thought about adding a new order status ("Saved"?) and setting that when they choose to save the design. The product designer User Control creates a Tea Commerce order and adds order lines, properties, etc.

    If I was to follow the above procedure, how do I "finish" using the saved order and start a new order if they carry on with a new product?

    If the user later selects the saved product (order), I can set the current order to be this one ... but what about if they come back and select the saved product multiple times? I.E how would I make it a new order number each time?

    I can't help thinking that this is not the best approach ... what do you think and do you have any suggestions? Could I use the Tea Commerce tables in a non-order way to store saved products / orders / baskets?

     

  • Anders Burla 2560 posts 8256 karma points
    Jun 17, 2012 @ 17:26
    Anders Burla
    0

    Hi Gordon

    Sorry for the late response - Codegarden 12 :)

    You could hook into the .NET API and give all orders a unique GUID and make a new method that goes in the DB and look for an order id from a guid and loads the order into the customers session. You can use the Base.RemoveOrder to remove the current order from the customers session.

    If they selects a saved order multiple times you can use the .NET API to load the order and then call Clone on it. You would have to maybe set some of the properties to null depending on your setup - but this would be a start :)

    This is a good way to do it and I think it would work!

    Kind regards
    Anders

  • Gordon Saxby 1461 posts 1883 karma points
    Jul 03, 2012 @ 17:57
    Gordon Saxby
    0

    The situation has become more simple - I only need to save the conents of the current basket (= order). If the saved basket is retrieved later and completed then it is no longer a "saved" basket.

    I have managed to save a basket with a member ID assigned and a custom status of "saved" - the question is, how do I retrieve such orders (saved baskets)?

    I tried the following but it doesn't retrieve the "saved" order:

    var orders = TeaCommerce.Data.Order.OrdersXmlCache.Root.XPathSelectElements("./order [@memberId=" + m.Id + "]")

     

  • Anders Burla 2560 posts 8256 karma points
    Jul 03, 2012 @ 20:57
    Anders Burla
    0

    The orders should be finalized before that we be in the OrdersXmlCache. If you need to get the order from a specific guid or some other identifier - you will have to write a little sql script that will look in the database and find the right order id and then load that id into the SessionController.

    We normally saves a guid as an order property and then receives it from the DB.

    Kind regards
    Anders

  • Gordon Saxby 1461 posts 1883 karma points
    Jul 03, 2012 @ 21:09
    Gordon Saxby
    0

    I thought "finalised" meant "paid for"!?

    The Tea Commerce admin can find it - by selecting Order Stage = Cart ... can I do the same in C# ?

     

  • Anders Burla 2560 posts 8256 karma points
    Jul 04, 2012 @ 09:09
    Anders Burla
    0

    Sorry - yeah a finalized order is one that is paid for. When its a cart you need to go to the DB and fetch it. We dont that this isnt the best way to do it - but it works! :) We will make a much nicer API for Tea Commerce 2.0

    Kind regards
    Anders

Please Sign in or register to post replies

Write your reply to:

Draft