I have a problem linking to categories. It seems that all catagories belongs to the same catalog, but they really are under different catalogs. All catalogs links to /2nd-hand/"categoryname" and not to: "2nd-hand/", "garn/" and "toej/" (my catalogs)
Navigation
@{
List<ProductCatalog> catalogs = UCommerce.Api.CatalogLibrary.GetAllCatalogs();
foreach (ProductCatalog productCatalog in catalogs)
{
<h1>@productCatalog.Name</h1>
<ul>
@foreach (Category category in productCatalog.GetRootCategories())
{
<li><a href="@CatalogLibrary.GetNiceUrlForCategory(category)">@category.DisplayName()</a></li>
if (!string.IsNullOrEmpty(category.ImageMediaId))
{
dynamic mediaItem = new DynamicMedia(category.ImageMediaId);
<img src="@mediaItem.umbracoFile" alt="@category.DisplayName()" />
}
}
</ul>
}
}
Depending on which version you're using of uCommerce there is slightly small chance that the second parameter has been added in newer versions but you have to take a look for the version you're using :-)
Wrong links to categories in different catalogs
I have a problem linking to categories. It seems that all catagories belongs to the same catalog, but they really are under different catalogs. All catalogs links to /2nd-hand/"categoryname" and not to: "2nd-hand/", "garn/" and "toej/" (my catalogs)
Navigation
Redirects
Best regards
Kim
Hi Kim,
CatalogLibrary.GetNiceUrlForCategory should also have a second parameter of ProductCatalog-type (which is by default null).
So you should be able to do this
Depending on which version you're using of uCommerce there is slightly small chance that the second parameter has been added in newer versions but you have to take a look for the version you're using :-)
Best regards Martin
Thank you! It was perfect :)
is working on a reply...