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.

  • Kim Bantz Rasmussen 81 posts 310 karma points
    Jun 29, 2015 @ 08:46
    Kim Bantz Rasmussen
    0

    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

     @{
                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>
                }
            }
    

    Redirects

    <add name="ToejCategoryProductRewrite" virtualUrl="(.*)/c-([0-9]+)/c-([0-9]+)/p-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/toej/product.aspx?catalog=$2&amp;category=$3&amp;product=$4" ignoreCase="true" xmlns="" />
    <add name="ToejProductRewrite" virtualUrl="(.*)/c-([0-9]+)/p-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/toej/product.aspx?catalog=$2&amp;product=$3" ignoreCase="true" xmlns="" />
    <add name="ToejCategoryRewrite" virtualUrl="(.*)/c-([0-9]+)/c-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/toej.aspx?catalog=$2&amp;category=$3" ignoreCase="true" xmlns="" />
    <add name="ToejCatalogRewrite" virtualUrl="(.*)/c-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/toej.aspx?catalog=$2" ignoreCase="true" xmlns="" />
    
    <add name="SecondHandCategoryProductRewrite" virtualUrl="(.*)/c-([0-9]+)/c-([0-9]+)/p-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/2nd-hand/product.aspx?catalog=$2&amp;category=$3&amp;product=$4" ignoreCase="true" xmlns="" />
    <add name="SecondHandProductRewrite" virtualUrl="(.*)/c-([0-9]+)/p-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/2nd-hand/product.aspx?catalog=$2&amp;product=$3" ignoreCase="true" xmlns="" />
    <add name="SecondHandCategoryRewrite" virtualUrl="(.*)/c-([0-9]+)/c-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/2nd-hand.aspx?catalog=$2&amp;category=$3" ignoreCase="true" xmlns="" />
    <add name="SecondHandCatalogRewrite" virtualUrl="(.*)/c-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/2nd-hand.aspx?catalog=$2" ignoreCase="true" xmlns="" />
    
    <add name="GarnCategoryProductRewrite" virtualUrl="(.*)/c-([0-9]+)/c-([0-9]+)/p-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/garn/product.aspx?catalog=$2&amp;category=$3&amp;product=$4" ignoreCase="true" xmlns="" />
    <add name="GarnProductRewrite" virtualUrl="(.*)/c-([0-9]+)/p-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/garn/product.aspx?catalog=$2&amp;product=$3" ignoreCase="true" xmlns="" />
    <add name="GarnCategoryRewrite" virtualUrl="(.*)/c-([0-9]+)/c-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/garn.aspx?catalog=$2&amp;category=$3" ignoreCase="true" xmlns="" />
    <add name="GarnCatalogRewrite" virtualUrl="(.*)/c-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/garn.aspx?catalog=$2" ignoreCase="true" xmlns="" />
    

    Best regards

    Kim

  • Martin 181 posts 740 karma points
    Jul 01, 2015 @ 15:20
    Martin
    100

    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

    <li><a href="@CatalogLibrary.GetNiceUrlForCategory(category, productCatalog)">@category.DisplayName()</a></li>
    

    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

  • Kim Bantz Rasmussen 81 posts 310 karma points
    Jul 02, 2015 @ 07:08
    Kim Bantz Rasmussen
    0

    Thank you! It was perfect :)

Please Sign in or register to post replies

Write your reply to:

Draft