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.

  • VGBenjamin 11 posts 71 karma points
    Feb 07, 2013 @ 15:38
    VGBenjamin
    0

    Product url

    Hello,

     

    I have a subcategory page but on this page if I do the following code which work on anypage, on the subcategory page it return an empty string. Do you have a solution for it?
    var prd = UCommerce.EntitiesV2.Product.Get(118);
    var url = UCommerce.Api.CatalogLibrary.GetNiceUrlForProduct(prd3);

    Regards,

    Benjamin

  • Niels Jorck Ellegaard 39 posts 245 karma points
    Feb 07, 2013 @ 15:40
    Niels Jorck Ellegaard
    0

    You save a variable "prd" but insert "prd3" into the GetNiceUrlForProduct() method.

    Just a quick guess :)

  • VGBenjamin 11 posts 71 karma points
    Feb 07, 2013 @ 15:45
    VGBenjamin
    0

    No sorry it was just the code sample here. Correct code is:

    var prd = UCommerce.EntitiesV2.Product.Get(118);
    var url = UCommerce.Api.CatalogLibrary.GetNiceUrlForProduct(prd);

  • Niels Jorck Ellegaard 39 posts 245 karma points
    Feb 07, 2013 @ 15:49
    Niels Jorck Ellegaard
    100

    It just caught my eye :)

    You can try passing the category and catalog into the GetNiceUrlForProduct() aswell.

    It is optional parameters, but I think it will fix your issue.

  • VGBenjamin 11 posts 71 karma points
    Feb 07, 2013 @ 16:09
    VGBenjamin
    0

    Ok finally found the cause of the error. In fact, SiteContext.Current.CatalogContext.CurrentCatalog was not set correctly because my subcategory url rewriting was not correct.

    Thank you for your help,

    Benjamin 

  • Niels Jorck Ellegaard 39 posts 245 karma points
    Feb 07, 2013 @ 16:16
    Niels Jorck Ellegaard
    0

    No problem, glad I could help :)

    If you could mark the thread as solved, that would be fantastic :)

Please Sign in or register to post replies

Write your reply to:

Draft