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?
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).
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
Cannot create basket when not in product catalog
Hey guys,
Getting following error when trying to create a shopping basket.
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?
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.
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.
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?
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.
is working on a reply...