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.

  • Mads Jørgensen 74 posts 226 karma points
    Jun 18, 2012 @ 14:52
    Mads Jørgensen
    0

    Cannot create basket when not in product catalog

    Hey guys,

    Getting following error when trying to create a shopping basket.

    Cannot create basket when not in product catalog. Make sure that SiteContext.Current.CatalogContext.CurrentCatalogName contains the name of the current product catalog

    I can solve this by setting the query parameter catalog=[catalogName] in URL.

    All this is rendering in XSLT snippets. Is'nt there any smart ways of setting witch catalog I want to work with?

    What is best practise?

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jun 18, 2012 @ 15:10
    Søren Spelling Lund
    0

    You've got a couple of different options.

    1) By default uCommerce will carry the current catalog around as part of the URL. If you use the default friendly URLs generated by IUrlService you should be good to go.

    2) The catalog is primarily required to figure out which currency to create baskets with, so you could take over basket creating by calling CommerceLibrary:NewBasket(catalogName) with the currency you want. In Razor you can use SiteContext.Current.OrderContext.NewBasket(Currency)

    3) If you're dealing with a single catalog set up you could hardcode the URL returned by ICatalogContext by overriding the default implementation with your own (remember to register the new implementation in components.config).

    Hope this helps.

     

  • Mads Jørgensen 74 posts 226 karma points
    Jun 18, 2012 @ 15:51
    Mads Jørgensen
    0

    Not really I'm affraid. I'm not going to change the URL pattern of a whole lot of reasons :-)

    I went for your solution no. 2: the NewBasket extension method.

    Throws me an error: Could not find a catalog named [CatalogName].

    This is even though it's the same as when i call CommerceLibrary:GetCategory([CatalogName], [CategoryName]) or adding the ?catalog=[CatalogName] for that matter :-S

     

    Any suggestions on what i'm doing wrong?

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jul 04, 2012 @ 13:44
    Søren Spelling Lund
    0

    Turns out there was an issue which caused the catalog name provided to be overlooked.

    uCommerce 2.6.1.0 fixes that.

    Sorry for the inconvenience.

     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft