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.

  • Garry 12 posts 32 karma points
    Jun 03, 2010 @ 08:51
    Garry
    0

    Another AddToBasket question

    Hello.
    I'm using the recommended code to add products to basket from c#.

    Library.AddToBasket(string catalogName, int quantity, string sku, string variantSku);

    But my basket is user independant. It is the same for all users and even when ClientContext.IsLoggedOn is false and ClientContext.CurrentMemberName is null.
    How can I get/create baskets for each user using your library?

    Thank you.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jun 03, 2010 @ 09:17
    Søren Spelling Lund
    0

    uCommerce uses cookies to identify individual baskets so you need to make sure that cookies are enabled on your machine otherwise you'll get a new basket every time you add something to the basket. This will happen automatically inside the APIs so you shouldn't have to worry about it.

    You can verify if this is the case by looking in the uCommerce_PurchaseOrder table. If you see new orders created in quick succession then you might have to look at whether a firewall or browser is blocking cookies on your site.

    To retrieve the existing basket for a user you can use SiteContext.ClientContext.GetBasket(true) to get the current basket for a user. The true parameter tells uCommerce to create a new basket for that user if no basket exists in cookie or session to start from.

    AddToBasket uses GetBasket internally and will create a new basket for you if you don't have one already.

  • Garry 12 posts 32 karma points
    Jun 03, 2010 @ 19:51
    Garry
    0

    Hello Soren,

    Ifound no SiteContext.ClientContext so I tried both XsltLibrary.ClientContext,GetBasket(true) and SiteContext.Current.OrderContext.GetBasket(true). No result. When i'm logged out or logged in as any user - the same basket.

    I am using standard asp:Login control.
    Do you have any idea?

    Many thanks!

  • Garry 12 posts 32 karma points
    Jun 03, 2010 @ 19:52
    Garry
    0

    My cookies and firewall are Ok, since all other sites work well.

  • Garry 12 posts 32 karma points
    Jun 03, 2010 @ 20:14
    Garry
    0

    Please have a look at my uCommerce_PurchaseOrder table (I truncated the columns after BasketId):

    165 WEB-1 66 7 30.08.09 15:49:19 30.08.09 16:05:38 5 13 46 NULL 7f5f78a2-bc53-4eec-8314-210185dc8b98
    166 NULL NULL 1 30.08.09 15:49:19 NULL 5 13 NULL NULL 7f5f78a2-bc53-4eec-8314-210185dc8b98
    167 WEB-2 67 7 30.08.09 16:10:57 30.08.09 16:13:20 5 13 47 NULL 06461b7f-fb70-4c12-a71d-7b4716816821
    168 NULL NULL 1 30.08.09 16:10:57 NULL 5 13 NULL NULL 06461b7f-fb70-4c12-a71d-7b4716816821
    169 WEB-3 68 7 03.09.09 19:57:34 03.09.09 20:14:05 5 13 48 NULL e6352adb-083b-4959-95fb-aff4d013ce44
    170 NULL NULL 1 03.09.09 19:57:34 NULL 5 13 NULL NULL e6352adb-083b-4959-95fb-aff4d013ce44
    171 NULL NULL 1 13.05.10 9:06:20 NULL 5 14 51 NULL 3d174064-578c-46f1-a2d0-e4b9248a8131
    172 NULL NULL 1 22.05.10 22:41:30 NULL 5 14 55 NULL 2671abeb-e43e-4221-9d17-3eb3a78f93bc
    173 NULL NULL 1 25.05.10 14:08:46 NULL 5 14 56 NULL 6316d156-27e5-4f35-9c7a-6af9ddb66e59
    174 NULL NULL 1 01.06.10 15:48:30 NULL 5 14 NULL NULL 84dd0fcd-30f3-449d-b061-d44202ecd762
    175 NULL NULL 1 02.06.10 17:39:33 NULL 5 14 NULL NULL d9193ce8-61ae-4f4f-adb0-27080b4ec950
    NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

    The third column is CustomerId and it is always NULL for my orders.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jun 10, 2010 @ 13:50
    Søren Spelling Lund
    0

    I think we might have been talking past each other here. If you're accessing the site from the same computer and browser you will actually get the same basket for all users as we use a cookie to find the basket when a user returns to the site.

    If you try a different machine or browser are you still getting the same basket?

  • Garry 12 posts 32 karma points
    Jun 11, 2010 @ 14:35
    Garry
    0

    When I'm trying other machine. the bsket if different.
    I thought baskets are user dependant. For example, if I'm connecting to the store from other machine, but logging in with my account, I will see my own basket. Moreover, if many users use the same machine, they will see their personal baskets after logon, won't they?

    As you stated above, baskets are machine/browser dependant, but each member doesn't have personal basket. Is that right?

    Thank you.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jun 11, 2010 @ 16:50
    Søren Spelling Lund
    0

    As it stands that's correct. If you're unhappy with the default you can override the OrderContext.GetBasket() with behavior more suitable to your needs. If you feel another default would be better I highly suggest that you it as a feature request on our uservoice at http://ucommerce.uservoice.com.

    Thanks.

  • Garry 12 posts 32 karma points
    Jun 14, 2010 @ 21:23
    Garry
    0

    Thanks a lot, Soren, I will do so.

Please Sign in or register to post replies

Write your reply to:

Draft